From b7a7ffcfcddbf5b3bf2f36d445127eac62349ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Fri, 23 Sep 2005 09:02:16 +0000 Subject: [PATCH] Report correctly USB device class and subclass when the device reports only one interface and the class is not defined in the device descriptor svn path=/trunk/; revision=18006 --- reactos/drivers/usb/usbhub/fdo.c | 42 ++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/reactos/drivers/usb/usbhub/fdo.c b/reactos/drivers/usb/usbhub/fdo.c index ded34f204ac..0d76fd3dba4 100644 --- a/reactos/drivers/usb/usbhub/fdo.c +++ b/reactos/drivers/usb/usbhub/fdo.c @@ -110,13 +110,11 @@ UsbhubFdoQueryBusRelations( if (!NT_SUCCESS(Status)) goto ByeBye; - DPRINT1("child #%lu: USB\\Vid_%04x&Pid_%04x&Rev_%04x (class %x:%x)\n", + DPRINT1("child #%lu: USB\\Vid_%04x&Pid_%04x&Rev_%04x\n", i, PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idProduct, - PdoExtension->dev->descriptor.bcdDevice, - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass); + PdoExtension->dev->descriptor.bcdDevice); sprintf(Buffer[0], "USB\\Vid_%04x&Pid_%04x&Rev_%04x", PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idProduct, @@ -139,15 +137,33 @@ UsbhubFdoQueryBusRelations( if (PdoExtension->dev->actconfig->desc.bNumInterfaces == 1) { /* Single-interface USB device */ - sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass, - PdoExtension->dev->descriptor.bDeviceProtocol); - sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", - PdoExtension->dev->descriptor.bDeviceClass, - PdoExtension->dev->descriptor.bDeviceSubClass); - sprintf(Buffer[2], "USB\\Class_%02x", - PdoExtension->dev->descriptor.bDeviceClass); + if (PdoExtension->dev->descriptor.bDeviceClass != 0) + { + /* Use these values for device class/sub class/protocol */ + sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", + PdoExtension->dev->descriptor.bDeviceClass, + PdoExtension->dev->descriptor.bDeviceSubClass, + PdoExtension->dev->descriptor.bDeviceProtocol); + sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", + PdoExtension->dev->descriptor.bDeviceClass, + PdoExtension->dev->descriptor.bDeviceSubClass); + sprintf(Buffer[2], "USB\\Class_%02x", + PdoExtension->dev->descriptor.bDeviceClass); + } + else + { + /* Use values specified in the interface descriptor */ + struct usb_host_interface *itf = PdoExtension->dev->actconfig->interface->altsetting; + sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", + itf->desc.bInterfaceClass, + itf->desc.bInterfaceSubClass, + itf->desc.bInterfaceProtocol); + sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", + itf->desc.bInterfaceClass, + itf->desc.bInterfaceSubClass); + sprintf(Buffer[2], "USB\\Class_%02x", + itf->desc.bInterfaceClass); + } Status = UsbhubInitMultiSzString( &PdoExtension->CompatibleIds, Buffer[0], Buffer[1], Buffer[2], NULL);