Remove unnecessary call to libusb_get_device_descriptor().

This commit is contained in:
Bert Vermeulen 2015-09-19 17:58:22 +02:00 committed by Uwe Hermann
parent 069d9f25d9
commit 8de8551b88
2 changed files with 2 additions and 15 deletions

View File

@ -541,11 +541,10 @@ SR_API const char *sr_dev_inst_connid_get(const struct sr_dev_inst *sdi)
{
#ifdef HAVE_LIBUSB_1_0
struct drv_context *drvc;
int r, cnt, i, a, b;
int cnt, i, a, b;
char connection_id[64];
struct sr_usb_dev_inst *usb;
struct libusb_device **devlist;
struct libusb_device_descriptor des;
#endif
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++) {
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. */
b = libusb_get_bus_number(devlist[i]);
a = libusb_get_device_address(devlist[i]);

View File

@ -352,9 +352,8 @@ SR_PRIV struct sr_dev_inst *lascar_scan(int bus, int address)
struct drv_context *drvc;
struct sr_dev_inst *sdi;
struct libusb_device **devlist;
struct libusb_device_descriptor des;
libusb_device_handle *dev_hdl;
int dummy, ret, i;
int dummy, i;
unsigned char config[MAX_CONFIGBLOCK_SIZE];
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);
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 ||
libusb_get_device_address(devlist[i]) != address)
continue;