Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 2010 08:24:35 +0000 (UTC)
From:      "Wojciech A. Koszek" <wkoszek@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r203773 - head/lib/libusb
Message-ID:  <201002110824.o1B8OZbo018578@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wkoszek
Date: Thu Feb 11 08:24:35 2010
New Revision: 203773
URL: http://svn.freebsd.org/changeset/base/203773

Log:
  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@

Modified:
  head/lib/libusb/libusb20_compat01.c

Modified: head/lib/libusb/libusb20_compat01.c
==============================================================================
--- head/lib/libusb/libusb20_compat01.c	Thu Feb 11 07:09:04 2010	(r203772)
+++ head/lib/libusb/libusb20_compat01.c	Thu Feb 11 08:24:35 2010	(r203773)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002110824.o1B8OZbo018578>