USB Configuration Descriptors
A Configuration Descriptor for a USB device contains a Configuration Header followed by descriptors for the Interfaces associated with the selected configuration of the USB device, as well as additional descriptors that may be associated with each Interface such as Endpoint descriptors and class-specific descriptors.
A USB Configuration Descriptor for a single-Interface device may appear as follows:
Configuration Header (USB_CONFIGURATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE (0x02) - wTotalLength = total length, in bytes, of all data for the configuration - bNumInterfaces = 1 (single Interface) ... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 0 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
A complete USB Configuration Descriptor for a multiple-Interface (Composite) device may appear as follows:
Configuration Header (USB_CONFIGURATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE (0x02) - wTotalLength = total length, in bytes, of all data for the configuration - bNumInterfaces = 3 (multiple Interfaces, Composite device) ... |
Interface Association Descriptor (USB_INTERFACE_ASSOCIATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE (0x0B) - bFirstInterface = 0 - bInterfaceCount = 2 - bFunctionClass - bFunctionSubClass - bFunctionProtocol ... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 0 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 1 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 2 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
The partial USB Configuration Descriptor presented by Usbccgp to the USB function driver for the first function of the above device may appear as follows:
Configuration Header (USB_CONFIGURATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE (0x02) - wTotalLength = total length, in bytes, of all data for the configuration - bNumInterfaces = 2 ... |
Interface Association Descriptor (USB_INTERFACE_ASSOCIATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE (0x0B) - bFirstInterface = 0 - bInterfaceCount = 2 - bFunctionClass - bFunctionSubClass - bFunctionProtocol ... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 0 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 1 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
The partial USB Configuration Descriptor presented by Usbccgp to the USB function driver for the second function of the above device may appear as follows:
Configuration Header (USB_CONFIGURATION_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE (0x02) - wTotalLength = total length, in bytes, of all data for the configuration - bNumInterfaces = 1 ... |
Interface Descriptor (USB_INTERFACE_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE (0x04) - bInterfaceNumber = 2 - bAlternateSetting - bNumEndpoints - bInterfaceClass - bInterfaceSubClass - bInterfaceProtocol ... |
Endpoint Descriptor(s) (USB_ENDPOINT_DESCRIPTOR) - bLength = size of this descriptor in bytes - bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE (0x05) - bEndpointAddress ... |
Class-Specific Descriptor(s) (optional) - bLength = size of this descriptor in bytes - bDescriptorType = class-specific descriptor type ... |
... |
Using one of the incorrect sample code implementations, a USB function driver loaded for this example second function would call USBD_ParseConfigurationDescriptorEx to search for Interface number 0. When this call failed to return a matching Interface Descriptor, the loop would increment the Interface number counter to 1, then terminate the loop since this counter now equals the number of interfaces reported for this partial Configuration Descriptor.
References
For more information on USB descriptor formats used by USB client drivers, see the following topics in the Windows Driver Kit (WDK) documentation:
USB_COMMON_DESCRIPTOR StructureUSB_CONFIGURATION_DESCRIPTOR StructureUSB_INTERFACE_DESCRIPTOR StructureUSB_ENDPOINT_DESCRIPTOR StructureFor more information on routines used to parse USB descriptors, see the following topic sin the Windows Driver Kit (WDK) documentation:
USBD_ParseConfigurationDescriptorExUSBD_ParseDescriptorsFor more information on USB Composite and Compound devices, see the following sections of the USB 2.0 specification:
- 4.8.2.2 Functions
- 5.2.3 Physical Bus Topology
The USB 2.0 specification is available for download from:
http://www.usb.org/developers/docsAffected Microsoft Windows drivers
The following drivers provided in Microsoft Windows are known to exhibit this problem:
Windows 7 and Windows Server 2008 R2:
- Usb8023.sys, Usb8023x.sys, Usb80236.sys (Remote NDIS [RNDIS] USB drivers)
- BthUsb.sys (Bluetooth USB Miniport Driver)
- UsbCamd.sys (Universal Serial Bus Camera Driver)
Windows Vista and Windows Server 2008:
- Usb8023.sys, Usb8023x.sys, Usb80236.sys (Remote NDIS [RNDIS] USB drivers)
- BthUsb.sys (Bluetooth USB Miniport Driver)
- UsbCamd.sys (Universal Serial Bus Camera Driver)
For USB composite devices with functions which use these in-box drivers, the device vendor may be able to work around the problem by reconfiguring their device so that the Interface(s) for the affected function appear(s) first in the USB Composite Device's Configuration Descriptor, or by implementing the device as a USB Compound device, as described above.