]> sigrok.org Git - libsigrok.git/commitdiff
session: Compile USB-specific code only if available
authorDaniel Elstner <redacted>
Mon, 7 Sep 2015 15:27:54 +0000 (17:27 +0200)
committerDaniel Elstner <redacted>
Mon, 7 Sep 2015 22:08:16 +0000 (00:08 +0200)
src/session.c

index 0f4a0d70e82bf733d2cca1595b819c4c10ee0e9a..3b8423d7081abebbf8993606cd4d0bb63dc63f90 100644 (file)
@@ -527,12 +527,14 @@ static int sr_session_iteration(struct sr_session *session)
                sr_spew("callback for event source %" G_GINTPTR_FORMAT " with"
                        " event mask 0x%.2X", poll_object, (unsigned)revents);
                if (!source->cb(fd, revents, source->cb_data)) {
+#if HAVE_LIBUSB_1_0
                        /* Hackish, to be cleaned up when porting to
                         * the GLib main loop.
                         */
                        if (poll_object == (gintptr)session->ctx->libusb_ctx)
                                usb_source_remove(session, session->ctx);
                        else
+#endif
                                sr_session_source_remove_internal(session,
                                                poll_object);
                }
@@ -1141,12 +1143,6 @@ SR_PRIV int sr_session_source_remove_internal(struct sr_session *session,
                                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;
 
                        sr_dbg("Removed event source %" G_GINTPTR_FORMAT ".",
                                poll_object);