aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb
diff options
context:
space:
mode:
authorWojciech A. Koszek <wkoszek@FreeBSD.org>2010-02-11 08:24:35 +0000
committerWojciech A. Koszek <wkoszek@FreeBSD.org>2010-02-11 08:24:35 +0000
commit9c7e1de8c31bee2740f23bb16e19056c40df80e1 (patch)
tree4e6d274c0096b05ee6e7782670f89ee249f99a3a /lib/libusb
parent3d28af024602cce2ba963cf07f08a3384499584a (diff)
downloadsrc-9c7e1de8c31bee2740f23bb16e19056c40df80e1.tar.gz
src-9c7e1de8c31bee2740f23bb16e19056c40df80e1.zip
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. There shouldn't be any negative change in behavior after this commit. Tested with: scanimage (sane) http://freebsd.czest.pl/~wkoszek/qemu/l.c Reviewed by: hps@
Notes
Notes: svn path=/head/; revision=203773
Diffstat (limited to 'lib/libusb')
-rw-r--r--lib/libusb/libusb20_compat01.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libusb/libusb20_compat01.c b/lib/libusb/libusb20_compat01.c
index 48a7dd5677b4..2fbbae7accf3 100644
--- a/lib/libusb/libusb20_compat01.c
+++ b/lib/libusb/libusb20_compat01.c
@@ -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;