]> sigrok.org Git - libsigrok.git/blobdiff - hardware/lascar-el-usb/protocol.c
Use common usb_source_add and usb_source_remove functions.
[libsigrok.git] / hardware / lascar-el-usb / protocol.c
index 09c8089c5fa15d696c422886fce9a913feb0f814..032db07e69c620c827b9f5d2cdba7ad2f1b4f520 100644 (file)
@@ -488,24 +488,18 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf,
 
 SR_PRIV int lascar_el_usb_handle_events(int fd, int revents, void *cb_data)
 {
-       struct dev_context *devc;
        struct drv_context *drvc = di->priv;
        struct sr_datafeed_packet packet;
        struct sr_dev_inst *sdi;
        struct timeval tv;
-       int i;
 
        (void)fd;
        (void)revents;
 
        sdi = cb_data;
-       devc = sdi->priv;
 
        if (sdi->status == SR_ST_STOPPING) {
-               for (i = 0; devc->usbfd[i] != -1; i++)
-                       sr_source_remove(devc->usbfd[i]);
-
-               sdi->driver->dev_close(sdi);
+               usb_source_remove(drvc->sr_ctx);
 
                packet.type = SR_DF_END;
                sr_session_send(cb_data, &packet);
@@ -660,4 +654,3 @@ SR_PRIV int lascar_stop_logging(const struct sr_dev_inst *sdi)
 
        return ret;
 }
-