From 689d78a0631b3ce2e341a947df0151f58e5ff21e Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 10 Aug 2010 19:45:04 +0100 Subject: remove unneeded sanity check in cache_config_descriptors * issue reported by Benjamin Dobell (with additional input from Tim Roberts) * unlike interface numbers, bConfigurationValue are not required to be in order * also produces actual bConfigurationValue in debug output * small whitespace fix in windows_usb.h --- libusb/os/windows_usb.c | 9 ++------- libusb/os/windows_usb.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index d26f01f..f41f064 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -832,13 +832,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); diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h index b2e9bd6..2353488 100644 --- a/libusb/os/windows_usb.h +++ b/libusb/os/windows_usb.h @@ -468,7 +468,7 @@ typedef struct _USB_INTERFACE_DESCRIPTOR { typedef struct _USB_CONFIGURATION_DESCRIPTOR { UCHAR bLength; UCHAR bDescriptorType; - USHORT wTotalLength; + USHORT wTotalLength; UCHAR bNumInterfaces; UCHAR bConfigurationValue; UCHAR iConfiguration; -- cgit v1.2.1