USB Function Controller Driver Bus Interface (Windows Embedded CE 6.0)
1/6/2010
The USB function controller driver MDD exposes a bus interface, which is implemented in the MDD. This allows USB function client drivers to be loaded as stream interface drivers. In response to the post-initialization IOCTL, the USB function controller driver's MDD loads the default USB function client listed in the registry under the HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers registry key. If this key does not exist, then the post-initialization IOCTL succeeds, but it will not enable the function controller. An application might add this key later, and then call the MDD with IOCTL_BUS_ACTIVATE_CHILD.
All USB function client driver registry keys are under HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers. The last USB function client driver registry settings choose the default FunctionDriver at boot-time. You can override the default in Platform.reg.
The following registry key example shows USB function client driver registry keys.
; @CESYSGEN IF CE_MODULES_USBMSFN
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"=- ; erase previous default
"DefaultClientDriver"="Mass_Storage_Class
; @CESYSGEN ENDIF CE_MODULES_USBMSFN
; @CESYSGEN IF CE_MODULES_RNDISFN
[HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
"DefaultClientDriver"=- ; erase previous default
"DefaultClientDriver"="RNDIS"
; @CESYSGEN ENDIF CE_MODULES_RNDISFN
Privileged applications can get a handle to the MDD's bus interface. Through DeviceIoControl, the privileged application can enumerate available clients with IOCTL_BUS_UFN_ENUMERATE_AVAILABLE_CLIENTS. It can also get the name of the current client. If the current client exists, the privileged application can unload the current client and load a new client. For more information about USB function controller driver IOCTLs, see USB Function Controller MDD IOCTLs.
The MDD supports all bus access IOCTLs except IOCTL_BUS_GET_CONFIGURE_DATA and IOCTL_BUS_SET_CONFIGURE_DATA. For more information about the bus access IOCTLs, see CEDDK Dynamic-Link Library Bus Access IOCTLs.
USB function clients call into the MDD through a table of function pointers. The DLL should not unload while a USB function client is calling into these function pointers.
To facilitate loading and unloading clients, a helper library is provided in the %_WINCEROOT%\PUBLIC\COMMON\OAK\DRIVERS\USBFN\UFNCLIENTLIB directory.