USB HID Class
The HID class consists of devices that are used by humans to control the operation of systems e.g. Keyboard, Mouse, Trackballs and Joy Sticks. HID classes are identified by a device as belonging to one of a finite number of classes (HID Class). A USB/HID class device uses a corresponding HID class to retrieve and route all the data. The routing and retrieval of data is accomplished by examining the descriptors of the device and that it provides which is depicted in the following figure;
The HID class device descriptors identify which other HID class descriptors are present and indicate their sizes e.g. Report and Physical descriptors. The HID does not have a human interface. The device just needs to be able to function within the limits of major abilities and limits of HID class devices
All data exchanged resides in fixed length structure called reports. The host sends and receives data by sending and requesting reports in a control or interrupts transfers. The report format is flexible and can handle just about any type of data.
A HID must have interrupt IN end point 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.The Interrupt IN end point enables the HID to send information to the host at unpredictable time’s e.g There is no way for the host computer to know when a user will press a key on the board.
The rate of data exchange is limited. A low speed interrupt end point, a maximum data transfer rate of 800 bytes/sec. For full speed points, the maximum is 64 KB/s. High Speed endpoints support faster rates.The USB specification allows for the connection of maximum of 127 peripheral devices to the system either on the same port or on different ports.
Descriptors
The following is the detail of descriptors used in USB HID class;
Device Descriptor
Describes the number of configurations supported by the device and specifies vendor information and device class.
Configuration Descriptor
Specify one/ more interface and define certain attributes associated with this configuration.
Interface Descriptor
Defines the number of endpoints related to the interface along with information needed by host software to determine how end points should be accessed.
String Descriptor
Optional descriptors consisting of a Unicode string that provide human readable information which can be displayed on host side device.
HID Class Descriptor
The HID class descriptors identify additional descriptors for HID communication. The class description has seven or more fields depending on the number of additional descriptors.
Report Descriptor
A report descriptor defines the format and use of the data in the HID reports. If the device is a mouse; the data reports mouse movements and button clicks. If the device is a relay controller, the data specifies which relay to open and close. The descriptor format is flexible enough for use with the devices with varied functions.
Case Study(USB Mouse)
The following is the details of descriptors used for USB mouse as Case Study;
Device Descriptor
Configuration Descriptor
Interface Descriptor
HID Descriptor
End Point Descriptor
Report Descriptor