Microsoft Windows CE 3.0  

USB Device Driver Installation

This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The HKEY_LOCAL_MACHINE\Drivers\USB\LoadClientskey must be set up correctly so that the USBD module can load the appropriate driver for a device when a device is attached to the bus. Each installed USB device driver must have a subkey within the LoadClientskey for the USBD module to load it.

For a USB device driver that is supplied by an OEM, the OEM should configure the LoadClientskey in a platform's .REG file to include subkeys for the driver. For third-party peripherals, however, the driver does not have appropriate subkeys when it is first connected to the platform. In this case, the USBD module fails to locate an appropriate USB device driver when the peripheral is attached to the bus. The USBD module instead displays a dialog box prompting a user to enter the name of the appropriate USB device driver DLL. The USBD then loads the specified driver to control the peripheral and calls the driver's USBInstallDriverfunction.

The USB device driver's USBInstallDriverfunction sets up the driver's subkey correctly within the LoadClientskey so that the USBD module can load the driver the next time that the peripheral is attached to the bus. The driver does this by creating a USB_DRIVER_SETTINGSstructure and passing it to the RegisterClientSettingsfunction. The format of the USB_DRIVER_SETTINGS structure parallels that of the LoadClientskey. If all the fields in a group have USB_NO_INFOvalue, the corresponding Group X_IDis set to Defaultin the registry. For example, the following example shows the USB_DRIVER_SETTINGSfor the HID class sample driver.

DriverSettings->dwVendorId = USB_NO_INFO;
DriverSettings->dwProductId = USB_NO_INFO;
DriverSettings->dwReleaseNumber = USB_NO_INFO;
DriverSettings->dwDeviceClass = USB_NO_INFO;
DriverSettings->dwDeviceSubClass = USB_NO_INFO;
DriverSettings->dwDeviceProtocol = USB_NO_INFO;
DriverSettings->dwInterfaceClass =
DriverSettings->dwInterfaceSubClass = USB_NO_INFO;
DriverSettings->dwInterfaceProtocol = USB_NO_INFO;

The following example shows how calling RegisterClientSettingswith this USB_Driver_Settingsstructure is equivalent to having set up this registry key.

[Default] [Default] [3] [Generic_Sample_Hid_Class_Driver]

In general, the client driver performs the following operations in USBInstallDriver: