summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2011-07-27 03:15:03 +0200
committerPeter Stuge <peter@stuge.se>2011-09-15 15:16:20 +0200
commit0eb7e43759003610d1afe6148aa6ff4f5859ccb0 (patch)
tree960969636bf4ec4ca060560fb59b664b3fc6a467
parent5010c3e80423d13acee6eeb4af974e8a9bcdd006 (diff)
downloadlibusbx-0eb7e43759003610d1afe6148aa6ff4f5859ccb0.tar.gz
Allow devices with zero configurations to be discovered
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>
-rw-r--r--libusb/core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libusb/core.c b/libusb/core.c
index 072d050..5309218 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -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;