usb: re-use existing values, don't re-determine bus and device address
Avoid repeated libusb bus number and device address retrieval operations, instead use variables where the information previously got stored to.
This commit is contained in:
parent
241c03029d
commit
6f63b1ee67
|
@ -384,8 +384,7 @@ SR_PRIV GSList *sr_usb_find(libusb_context *usb_ctx, const char *conn)
|
||||||
sr_dbg("Found USB device (VID:PID = %04x:%04x, bus.address = "
|
sr_dbg("Found USB device (VID:PID = %04x:%04x, bus.address = "
|
||||||
"%d.%d).", des.idVendor, des.idProduct, b, a);
|
"%d.%d).", des.idVendor, des.idProduct, b, a);
|
||||||
|
|
||||||
usb = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]),
|
usb = sr_usb_dev_inst_new(b, a, NULL);
|
||||||
libusb_get_device_address(devlist[i]), NULL);
|
|
||||||
devices = g_slist_append(devices, usb);
|
devices = g_slist_append(devices, usb);
|
||||||
}
|
}
|
||||||
libusb_free_device_list(devlist, 1);
|
libusb_free_device_list(devlist, 1);
|
||||||
|
|
Loading…
Reference in New Issue