- libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
- for (i = 0; devlist[i]; i++) {
- usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
- if (strcmp(sdi->connection_id, connection_id))
- continue;
- if ((ret = libusb_open(devlist[i], &usb->devhdl))) {
- sr_err("Failed to open device: %s.", libusb_error_name(ret));
- return SR_ERR;
- }
- break;
- }
- libusb_free_device_list(devlist, 1);
- if (!devlist[i]) {
- sr_err("Device not found.");
- return SR_ERR;
- }