USB Device Driver Implementation (Windows Embedded CE 6.0)
1/6/2010
This section describes how to write Windows Embedded CE device drivers for universal serial bus (USB) devices. USB device drivers exist to make the services of peripheral devices available to applications. Although there are no standard ways for USB devices must use to accomplish this, there are various strategies that USB device drivers can adopt, depending on the nature of the peripherals that they control.
The following table shows strategies for making the services of peripheral devices available to applications.
Strategy | Description |
---|---|
Use the stream interface functions. |
A USB device driver can expose the stream interface. Applications can then treat the peripheral device as a file and use standard file I/O functions to interact with the device. However, because the Device Manager is not involved in the loading and unloading of USB device drivers, any driver that exposes the stream interface must register and deregister its special device file name manually, using the ActivateDeviceEx and DeactivateDevice functions. These functions should be called when the USB device driver is loaded and unloaded. |
Use existing application programming interfaces (APIs). |
USB device drivers can indirectly expose certain types of peripherals to applications if there is an existing API that is appropriate to the peripheral. For example, USB device drivers for mass storage devices, such as hard drives and CD-ROM drives, can expose such devices through the standard installable file system interface. Similarly, a USB mouse device could use this strategy. The driver would not expose the mouse device directly to applications; rather, it would interact with existing APIs to submit the correct input events to the system. Thus, the USB nature of the mouse device is transparent to applications. |
Create a custom API specific to a particular USB device driver. |
This strategy allows you to create an API for the device that best maps to the ways that applications are likely to use it. The strategy does not place any restrictions on the way that a USB device driver exposes a device. You must provide appropriate documentation to application writers so that their applications can use the driver. |
See Also
Reference
Concepts
USB Host Controller Driver Development Concepts
USB Host Controller Driver Architecture