struct source *source;
GPollFD *pollfd;
gintptr poll_object;
-#if HAVE_LIBUSB_1_0 && !defined(G_OS_WIN32)
+#if HAVE_LIBUSB_1_0
int64_t usb_timeout;
int64_t usb_due;
struct timeval tv;
min_due = source->due;
source->triggered = FALSE;
}
-#if HAVE_LIBUSB_1_0 && !defined(G_OS_WIN32)
+#if HAVE_LIBUSB_1_0
usb_due = INT64_MAX;
if (session->ctx->usb_source_present) {
ret = libusb_get_next_timeout(session->ctx->libusb_ctx, &tv);
revents = 0;
due = source->due;
-#if HAVE_LIBUSB_1_0 && !defined(G_OS_WIN32)
- if (usb_due < due && source->poll_object
+#if HAVE_LIBUSB_1_0
+ if (usb_due < due && poll_object
== (gintptr)session->ctx->libusb_ctx)
due = usb_due;
#endif
g_array_remove_range(session->pollfds,
fd_index, source->num_fds);
g_array_remove_index(session->sources, i);
+ /*
+ * This is a bit of a hack. To be removed when
+ * porting over to the GLib main loop.
+ */
+ if (poll_object == (gintptr)session->ctx->libusb_ctx)
+ session->ctx->usb_source_present = FALSE;
return SR_OK;
}
fd_index += source->num_fds;