mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
MFC r203773
Within libusb 0.1 API, bus number is always faked to 0. Device numbers, however, are possitive and seem to be reverse sorted in the list. Conform device numbering and bring a result that is consistent with the libusb 0.1 API. It is now possible to distinguish a device based on its (bus, dev) numbers.
This commit is contained in:
parent
1eeca0bf19
commit
be5dc99871
1 changed files with 3 additions and 0 deletions
|
|
@ -829,6 +829,7 @@ usb_find_devices(void)
|
|||
struct libusb20_device *pdev;
|
||||
struct usb_device *udev;
|
||||
struct LIBUSB20_DEVICE_DESC_DECODED *ddesc;
|
||||
int devnum;
|
||||
int err;
|
||||
|
||||
/* cleanup after last device search */
|
||||
|
|
@ -855,6 +856,7 @@ usb_find_devices(void)
|
|||
}
|
||||
/* iterate all devices */
|
||||
|
||||
devnum = 1;
|
||||
pdev = NULL;
|
||||
while ((pdev = libusb20_be_device_foreach(usb_backend, pdev))) {
|
||||
udev = malloc(sizeof(*udev));
|
||||
|
|
@ -891,6 +893,7 @@ usb_find_devices(void)
|
|||
/* truncate number of configurations */
|
||||
udev->descriptor.bNumConfigurations = USB_MAXCONFIG;
|
||||
}
|
||||
udev->devnum = devnum++;
|
||||
/* link together the two structures */
|
||||
udev->dev = pdev;
|
||||
pdev->privLuData = udev;
|
||||
|
|
|
|||
Loading…
Reference in a new issue