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
This commit is contained in:
Hervé Poussineau 2005-09-23 09:02:16 +00:00
parent 0c7bb23c18
commit b7a7ffcfcd

View file

@ -110,13 +110,11 @@ UsbhubFdoQueryBusRelations(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
goto ByeBye; 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, i,
PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idVendor,
PdoExtension->dev->descriptor.idProduct, PdoExtension->dev->descriptor.idProduct,
PdoExtension->dev->descriptor.bcdDevice, PdoExtension->dev->descriptor.bcdDevice);
PdoExtension->dev->descriptor.bDeviceClass,
PdoExtension->dev->descriptor.bDeviceSubClass);
sprintf(Buffer[0], "USB\\Vid_%04x&Pid_%04x&Rev_%04x", sprintf(Buffer[0], "USB\\Vid_%04x&Pid_%04x&Rev_%04x",
PdoExtension->dev->descriptor.idVendor, PdoExtension->dev->descriptor.idVendor,
PdoExtension->dev->descriptor.idProduct, PdoExtension->dev->descriptor.idProduct,
@ -139,15 +137,33 @@ UsbhubFdoQueryBusRelations(
if (PdoExtension->dev->actconfig->desc.bNumInterfaces == 1) if (PdoExtension->dev->actconfig->desc.bNumInterfaces == 1)
{ {
/* Single-interface USB device */ /* Single-interface USB device */
sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x", if (PdoExtension->dev->descriptor.bDeviceClass != 0)
PdoExtension->dev->descriptor.bDeviceClass, {
PdoExtension->dev->descriptor.bDeviceSubClass, /* Use these values for device class/sub class/protocol */
PdoExtension->dev->descriptor.bDeviceProtocol); sprintf(Buffer[0], "USB\\Class_%02x&SubClass_%02x&Prot_%02x",
sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x", PdoExtension->dev->descriptor.bDeviceClass,
PdoExtension->dev->descriptor.bDeviceClass, PdoExtension->dev->descriptor.bDeviceSubClass,
PdoExtension->dev->descriptor.bDeviceSubClass); PdoExtension->dev->descriptor.bDeviceProtocol);
sprintf(Buffer[2], "USB\\Class_%02x", sprintf(Buffer[1], "USB\\Class_%02x&SubClass_%02x",
PdoExtension->dev->descriptor.bDeviceClass); 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( Status = UsbhubInitMultiSzString(
&PdoExtension->CompatibleIds, &PdoExtension->CompatibleIds,
Buffer[0], Buffer[1], Buffer[2], NULL); Buffer[0], Buffer[1], Buffer[2], NULL);