]> sigrok.org Git - libsigrok.git/blobdiff - hardware/lascar-el-usb/protocol.c
Switch to a non-recursive automake setup.
[libsigrok.git] / hardware / lascar-el-usb / protocol.c
index 1b75bef7aa906142fdc684e2a4f361c4e38b02cd..b1f39ccddab98a50df120ac0360cfdb4343d95d1 100644 (file)
@@ -55,7 +55,7 @@ static const struct elusb_profile profiles[] = {
 };
 
 
-SR_PRIV libusb_device_handle *lascar_open(struct libusb_device *dev)
+static libusb_device_handle *lascar_open(struct libusb_device *dev)
 {
        libusb_device_handle *dev_hdl;
        int ret;
@@ -202,7 +202,7 @@ cleanup:
        return *configlen ? SR_OK : SR_ERR;
 }
 
-SR_PRIV int lascar_save_config(libusb_device_handle *dev_hdl,
+static int lascar_save_config(libusb_device_handle *dev_hdl,
                unsigned char *config, int configlen)
 {
        struct drv_context *drvc;
@@ -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);
@@ -532,7 +526,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
        switch (transfer->status) {
        case LIBUSB_TRANSFER_NO_DEVICE:
                /* USB device was unplugged. */
-               hw_dev_acquisition_stop(sdi, sdi);
+               dev_acquisition_stop(sdi, sdi);
                return;
        case LIBUSB_TRANSFER_COMPLETED:
        case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
@@ -551,7 +545,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
                                devc->rcvd_bytes, devc->log_size,
                                devc->rcvd_samples, devc->logged_samples);
                if (devc->rcvd_bytes >= devc->log_size)
-                       hw_dev_acquisition_stop(sdi, sdi);
+                       dev_acquisition_stop(sdi, sdi);
        }
 
        if (sdi->status == SR_ST_ACTIVE) {
@@ -561,7 +555,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
                               libusb_error_name(ret));
                        g_free(transfer->buffer);
                        libusb_free_transfer(transfer);
-                       hw_dev_acquisition_stop(sdi, sdi);
+                       dev_acquisition_stop(sdi, sdi);
                }
        } else {
                /* This was the last transfer we're going to receive, so
@@ -660,4 +654,3 @@ SR_PRIV int lascar_stop_logging(const struct sr_dev_inst *sdi)
 
        return ret;
 }
-