In sr_session_iteration(), remove the inverted evaluation of the
block parameter if a USB source is present. This stops the deluge
of USB event callbacks due to the timeout always being zero.
Also, just for cleanliness, initialize the revents member of each
GPollFD instance to zero.
/* Set fd and local attributes */
devc->pollfd.fd = devc->fd;
devc->pollfd.events = G_IO_IN;
/* 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);
/* Get the default attributes */
beaglelogic_get_samplerate(devc);
#ifdef HAVE_LIBUSB_1_0
if (session->ctx->usb_source_present) {
#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",
ret = libusb_get_next_timeout(session->ctx->libusb_ctx, &tv);
if (ret < 0) {
sr_err("Error getting libusb timeout: %s",
p.fd = fd;
p.events = events;
p.fd = fd;
p.events = events;
return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)fd);
}
return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)fd);
}
#else
p.fd = g_io_channel_unix_get_fd(channel);
p.events = events;
#else
p.fd = g_io_channel_unix_get_fd(channel);
p.events = events;
#endif
return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)channel);
#endif
return _sr_session_source_add(session, &p, timeout, cb, cb_data, (gintptr)channel);
/* 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;
/* 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,
ctx->usb_cb = cb;
ctx->usb_cb_data = cb_data;
sr_session_source_add_pollfd(session, &ctx->usb_pollfd, timeout,