]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
Fix #442 by renaming sr_dev_driver.priv to .context
[libsigrok.git] / src / hardware / fx2lafw / api.c
index 724e2dd4e2ee0eb63b9ca3d723759c04eaf634f0..4348e680825af8c1f9be71ad8f344bd0a3607d2a 100644 (file)
@@ -193,7 +193,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        const char *conn;
        char manufacturer[64], product[64], serial_num[64], connection_id[64];
 
-       drvc = di->priv;
+       drvc = di->context;
 
        conn = NULL;
        for (l = options; l; l = l->next) {
@@ -355,7 +355,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
 static GSList *dev_list(const struct sr_dev_driver *di)
 {
-       return ((struct drv_context *)(di->priv))->instances;
+       return ((struct drv_context *)(di->context))->instances;
 }
 
 static int dev_open(struct sr_dev_inst *sdi)
@@ -370,16 +370,6 @@ static int dev_open(struct sr_dev_inst *sdi)
        devc = sdi->priv;
        usb = sdi->conn;
 
-       if (libusb_has_capability(LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER)) {
-               if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
-                       if ((ret = libusb_detach_kernel_driver(usb->devhdl, 0)) < 0) {
-                               sr_err("Failed to detach kernel driver: %s.",
-                                       libusb_error_name(ret));
-                               return SR_ERR;
-                       }
-               }
-       }
-
        /*
         * If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY_MS
         * milliseconds for the FX2 to renumerate.
@@ -478,7 +468,7 @@ static int cleanup(const struct sr_dev_driver *di)
        int ret;
        struct drv_context *drvc;
 
-       if (!(drvc = di->priv))
+       if (!(drvc = di->context))
                return SR_OK;
 
        ret = std_dev_clear(di, NULL);
@@ -774,7 +764,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR_DEV_CLOSED;
 
        di = sdi->driver;
-       drvc = di->priv;
+       drvc = di->context;
        devc = sdi->priv;
 
        devc->ctx = drvc->sr_ctx;
@@ -825,5 +815,5 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
        .dev_close = dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
-       .priv = NULL,
+       .context = NULL,
 };