|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.|
This section describes how to write device drivers for USB devices running on Windows CE. USB device drivers exist to make the services of peripheral devices available to applications. Although there are no standard mechanisms that 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:
A USB device driver can expose the stream interface functions. 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 driver s, any driver that exposes the stream interface functions must register and deregister its special device file name manually, using the ActivateDeviceand DeactivateDevicefunctions. These functions should be called when the USB device driver is loaded and unloaded, respectively.
USB device drivers can indirectly expose certain types of peripherals to applications if Windows CE has 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 Windows CE APIs to submit the correct input events to the system. Thus, the USB nature of the mouse device is transparent to applications.
This strategy does not place any restrictions on the way that a
USB device driver exposes a device. It allows you to create an API
for the device that best maps to the ways that applications are
likely to use it. However, you must provide appropriate
documentation to application writers so that their applications can
use the driver.
Last updated on Tuesday, July 13, 2004