Windows: Allow arbitrary bConfigurationValue in config descriptors
authorPete Batard <pbatard@gmail.com>
Tue, 5 Oct 2010 11:47:15 +0000 (12:47 +0100)
committerPeter Stuge <peter@stuge.se>
Mon, 13 Jun 2011 20:01:43 +0000 (22:01 +0200)
Unlike bInterfaceNumber, bConfigurationValue does not have to be
either sequential or contiguous. The bConfigurationValue is now
included in debug output. Fixes #48 reported by Benjamin Dobell.

libusb/os/windows_usb.c

index e19693e..b999746 100644 (file)
@@ -846,13 +846,8 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
                        LOOP_BREAK(LIBUSB_ERROR_IO);
                }
 
-               usbi_dbg("cached config descriptor #%d (%d bytes)", i+1, cd_data->wTotalLength);
-
-               // Sanity check. Ensures that indexes for our list of config desc is in the right order
-               if (i != (cd_data->bConfigurationValue-1)) {
-                       usbi_warn(ctx, "program assertion failed - config descriptors are being read out of order");
-                       continue;
-               }
+               usbi_dbg("cached config descriptor %d (bConfigurationValue=%d, %d bytes)",
+                       i, cd_data->bConfigurationValue, cd_data->wTotalLength);
 
                // Cache the descriptor
                priv->config_descriptor[i] = malloc(cd_data->wTotalLength);