diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 12af5c1d..604849c4 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -165,6 +165,7 @@ static int dev_open(struct sr_dev_inst *sdi) /* Set fd and local attributes */ devc->pollfd.fd = devc->fd; devc->pollfd.events = G_IO_IN; + devc->pollfd.revents = 0; /* Get the default attributes */ beaglelogic_get_samplerate(devc); diff --git a/src/session.c b/src/session.c index 20c9ce5f..499025b5 100644 --- a/src/session.c +++ b/src/session.c @@ -389,7 +389,6 @@ static int sr_session_iteration(struct sr_session *session, gboolean block) #ifdef HAVE_LIBUSB_1_0 if (session->ctx->usb_source_present) { - timeout = block ? 0 : session->source_timeout; ret = libusb_get_next_timeout(session->ctx->libusb_ctx, &tv); if (ret < 0) { sr_err("Error getting libusb timeout: %s", @@ -856,6 +855,7 @@ SR_API int sr_session_source_add(struct sr_session *session, int fd, p.fd = fd; p.events = events; + p.revents = 0; return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)fd); } @@ -908,6 +908,7 @@ SR_API int sr_session_source_add_channel(struct sr_session *session, #else p.fd = g_io_channel_unix_get_fd(channel); p.events = events; + p.revents = 0; #endif return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)channel); diff --git a/src/usb.c b/src/usb.c index f5b20c99..5038441c 100644 --- a/src/usb.c +++ b/src/usb.c @@ -251,6 +251,7 @@ SR_PRIV int usb_source_add(struct sr_session *session, struct sr_context *ctx, /* Add event, set by USB wait thread, to session poll set. */ ctx->usb_pollfd.fd = ctx->usb_wait_complete_event; ctx->usb_pollfd.events = G_IO_IN; + ctx->usb_pollfd.revents = 0; ctx->usb_cb = cb; ctx->usb_cb_data = cb_data; sr_session_source_add_pollfd(session, &ctx->usb_pollfd, timeout,