From b4447be2c37ef497d508dde8c671e32aed50a4e0 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 24 Jan 2012 17:00:30 +0000 Subject: [PATCH] [USBHUB] - Fix bugs introduced in 55134, 55135 - USB Mass Storage devices should now automatically install again svn path=/branches/usb-bringup-trunk/; revision=55147 --- drivers/usb/usbhub_new/fdo.c | 55 +++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/drivers/usb/usbhub_new/fdo.c b/drivers/usb/usbhub_new/fdo.c index 44287248441..8bb0d3b1430 100644 --- a/drivers/usb/usbhub_new/fdo.c +++ b/drivers/usb/usbhub_new/fdo.c @@ -830,6 +830,8 @@ IsCompositeDevice( // // composite device // + ASSERT(DeviceDescriptor->bDeviceSubClass == 0); + ASSERT(DeviceDescriptor->bDeviceProtocol == 0); return TRUE; } @@ -859,6 +861,8 @@ CreateDeviceIds( WCHAR Buffer[100]; PHUB_CHILDDEVICE_EXTENSION UsbChildExtension; PUSB_DEVICE_DESCRIPTOR DeviceDescriptor; + PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; + PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; // // get child device extension @@ -891,11 +895,27 @@ CreateDeviceIds( // DeviceDescriptor = &UsbChildExtension->DeviceDesc; + // + // get configuration descriptor + // + ConfigurationDescriptor = UsbChildExtension->FullConfigDesc; + + // + // get interface descriptor + // + InterfaceDescriptor = (PUSB_INTERFACE_DESCRIPTOR)(ConfigurationDescriptor + 1); + // // Construct the CompatibleIds // - if (IsCompositeDevice(DeviceDescriptor, UsbChildExtension->FullConfigDesc)) + if (IsCompositeDevice(DeviceDescriptor, ConfigurationDescriptor)) { + // + // sanity checks + // + ASSERT(DeviceDescriptor->bNumConfigurations == 1); + ASSERT(ConfigurationDescriptor->bNumInterfaces > 1); + Index += swprintf(&BufferPtr[Index], L"USB\\DevClass_%02x&SubClass_%02x&Prot_%02x", DeviceDescriptor->bDeviceClass, DeviceDescriptor->bDeviceSubClass, DeviceDescriptor->bDeviceProtocol) + 1; @@ -910,15 +930,42 @@ CreateDeviceIds( } else { - Index += swprintf(&BufferPtr[Index], + // + // sanity checks for simple usb device + // + ASSERT(ConfigurationDescriptor->bNumInterfaces == 1); + + // + // FIXME: support multiple configurations + // + ASSERT(DeviceDescriptor->bNumConfigurations == 1); + + if (DeviceDescriptor->bDeviceClass == 0) + { + Index += swprintf(&BufferPtr[Index], + L"USB\\Class_%02x&SubClass_%02x&Prot_%02x", + InterfaceDescriptor->bInterfaceClass, InterfaceDescriptor->bInterfaceSubClass, InterfaceDescriptor->bInterfaceProtocol) + 1; + Index += swprintf(&BufferPtr[Index], + L"USB\\Class_%02x&SubClass_%02x", + InterfaceDescriptor->bInterfaceClass, InterfaceDescriptor->bInterfaceSubClass) + 1; + Index += swprintf(&BufferPtr[Index], + L"USB\\Class_%02x", + InterfaceDescriptor->bInterfaceClass) + 1; + } + else + { + Index += swprintf(&BufferPtr[Index], L"USB\\Class_%02x&SubClass_%02x&Prot_%02x", DeviceDescriptor->bDeviceClass, DeviceDescriptor->bDeviceSubClass, DeviceDescriptor->bDeviceProtocol) + 1; - Index += swprintf(&BufferPtr[Index], + Index += swprintf(&BufferPtr[Index], L"USB\\Class_%02x&SubClass_%02x", DeviceDescriptor->bDeviceClass, DeviceDescriptor->bDeviceSubClass) + 1; - Index += swprintf(&BufferPtr[Index], + Index += swprintf(&BufferPtr[Index], L"USB\\Class_%02x", DeviceDescriptor->bDeviceClass) + 1; + + + } } BufferPtr[Index] = UNICODE_NULL;