PERFORCE change 152628 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Nov 7 10:27:37 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=152628
Change 152628 by hselasky at hselasky_laptop001 on 2008/11/07 18:27:23
Libusb-0.1.12 compatibility issue: Need to translate from
"bConfigurationValue" to configuration index when setting
the configuration. The error was indirectly reported by
Stefan Ehmann.
Affected files ...
.. //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#7 edit
.. //depot/projects/usb/src/usr.sbin/usbconfig/usbconfig.c#6 edit
Differences ...
==== //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#7 (text+ko) ====
@@ -670,11 +670,40 @@
}
int
-usb_set_configuration(usb_dev_handle * dev, int configuration)
+usb_set_configuration(usb_dev_handle * udev, int bConfigurationValue)
{
+ struct usb_device *dev;
int err;
+ uint8_t i;
+
+ /*
+ * Need to translate from "bConfigurationValue" to
+ * configuration index:
+ */
- err = libusb20_dev_set_config_index((void *)dev, configuration);
+ if (bConfigurationValue == 0) {
+ /* unconfigure */
+ i = 255;
+ } else {
+ /* lookup configuration index */
+ dev = usb_device(udev);
+
+ /* check if the configuration array is not there */
+ if (dev->config == NULL) {
+ return (-1);
+ }
+ for (i = 0;; i++) {
+ if (i == dev->descriptor.bNumConfigurations) {
+ /* "bConfigurationValue" not found */
+ return (-1);
+ }
+ if ((dev->config + i)->bConfigurationValue == bConfigurationValue) {
+ break;
+ }
+ }
+ }
+
+ err = libusb20_dev_set_config_index((void *)udev, i);
if (err)
return (-1);
==== //depot/projects/usb/src/usr.sbin/usbconfig/usbconfig.c#6 (text+ko) ====
@@ -266,8 +266,8 @@
"usbconfig - configure the USB subsystem" "\n"
"usage: usbconfig -u <busnum> -a <devaddr> -i <ifaceindex> [cmds...]" "\n"
"commands:" "\n"
- " set_config <num>" "\n"
- " set_alt <altno>" "\n"
+ " set_config <cfg_index>" "\n"
+ " set_alt <alt_index>" "\n"
" set_owner <user:group>" "\n"
" set_perm <mode>" "\n"
" add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> <quirk>" "\n"
More information about the p4-projects
mailing list