Chapter 11
278
9JCVKUC*+&!
The name human interface device suggests that HIDs interact directly with peo-
ple, and many HIDs do just that. A mouse detects when someone moves it or
presses a key. A host may send data that translates to an effect that a user senses
on a joystick. Besides keyboards, mice, and joysticks, devices with HID inter-
faces include remote controls; telephone keypads; game controls such as data
gloves and steering wheels; barcode readers; and UPS units. Devices with phys-
ical control panels can use a HID interface to send control-panel input to the
host. Devices with virtual control panels on the host can use a HID interface to
send control-panel data to the device. A virtual control panel can be cheaper to
implement than traditional physical controls on a device.
A HID doesn’t have to have a human interface. The device just needs to be able
to function within the limits of the HID class specification. These are the major
abilities and limits of HID-class devices:
• All data exchanged resides in fixed-length structures called reports. The
host sends and receives data by sending and requesting reports in control or
interrupt transfers. The report format is flexible and can handle just about
any type of data.
• A HID must have an interrupt IN endpoint for sending Input reports.
• A HID can have at most one interrupt IN endpoint and one interrupt
OUT endpoint. A device that requires more interrupt endpoints can be a
composite device with multiple HID interfaces. An application obtains sep-
arate handles for each HID in the device.
• The interrupt IN endpoint enables the HID to send information to the
host at unpredictable times. For example, there’s no way for the host com-
puter to know when a user will press a key on the keyboard, so the host’s
driver uses interrupt transactions to poll the device periodically to obtain
new data. SuperSpeed devices can send ERDY Transaction Packets to
request communications with the host.
• The rate of data exchange is limited. As Chapter 3 explained, a host can
guarantee a low-speed interrupt endpoint a maximum data transfer rate of
800 bytes/sec. For full-speed endpoints, the maximum is 64 kB/s.
High-speed and SuperSpeed endpoints support faster rates, but to comply
with the USB 2.0 and USB 3.0 specifications, the endpoints in the default
interface should request no more than 64 kB/s. Under Windows, support-
ing an alternate HID interface requires a vendor-provided driver, which