Книга: Writing Windows WDM Device Drivers

Device Classes

Device Classes

Some USB devices just exhibit basic USB features. However, USB goes on to specify several classes of devices, with common behavior and protocols. This makes it easier to write generic device drivers.

Table 20.1 shows the main USB device classes. The USB website has the full specifications for each class. The hub device class is specified in the standard USB Specification. I shall show later how the class constant (in the Interface descriptor) is sometimes used to identify the correct drivers for the device.

Table 20.1 Main USB device classes

Device class Example device Class constant
Audio Speakers USB_DEVICE_CLASS_AUDIO
Communication Modem USB_DEVICE_CLASS_COMMUNICATIONS
Human Input Device (HID) Keyboard, Mouse USB_DEVICE_CLASS_HUMAN_INTERFACE
Display Monitor USB_DEVICE_CLASS_MONITOR
Physical feedback devices Force feedback joystick USB_DEVICE_CLASS_PHYSICAL_INTERFACE
Power Uninterruptible power supply USB_DEVICE_CLASS_POWER
Printer USB_DEVICE_CLASS_PRINTER
Mass storage Hard drive USB_DEVICE_CLASS_STORAGE
Hub USB_DEVICE_CLASS_HUB

Human Input Devices (HID)

One of the USB device classes is for Human Input Devices (HID), described fully in Chapter 22. HID devices do not have to run on the USB, but they fit neatly into the USB device model.

HID provides an abstract model of input devices. A program that uses HID should not care how a device is connected, as long as a suitable HID minidriver is available for the interface. HID hides the implementation details.

Windows includes system HID drivers to interact with USB devices. If a USB device has an interface descriptor that says it is in the HID class, Windows loads the system HID drivers and the USB HID minidriver and reads the HID descriptors. You just need to write a HID client to do something with the device.

Оглавление книги


Генерация: 0.059. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз