Allow devices with zero configurations to be discovered
authorPeter Stuge <peter@stuge.se>
Wed, 27 Jul 2011 01:15:03 +0000 (03:15 +0200)
committerPeter Stuge <peter@stuge.se>
Thu, 15 Sep 2011 13:16:20 +0000 (15:16 +0200)
At least in Linux, wireless USB devices have zero configurations until
they have been authorized. This device state can be set for any USB
device using:

echo 0 > /sys/bus/usb/devices/?-?/authorized

An unauthorized device would previously make usbi_sanitize_device()
return LIBUSB_ERROR_IO, although there really was no I/O error.

Reported-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
libusb/core.c

index 072d050..5309218 100644 (file)
@@ -550,10 +550,8 @@ int usbi_sanitize_device(struct libusb_device *dev)
        if (num_configurations > USB_MAXCONFIG) {
                usbi_err(DEVICE_CTX(dev), "too many configurations");
                return LIBUSB_ERROR_IO;
-       } else if (num_configurations < 1) {
-               usbi_dbg("no configurations?");
-               return LIBUSB_ERROR_IO;
-       }
+       } else if (0 == num_configurations)
+               usbi_dbg("zero configurations, maybe an unauthorized device");
 
        dev->num_configurations = num_configurations;
        return 0;