struct sr_dev_inst *sdi;
struct timeval tv;
gint64 now;
- int i;
(void)fd;
(void)revents;
}
if (sdi->status == SR_ST_STOPPING) {
- for (i = 0; devc->usbfd[i] != -1; i++)
- sr_source_remove(devc->usbfd[i]);
+ usb_source_remove(drvc->sr_ctx);
dev_close(sdi);
{
struct dev_context *devc;
struct drv_context *drvc = di->priv;
- const struct libusb_pollfd **pfd;
struct sr_usb_dev_inst *usb;
struct libusb_transfer *transfer;
- int ret, i;
+ int ret;
unsigned char *buf;
if (sdi->status != SR_ST_ACTIVE)
/* Send header packet to the session bus. */
std_session_send_df_header(cb_data, LOG_PREFIX);
- pfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
- for (i = 0; pfd[i]; i++) {
- /* Handle USB events every 100ms, for decent latency. */
- sr_source_add(pfd[i]->fd, pfd[i]->events, 100,
- handle_events, (void *)sdi);
- /* We'll need to remove this fd later. */
- devc->usbfd[i] = pfd[i]->fd;
- }
- devc->usbfd[i] = -1;
+ usb_source_add(drvc->sr_ctx, 100, handle_events, (void *)sdi);
buf = g_try_malloc(DMM_DATA_SIZE);
transfer = libusb_alloc_transfer(0);