USB-Logo-With-WEC-2013

As everybody knows Windows CE 6.0 supports USB functional composite driver to load multiple client driver simultaneously. Normally we used to load the functional device classes having single interface descriptor. Some of the functional client driver like USB Video class (UVC) has multiple interface descriptors. While connecting the UVC device to PC, it will be detected as a composite device. Now there is a situation that a device having a mass storage functional driver, custom HID functional driver and a UVC functional driver (Composite device) will be loaded simultaneously on a composite functional driver. But we can’t load the UVC (composite device) on Windows CE composite functional driver directly without doing some tweak. This blog show a way to do this easily.

Loading Single Interface Descriptor Device on Composite Driver
Classes like Mass storage and USB serial are containing single interface descriptors. Configuring the functional driver with the composite driver is done by adding a set of registry settings. You can read the explanation in MSDN.
I have given sample registry settings for configuring the Mass storage on composite. Given registries are additional registries in the mass storage registry set to be used by the composite driver to load the mass storage device through it. I assumed that the registry entries for the composite functional driver is already entered using the above link. I am directly explaining the additional registries used for loading the mass storage functional driver on the composite. Following is the sample registry entries for the mass storage functional driver.

[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Mass_Storage_Class]
“CompositeFn_Configurations”=multi_sz:”0x00”
“CompositeFn_DefaultString”=”Microsoft Mass Storage”
“CompositeFn_FunctionClass”=dword:08
“CompositeFn_FunctionProtocol”=dword:ff
“CompositeFn_FunctionSubclass”=dword:00
“CompositeFn_FunctionDescription”=”USB MassStorage”
“CompositeFn_Disable”=dword:0

Normally, “CompositeFn_” Functionclass, FunctionProtocol and FunctionSubclass are taken from the Interface descriptor’s bInterfaceClass,bInterfaceSubClass and bInterfaceProtocol entries of the corresponding functional driver. If you have not given these values then the composite driver will take these entries from the first interface descriptor of the functional driver. These interface descriptor entries are enough for the successful enumeration of mass storage class on composite device.

Loading Multiple Interface Descriptors Device on Composite Class Driver
I have taken the UVC functional driver as an example driver that has multiple interface descriptors. If you insert the UVC camera, the device is detected as a composite device because it is having multiple interface descriptors. Now the question is -how can we provide the multiple Interface descriptor details on the registry? Because Windows CE composite driver will accept only one interface descriptor for each device and also there is no registry settings to add multiple interface descriptor. Let us see – how to resolve this issue?
Functional driver that contains multiple interface descriptors will have one more special descriptor called Interface Association Descriptor (IAD).This is only one for the driver and this describes the number of interface descriptor present in the device. Fortunately, there is one more registry entry related to IAD in Windows CE composite driver and it is undocumented. You can find this registry entry in the driver source code. The undocumented registry entry is “CompositeFN_” DisableIAD. Changing this registry setting to zero will enable you to configure the IAD details in the registry instead of configure the interface descriptor details (as shown above in the single descriptor example). The following example illustrates the usage of DisableIAD registry entry.
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\UVC_Class]
“CompositeFn_Configurations”=multi_sz:”0x00”
“CompositeFn_DefaultClient”=dword:1
“CompositeFn_DefaultString”=”Generic UVC”
“CompositeFn_FunctionDescription”=”UVC Device”
“CompositeFn_FunctionClass”=dword:0E
“CompositeFn_FunctionProtocol”=dword:0
“CompositeFn_FunctionSubclass”=dword:03
“CompositeFN_DisableIAD”=dword:0
“CompositeFn_Disable”=dword:0

DisableIAD is set to zero to indicate that the FunctionClass, FunctionClass and FunctionSubclass are containing the entries of bFunctionClass, bFunctionClass and bFunctionSubClass of the IAD and not the Interface descriptor’s bInterfaceClass,bInterfaceSubClass and bInterfaceProtocol entries.
Now the USB functional driver which contains multiple interface descriptors (UVC) along can be simultaneously loaded with a single interface descriptor driver (mass storage class) on the top of Windows CE composite driver successfully.