Removal of sdi->index, step 8: fix victor-dmm
This commit is contained in:
parent
bde9fbd197
commit
66c91e2509
|
@ -61,7 +61,8 @@ static GSList *scan(GSList *options)
|
||||||
struct libusb_device_descriptor des;
|
struct libusb_device_descriptor des;
|
||||||
libusb_device **devlist;
|
libusb_device **devlist;
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
int ret, devcnt, i;
|
int ret, i;
|
||||||
|
char connection_id[64];
|
||||||
|
|
||||||
(void)options;
|
(void)options;
|
||||||
|
|
||||||
|
@ -79,11 +80,13 @@ static GSList *scan(GSList *options)
|
||||||
if (des.idVendor != VICTOR_VID || des.idProduct != VICTOR_PID)
|
if (des.idVendor != VICTOR_VID || des.idProduct != VICTOR_PID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
devcnt = g_slist_length(drvc->instances);
|
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||||
if (!(sdi = sr_dev_inst_new(devcnt, SR_ST_INACTIVE,
|
|
||||||
|
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||||
VICTOR_VENDOR, NULL, NULL)))
|
VICTOR_VENDOR, NULL, NULL)))
|
||||||
return NULL;
|
return NULL;
|
||||||
sdi->driver = di;
|
sdi->driver = di;
|
||||||
|
sdi->connection_id = g_strdup(connection_id);
|
||||||
|
|
||||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
|
if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -117,6 +120,7 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
libusb_device **devlist;
|
libusb_device **devlist;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
char connection_id[64];
|
||||||
|
|
||||||
if (!di->priv) {
|
if (!di->priv) {
|
||||||
sr_err("Driver was not initialized.");
|
sr_err("Driver was not initialized.");
|
||||||
|
@ -127,8 +131,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
||||||
for (i = 0; devlist[i]; i++) {
|
for (i = 0; devlist[i]; i++) {
|
||||||
if (libusb_get_bus_number(devlist[i]) != usb->bus
|
usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
|
||||||
|| libusb_get_device_address(devlist[i]) != usb->address)
|
if (strcmp(sdi->connection_id, connection_id))
|
||||||
continue;
|
continue;
|
||||||
if ((ret = libusb_open(devlist[i], &usb->devhdl))) {
|
if ((ret = libusb_open(devlist[i], &usb->devhdl))) {
|
||||||
sr_err("Failed to open device: %s.", libusb_error_name(ret));
|
sr_err("Failed to open device: %s.", libusb_error_name(ret));
|
||||||
|
|
Loading…
Reference in New Issue