Remove unnecessary call to libusb_get_device_descriptor().
This commit is contained in:
parent
069d9f25d9
commit
8de8551b88
|
@ -541,11 +541,10 @@ SR_API const char *sr_dev_inst_connid_get(const struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
int r, cnt, i, a, b;
|
int cnt, i, a, b;
|
||||||
char connection_id[64];
|
char connection_id[64];
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
struct libusb_device **devlist;
|
struct libusb_device **devlist;
|
||||||
struct libusb_device_descriptor des;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
|
@ -576,12 +575,6 @@ SR_API const char *sr_dev_inst_connid_get(const struct sr_dev_inst *sdi)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
if ((r = libusb_get_device_descriptor(devlist[i], &des)) < 0) {
|
|
||||||
sr_err("Failed to get device descriptor: %s.",
|
|
||||||
libusb_error_name(r));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the USB device by the logical address we know. */
|
/* Find the USB device by the logical address we know. */
|
||||||
b = libusb_get_bus_number(devlist[i]);
|
b = libusb_get_bus_number(devlist[i]);
|
||||||
a = libusb_get_device_address(devlist[i]);
|
a = libusb_get_device_address(devlist[i]);
|
||||||
|
|
|
@ -352,9 +352,8 @@ SR_PRIV struct sr_dev_inst *lascar_scan(int bus, int address)
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct libusb_device **devlist;
|
struct libusb_device **devlist;
|
||||||
struct libusb_device_descriptor des;
|
|
||||||
libusb_device_handle *dev_hdl;
|
libusb_device_handle *dev_hdl;
|
||||||
int dummy, ret, i;
|
int dummy, i;
|
||||||
unsigned char config[MAX_CONFIGBLOCK_SIZE];
|
unsigned char config[MAX_CONFIGBLOCK_SIZE];
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
|
@ -362,11 +361,6 @@ SR_PRIV struct sr_dev_inst *lascar_scan(int bus, int address)
|
||||||
|
|
||||||
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 ((ret = libusb_get_device_descriptor(devlist[i], &des))) {
|
|
||||||
sr_err("Failed to get device descriptor: %d.", ret);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (libusb_get_bus_number(devlist[i]) != bus ||
|
if (libusb_get_bus_number(devlist[i]) != bus ||
|
||||||
libusb_get_device_address(devlist[i]) != address)
|
libusb_get_device_address(devlist[i]) != address)
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue