Customizing Enumeration of Interface Collections for Composite Devices
Some USB devices have interface collections that the USB Interface Association Descriptor (IAD) is unable to describe. In Windows Vista and later operating systems, vendors can customize the way the USB Generic Parent Driver (Usbccgp.sys) defines and enumerates a device's interface collections. This is done through an enumeration callback routine in a filter driver. The callback routine assists the generic parent driver in defining custom interface collections for the device.
For the generic parent driver to define custom interface collections, the vendor of the composite device must:
- Implement the enumeration callback routine (USBC_START_DEVICE_CALLBACK).
- Supply a pointer to the callback routine in the USB device configuration interface (StartDeviceCallback member of USBC_DEVICE_CONFIGURATION_INTERFACE_V1).
- Provide an INF file that matches the device ID of the composite device and explicitly loads both the USB generic parent driver and the filter driver.
The filter driver that contains the enumeration callback routine can be either an upper or a lower filter driver. When the USB generic parent driver receives an IRP_MN_START_DEVICE request to start a composite device, it queries for the USB device configuration interface by sending an IRP_MN_QUERY_INTERFACE request to the top of the driver stack.
On receiving an IRP_MN_QUERY_INTERFACE request, the filter driver must check the GUID type in the InterfaceType member of the request to verify that the interface that is requested is of type USB_BUS_INTERFACE_USBC_CONFIGURATION_GUID. If it is, the filter driver returns a pointer to the interface in the Interface member of the IRP.
The enumeration callback routine must return a pointer to an array of function descriptors (USBC_FUNCTION_DESCRIPTOR) that describe the interface collections. Each function descriptor contains an array of interface descriptors (USB_INTERFACE_DESCRIPTOR) that describe the interface collection. The callback routine must allocate both the function descriptors and the interface descriptors from non-paged pool. The generic parent driver releases this memory. The callback routine must ensure that the NumberOfInterfaces member of each USB_INTERFACE_DESCRIPTOR accurately reports the number of interfaces in the interface collection.
The generic parent driver creates a physical device object (PDO) for each function descriptor.
The USB device configuration interface and the enumeration callback routine is summarized in Generic Parent Driver Routines.
When a composite device meets the requirements described in Enumeration of USB Composite Devices, the operating system generates a compatible ID of
USB\COMPOSITE to indicate that the device is composite. The compatible ID produces a match in Usb.inf, and the operating system loads the USB generic parent driver, automatically, without the help of a vendor-supplied INF file.
However, this default mechanism does not work for composite devices that require custom enumeration of interface collections, because in the default mechanism the system does not load the required vendor-supplied filter driver. For the enumeration callback routine mechanism to work, the filter driver that exposes the USB device configuration interface must already be loaded when the USB generic parent enumerates the interface collections of the composite device. This requires the vendor of the composite device to install an INF file that matches the device ID of the composite device and explicitly loads both the USB generic parent driver and the filter driver.
- Enumeration of Interface Collections on USB Composite Devices
- USB Generic Parent Driver (Usbccgp.sys)