Bus-powered and Self-powered USB Devices

Windows CE 2.10 provides full support for bus-powered and self-powered USB devices. When a user connects a self-powered or bus-powered device to a Windows CE–based platform, the USB system software automatically accepts or rejects the device, based on the power requirements of the device. The power model is the same for both bus-powered and self-powered devices.

When a USB device is attached to a Windows CE–based platform, the HCD module sets the initial power configuration. During the device attachment processing phase, the HCD module reads the power requirements of the USB device configurations from the device configuration descriptor structures. In this way, the HCD module can choose an appropriate power configuration for the device.

Some devices may provide several configurations with different power requirements. OEMs who port an HCD module to their hardware can implement policies to choose the appropriate power configurations from those provided by the USB devices.

For example, Windows CE–based platforms have a registry setting that specifies the maximum total current draw allowable for USB devices connected to the host computer. If enabling a device would exceed this power threshold, the device is not configured unless the device has an alternate configuration with acceptable power requirements. OEMs can customize the platform-specific portions of the HCD module to choose dynamically whether to configure devices based on the current system power level. OEMs can implement a power model suitable for their platforms because the HCD module calls platform-specific code in its PDD layer for all USB devices connected to the bus. Therefore, an OEM can implement a power model that can selectively grant or deny power to individual USB devices according to whatever criteria the OEM chooses.

Because an HCD module cannot know which configuration might be appropriate for different uses of a USB device, a USB device driver can change its device configuration after the device driver is loaded, to the extent that the new configuration meets overall system power requirements. A USB device driver uses the SetConfiguration function to change a USB device configuration. In the unconfigured state, USB devices may not draw more than 100 mA.