Human interface device
A Human Interface Device (HID) is a standardized class of computer peripherals designed to enable direct interaction between humans and electronic systems, encompassing input devices like keyboards, mice, and touchpads, as well as output devices such as specialized displays and haptic feedback controllers, primarily defined within the Universal Serial Bus (USB) framework to ensure plug-and-play compatibility without custom drivers.[1] The HID specification, developed by the USB Implementers Forum (USB-IF), allows these devices to self-describe their data formats and capabilities through report descriptors, facilitating seamless communication via control and interrupt endpoints on the USB bus.[2] Introduced as part of the initial USB 1.0 standard in 1996, the HID class was proposed by Microsoft engineer Mike Van Flandern to unify human-input device protocols, evolving through revisions like version 1.11 released in 2001 to support extensibility and robustness in diverse applications.[3][1]
The core purpose of HID is to provide a compact, extensible protocol that minimizes device storage needs while enabling operating systems to interpret device reports generically, supporting both USB-aware environments and legacy boot protocols for keyboards (using 8-byte reports) and mice (using 3-byte reports).[1] Key features include the use of Usage Tables to define specific control functions—such as keycodes for alphanumeric input or pointer movements—and the ability to nest collections for complex devices like multifunction gamepads that combine multiple interfaces.[4] This self-describing nature ensures HID devices can skip unrecognized data, promoting forward compatibility as new usages are added without breaking existing implementations.[2] Microsoft Windows, for instance, includes built-in HID class drivers that handle enumeration and data parsing, making it a foundational standard for modern computing peripherals across desktops, laptops, and embedded systems.[5]
Beyond USB, the HID protocol has been adapted for other interfaces like Bluetooth Low Energy (BLE), extending its utility to wireless devices such as remote controls and wearable sensors, while maintaining core principles of low-latency input/output.[6] Notable examples include force-feedback joysticks for gaming, steering wheels for simulations, and barcode scanners in industrial settings, all leveraging HID's generic driver support to reduce development costs for manufacturers.[1] As of HID Usage Tables 1.6 (January 2025), HID continues to evolve, integrating with higher-speed USB versions and power delivery standards to accommodate advanced human-computer interfaces in emerging technologies like virtual reality and augmented reality systems.[4][2]
Overview
Definition and Purpose
A Human Interface Device (HID) is a USB device class protocol designed for peripherals that facilitate direct human interaction with computing systems, such as keyboards, mice, and joysticks.[1] This class enables these devices to operate in a plug-and-play fashion, where the host system recognizes and utilizes them without requiring bespoke drivers, as the protocol defines a common framework for data exchange.[5]
The core purpose of HID is to standardize communication between human interface peripherals and hosts, minimizing driver development overhead through the use of predefined usage tables that outline specific device functions and data interpretations.[1] By establishing this uniformity, HID ensures that manufacturers can produce compatible devices efficiently, while hosts interpret device capabilities dynamically based on self-describing descriptors.[2]
Among its key benefits, HID offers platform independence, allowing seamless operation across diverse operating systems including Windows, macOS, and Linux, without protocol adaptations.[2] It also supports bidirectional data flow, accommodating input from users—such as cursor movements or keystrokes—and output to devices, like activating status LEDs.[1]
The HID specification was first ratified by the USB Implementers Forum (USB-IF) in 1996 as part of broader USB standardization efforts.[5] Over time, the protocol has extended beyond USB to wireless implementations, such as the Bluetooth HID profile.
History and Development
The development of the Human Interface Device (HID) standard began in 1994 as part of the USB 1.0 initiative led by the USB Implementers Forum (USB-IF), which sought to standardize connections for peripherals and address incompatibilities arising from legacy interfaces such as serial ports, parallel ports, and proprietary buses used for input devices.[7] This effort aimed to enable plug-and-play functionality for human interface devices like keyboards and mice, reducing the need for custom drivers and simplifying system integration across diverse hardware. The HID class was conceived to provide a flexible, self-describing protocol that could accommodate a wide range of input and output devices while maintaining backward compatibility with existing systems.[1]
HID version 1.0 was formally released on January 30, 1996, as an integral component of the USB 1.0 specification, establishing the foundational framework for device descriptors, report structures, and usage tables that defined how HID devices communicate over USB.[1] Influenced by earlier standards, including IBM's PS/2 interface for keyboards and mice—which provided interrupt-driven communication—and Apple's Desktop Bus (ADB) for serial peripheral chaining, the HID design incorporated boot protocols to emulate PS/2 and similar legacy behaviors, ensuring seamless operation during system startup without specialized drivers.[1] These influences allowed HID to bridge the gap between old and new hardware ecosystems, promoting broader adoption by supporting familiar device behaviors.
Subsequent revisions refined the standard for emerging needs. HID 1.11, released on June 27, 2001, incorporated review requests and introduced support for multiple reports per interface as well as enhancements to boot protocols.[1] The core Device Class Definition for HID has remained at version 1.11 since then, with evolution occurring through updates to the HID Usage Tables (e.g., version 1.6 as of January 2025) that add new usages for devices, including radio controls and low-power operations.[8] Wireless capabilities were extended via the Bluetooth HID Profile version 1.0, released in 2003, facilitating non-USB transports for HID devices.[9]
Adoption accelerated in the late 1990s and early 2000s across major operating systems. Microsoft integrated native HID support in Windows 98, released in 1998, allowing out-of-the-box recognition of USB keyboards, mice, and other input devices without additional software.[10] Apple followed suit in 1999 with Mac OS 9, leveraging the iMac's USB ports to transition from ADB to HID-compliant peripherals, marking a pivotal shift in Macintosh hardware design.[11] In the Linux ecosystem, kernel-level HID drivers, initially developed by Vojtech Pavlik, were incorporated starting in the early 2000s, with full integration into the mainline kernel by version 2.4 in 2001 to enable broad support for USB input devices. The HID standard was briefly extended to Bluetooth in 2003 via the HID Profile.
HID Standard
Protocol Architecture
The Human Interface Device (HID) protocol operates as a standardized device class within the Universal Serial Bus (USB) framework, leveraging the USB endpoint model to facilitate communication between host systems and input/output peripherals. It primarily utilizes control transfers over Endpoint 0 for configuration and feature exchanges, alongside interrupt transfers for low-latency data exchange, enabling efficient handling of human-interaction events without requiring custom drivers on most operating systems.[1] The protocol's layered structure begins with the USB interface descriptor, where the class identifier bInterfaceClass = 0x03 signals HID compliance, followed by HID-specific descriptors that define the device's capabilities and data formats.[1]
At its core, the HID architecture organizes device functionality through top-level collections (TLCs), which represent logical groupings of inputs, outputs, and features—such as a keyboard or mouse as distinct application collections—allowing a single physical device to emulate multiple logical interfaces.[1] Main item tags within these collections specify how data is interpreted, including directives for inputs (e.g., button presses), outputs (e.g., LED controls), and features (e.g., configuration settings), ensuring a consistent parsing mechanism across diverse hardware.[1] This hierarchical structure supports modularity, where collections can nest to reflect complex interactions while maintaining interoperability.[1]
Data flow in the HID protocol is unidirectional for inputs and bidirectional for outputs and features, with the host initiating polls on interrupt IN endpoints to retrieve input reports asynchronously from the device.[1] Output reports are sent via interrupt OUT endpoints when supported, or fallback to control transfers, while feature reports enable bidirectional configuration exchanges over the control pipe.[1] This polling-based model minimizes bus overhead for event-driven devices, with idle states allowing the device to signal no new data via negative acknowledgments (NAKs).[1]
Error handling in the protocol relies on USB-standard mechanisms, where devices issue STALL conditions on endpoints to indicate unsupported requests, protocol errors, or temporary unavailability, prompting the host to clear the stall and retry.[1] Protocol stalls specifically address descriptor-related issues, resolved through control endpoint commands, ensuring robust recovery without disrupting overall communication.[1]
Report Descriptor
The HID Report Descriptor is a variable-length byte array that defines the structure and interpretation of HID reports exchanged between a device and host, enabling the host to parse input, output, and feature data from controls.[1] It is provided by the device during USB enumeration and serves as a blueprint for constructing report maps on the host side.[1]
The descriptor consists of a sequence of items, each beginning with a 1-byte prefix that encodes the item's size (lower 2-3 bits, indicating 0, 1, 2, or 4 bytes of data), type (next 2 bits: 0 for Main, 1 for Global, 2 for Local, 3 reserved), and tag (remaining 4-8 bits, specifying the item's function).[1] Short items range from 1 to 5 bytes total, while long items (reserved for future extensions) span 3 to 258 bytes with up to 255 bytes of data.[1] Items are parsed sequentially without nesting beyond collections, ensuring a linear interpretation.[1]
Items are categorized into three types based on their scope and effect. Main items define the core report elements: Input items describe data from device controls (e.g., button presses or axis movements), Output items specify data sent to actuators, Feature items handle configuration exchanges, and Collection/End Collection items group related controls hierarchically (e.g., Application or Physical collections).[1] Global items establish context applicable across multiple main items until overridden, such as Usage Page (selecting a 16-bit namespace for usages, like 0x01 for Generic Desktop), Logical Minimum/Maximum (defining value ranges), Report Size (bits per field), Report Count (number of fields), and Report ID (distinguishing multiple reports on a device).[1] Local items apply only to the immediately following main item, including Usage (identifying a specific control, e.g., "Mouse" or "X"), Usage Minimum/Maximum (for arrays of usages), and Report Count (reiterating field counts locally).[1]
During device enumeration, the host retrieves the Report Descriptor via a control request and parses it linearly to build internal report maps, using an item state table to track global settings and allocate structures for each main item.[1] This process maps logical data fields to physical report bytes, enabling the host to interpret incoming reports (e.g., extracting button states from bit positions) and generate outgoing ones.[1] Local items reset after each main item, while globals persist, allowing efficient descriptor composition without redundancy.[1]
A representative example is the Report Descriptor for a basic 3-button mouse with X and Y axes:
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Buttons)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x03, // Usage Maximum (3)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x05, // Report Size (5)
0x81, 0x03, // Input (Constant)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8)
0x95, 0x02, // Report Count (2)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection
0xC0 // End Collection
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Buttons)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x03, // Usage Maximum (3)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x05, // Report Size (5)
0x81, 0x03, // Input (Constant)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8)
0x95, 0x02, // Report Count (2)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection
0xC0 // End Collection
This defines a 4-byte input report: the first byte packs three 1-bit button states and 5 padding bits, followed by two 8-bit signed relative axes for X and Y movement.[1]
The HID Report Descriptor length is specified by the 16-bit wDescriptorLength field, allowing up to 65535 bytes. While USB control transfers may impose practical limits based on device speed (e.g., 64 bytes per packet for full-speed), the descriptor itself supports larger sizes.[1]
Physical Descriptor
The Physical Descriptor is an optional class-specific descriptor in the Human Interface Device (HID) standard, identified by bDescriptorType set to 0x41, that describes the physical aspects of device controls by specifying the human body parts intended to activate them.[1] This mapping aids host software in assigning functions consistently across similar controls, particularly for devices with multiple identical inputs, such as buttons or joysticks, by providing context on ergonomic design and user interaction.[1] Although supported since HID 1.0, it is rarely implemented due to the complexity it adds to descriptor parsing and device configuration.[1]
The descriptor consists of a fixed header followed by one or more physical descriptor sets, each detailing attributes for a specific control or collection. The header includes bNumber (1 byte), indicating the number of physical descriptor sets (excluding set 0), and bLength (2 bytes), specifying the size of each set in bytes.[1] Each set begins with bPhysicalInfo (1 byte), where bits 7-5 define Bias (a reference point for designator indices, such as hand preference) and bits 4-0 define Preference (a priority value from 0 for highest to 31 for lowest).[1] This is followed by three 2-byte fields: dPhysical Designator (identifying the body part, e.g., 0x0001 for hand or 0x0011 for thumb), dPhysical Qualifier (specifying attributes like side, e.g., 0x0001 for right hand or 0x0002 for left hand), and dPhysical Effort (quantifying activation ease, with 0 indicating the easiest and higher values increasing difficulty).[1]
In the Report Descriptor, the Physical Descriptor is referenced via the PhysicalDescriptor local item, which assigns an index to link a logical input (such as a button usage) to a specific physical descriptor set, thereby associating report data with physical human interaction details.[1] For instance, in a keypad implementation, a physical descriptor set might map keys to index finger activation (Designator 0x0012, Qualifier 0x0001 for right hand, Effort 0x0000), enabling host applications to emulate on-screen layouts or provide accessibility feedback based on expected user anatomy rather than arbitrary logical assignments.[1]
Device Definition and Classes
A Human Interface Device (HID) is defined within the USB specification as a device class used by humans to communicate input and output data to a host computer, such as keyboards, mice, and joysticks, enabling control and interaction with the system.[1] During USB device enumeration, the process begins with the host retrieving standard descriptors, where the interface descriptor specifies the HID class through the bInterfaceClass field set to 0x03, indicating an HID interface.[1] The bInterfaceSubClass field further refines this: a value of 0 denotes a generic HID interface without boot support, while 1 identifies a boot interface subclass for simplified compatibility with legacy systems like BIOS or UEFI.[1]
HID devices are classified primarily through usage pages and usages defined in the HID Usage Tables, which assign logical categories to device functions rather than rigid hardware types. As of version 1.6 (January 2025), the Generic Desktop usage page (0x01) encompasses common input devices like pointers (mice) with X and Y axes, keyboards with key codes, and joysticks with directional controls.[12] The Digitizers usage page (0x0D) covers touch-sensitive devices, such as touchscreens and styluses, supporting features like tip pressure and coordinate mapping.[12] Other classes include Simulation Controls (0x02) for flight simulators and Game Controls (0x05) for gamepads, allowing a single physical device to support multiple logical applications via top-level collections, which are application-level groupings that organize inputs without spanning reports across collections.[1][12] The HID Usage Tables, maintained by the USB-IF, were last updated to version 1.6 in January 2025, incorporating new usages for modern peripherals.[4]
The boot protocol provides a standardized, simplified interface for essential devices, using fixed report formats to ensure interoperability during system startup; for example, keyboards employ an 8-byte report structure, and mice use a 3-byte format, switchable via the host's Set_Protocol request.[1] In boot mode, report handling is limited to these predefined formats for basic functionality. Compliance with the HID standard requires devices to support core requests like Get_Report, and boot-compliant devices must additionally handle Get_Protocol and Set_Protocol, with full certification by the USB Implementers Forum (USB-IF) ensuring interoperability through testing and inclusion in the certified products list.[1][13]
Protocol Mechanics
Communication Components
Human Interface Devices (HID) rely on a structured set of communication components to facilitate data exchange between the device and the host. At the core are items, which serve as the atomic units within the HID report descriptor. Each item consists of a one-byte prefix that encodes the item tag, type, and size, followed by data bytes ranging from 0 to 4 bytes for short items or up to 255 bytes for long items.[1] The item tag specifies the function, such as 0x05 for Usage Page, which defines the context for interpreting subsequent usages.[1] Items are categorized into main, global, local, and collection types, with main items (Input, Output, Feature) directly contributing data to reports.[1]
Reports form the primary packets for data transmission in HID communication. These are structured collections of items that encapsulate device state or commands, limited to a maximum size of 8 bytes in low-speed USB transfers and 64 bytes in high-speed transfers per transaction.[1] HID supports three report types: Input reports, which convey data from the device to the host (e.g., keystrokes or mouse movements); Output reports, sent from the host to the device (e.g., LED controls on a keyboard); and Feature reports, which are bidirectional and used for configuration or status queries.[1] Only main items populate reports, excluding collection items, and reports may include a one-byte Report ID prefix to distinguish multiple report types on the same endpoint if multiplexing is employed; otherwise, a single report format is assumed.[1]
Host-device interaction in HID occurs through defined transfer mechanisms to ensure reliable data flow. The host initiates control transfers via Get_Report requests to retrieve Input or Feature reports from the device, or Set_Report requests to send Output or Feature reports to the device, using the default control pipe.[1] For real-time input, devices employ interrupt transfers over an Interrupt In pipe, allowing asynchronous pushes of Input reports without host polling.[1] Output reports may optionally use an Interrupt Out pipe for host-initiated updates, though control transfers suffice for less frequent interactions.[1] These mechanisms support both pull models, where the host explicitly requests data via control transfers, and push models, where the device proactively sends updates via interrupt transfers.[1]
Efficiency in HID communication is achieved through bit-level packing and padding strategies within reports. Data fields are defined using Report Size and Report Count items to allocate precise bit widths, enabling compact representation—for instance, a mouse report might pack button states in 3 bits with 5 bits of padding to reach a byte boundary.[1] Constant padding fields maintain alignment without conveying meaningful data, conserving bandwidth in constrained transfers.[1] Report IDs further enhance efficiency by allowing a single endpoint to multiplex multiple distinct report formats, such as separating keyboard and mouse inputs with IDs like 0x00 and 0x01, respectively.[1]
State management in HID descriptors and reports ensures consistent interpretation of data across interactions. Global items, such as Logical Minimum and Maximum, maintain a state table that applies to subsequent local items until modified; Push and Pop items allow stacking and restoring this state for nested collections.[1] In terms of data flow, devices manage report transmission rates— for example, keyboards may send updates at an Idle rate in push mode or only upon host pull requests—balancing responsiveness with power efficiency.[1] This layered approach to state handling supports complex device behaviors while adhering to the protocol's lightweight design.[1]
Usage Tables and Pages
The HID Usage Tables, maintained by the USB Implementers Forum (USB-IF), provide a standardized set of constants known as usages that define the semantic meaning of data fields in HID reports, enabling interoperable interpretation across devices and operating systems.[4] These tables are organized hierarchically, with usages grouped under 16-bit Usage Pages that categorize related controls or functions, such as input, output, or feature items. For instance, Usage Page 0x01 (Generic Desktop Controls) includes usages for common pointing and navigation elements, while Usage Page 0x07 (Keyboard/Keypad) defines key codes for alphanumeric and modifier inputs.[4]
Within each Usage Page, individual usages are 16-bit identifiers that specify precise behaviors, often accompanied by logical minimum and maximum values to define the range of reportable data. A representative example from the Generic Desktop Page is Usage 0x30 (X), which represents horizontal axis movement for pointers or joysticks, typically ranging from -127 to 127 for relative positioning.[4] Similarly, in the Keyboard Page, Usage 0x04 denotes the letter "A" key press. This hierarchical structure—Usage Page followed by Usage, with optional min/max bounds—allows descriptors to precisely map physical inputs to logical outputs without ambiguity.[4]
The tables are extensible to accommodate evolving device capabilities while preserving standardization. Vendor-specific extensions are allocated in the private Usage Page range of 0xFF00 to 0xFFFF, where manufacturers can define custom usages without conflicting with reserved standard values; these must be declared in the device's report descriptor to ensure host systems ignore unrecognized items.[4]
The latest iteration, HID Usage Tables 1.6 released in January 2025, incorporates updates for emerging technologies, including new usages in dedicated pages for virtual reality (VR) and augmented reality (AR) controls, such as head tracking and gesture inputs, to support immersive applications.[4] These additions build on prior versions, ensuring backward compatibility while expanding the framework for modern HID implementations. In practice, usages from these tables are referenced in report descriptors to structure data transmission, allowing hosts to parse and route inputs appropriately.[4]
Report Types and Handling
Human Interface Devices (HID) utilize three primary report types to facilitate communication between the device and the host: Input Reports, Output Reports, and Feature Reports. These reports encapsulate data in a structured format defined by the HID protocol, allowing for standardized interpretation across different operating systems and transport layers.[1]
Input Reports convey data from the device to the host, representing user interactions or sensor readings. For instance, a keyboard sends key press events, while a mouse reports cursor movement coordinates. These reports are typically transmitted asynchronously via interrupt IN endpoints in USB implementations, enabling low-latency delivery of real-time input data to the host. In scenarios requiring on-demand retrieval, hosts can request Input Reports through control transfers using the Get_Report request.[1]
Output Reports enable the host to send commands or data to the device, primarily for controlling output mechanisms. A common example is a host instructing a keyboard to illuminate status LEDs, such as Caps Lock or Num Lock indicators. Transmission occurs via interrupt OUT endpoints where supported, providing efficient periodic updates, or through control transfers with the Set_Report request as a fallback. This mechanism allows hosts to provide feedback or adjust device behavior without interrupting primary input flows.[1]
Feature Reports support bidirectional communication for device configuration, diagnostics, or non-time-critical settings. Examples include adjusting a mouse's pointer acceleration or querying a device's power status. Unlike Input and Output Reports, Feature Reports are exclusively handled via control transfers—Get_Report for reading from the device and Set_Report for writing—ensuring reliable but lower-priority exchange suitable for setup operations.[1]
In devices supporting multiple report types or formats within a single interface, a Report ID byte (ranging from 0 to 255) prefixes the report data to distinguish between them. For single-report devices, no ID byte is used, simplifying the format. This ID is defined in the device's Report Descriptor and allows the host to route incoming data accurately.[1]
Host handling of reports involves a standardized parsing and routing process. Upon receipt, the host's HID driver examines the Report ID (if present) to select the appropriate Report Descriptor. The descriptor's structure—defining field sizes, types, and Usage Page mappings—guides the extraction of meaningful values from the report bytes. Usages, which specify semantic meanings (e.g., "Keyboard A" or "X Axis"), are then applied to interpret the data. Finally, the processed input is routed to the operating system's input stack, such as delivering key events to the keyboard subsystem or cursor updates to the pointing device handler, enabling seamless integration with applications.[1][14]
Implementations
HID over USB
HID over USB implements the Human Interface Device (HID) class as a USB device class, enabling standard peripherals like keyboards, mice, and joysticks to communicate with hosts using predefined protocols without requiring custom drivers. The USB HID specification defines the necessary descriptors and endpoints to facilitate this plug-and-play functionality, ensuring compatibility across operating systems that support the USB core specification.[1]
Endpoint setup in HID over USB relies on the default control endpoint 0 (EP0) for class-specific requests, such as Get_Report and Set_Report, which handle configuration and polled data exchanges. Asynchronous input reports, like keystrokes or mouse movements, are transmitted via a required interrupt IN endpoint, while output reports, such as LED controls on keyboards, use an optional interrupt OUT endpoint. These interrupt endpoints support a maximum packet size of 64 bytes at full-speed and high-speed USB, with low-speed limited to 8 bytes, allowing efficient low-latency data transfer without bulk or isochronous modes.[1]
The HID class incorporates specific USB descriptors to describe device capabilities. The HID Descriptor, with bDescriptorType set to 0x21 and a variable bLength indicating its total size, immediately follows the interface descriptor and specifies the HID version, the number of subordinate descriptors, and their types. It points to the Report Descriptor (bDescriptorType 0x22), which defines the structure of input, output, and feature reports, and optionally to the Physical Descriptor (bDescriptorType 0x23) for grouping controls by physical location. These descriptors are retrieved by the host during enumeration to parse the device's report formats.[1]
Power management for HID over USB devices distinguishes between low-power and high-power configurations to optimize bus resource allocation. Low-power devices draw no more than 100 mA from the bus and must enter a suspend state when idle, reducing consumption to 2.5 mA or less, with resume signaling to restore operation. High-power devices, exceeding 100 mA, require explicit host negotiation via the Set Configuration request to access up to 500 mA on a 5V bus, ensuring they do not overload shared power domains.[1]
The Boot Interface Subclass (subclass code 1) provides a simplified, fixed descriptor set for legacy BIOS and firmware compatibility, bypassing complex report parsing. For keyboards (protocol code 1), it uses a standardized 8-byte report format: the first byte for modifier keys (e.g., Shift, Ctrl), the second reserved, and the remaining six for keycodes, enabling basic input without full HID interpretation. Mouse support (protocol code 2) follows a similar fixed 3- to 5-byte format for button states and relative movements.[1]
Compliance testing for HID over USB devices is enforced through USB Implementers Forum (USB-IF) tools, which validate descriptor integrity, endpoint behavior, and adherence to class requirements during certification. Tools like the HID Descriptor Tool analyze report structures for errors, ensuring devices pass interoperability tests before market release.[1]
HID over Bluetooth
The Human Interface Device (HID) Profile 1.0, adopted by the Bluetooth Special Interest Group (SIG) on May 22, 2003, defines the protocols and procedures for HID devices to communicate over Bluetooth Basic Rate/Enhanced Data Rate (BR/EDR).[9] This profile enables wireless operation of input devices such as keyboards and mice by mapping HID functionality onto Bluetooth's transport layers, supporting discovery, connection, and data exchange while maintaining compatibility with USB HID class drivers.[9]
The profile utilizes the Logical Link Control and Adaptation Protocol (L2CAP) to establish two dedicated channels: an interrupt channel (PSM 0x0013) for low-latency input and output reports, and a control channel (PSM 0x0011) for feature reports and commands.[9] Service Discovery Protocol (SDP) is employed for initial service discovery, with mandatory SDP servers on devices providing attributes like HIDDescriptorList for report descriptors and HIDProfileVersion (0x0100).[9] The connection process begins with host-initiated paging, followed by pairing using a PIN (e.g., "0000" for boot devices) or Simple Secure Pairing (SSP) for authentication and encryption, particularly mandatory for keyboards.[9] To support legacy USB HID interoperability, the profile introduces virtual cables, enforcing a one-to-one host-device association and enabling automatic reconnection via attributes like HIDReconnectInitiate.[9]
Compared to HID over USB, the Bluetooth adaptation allows larger report sizes up to 512 bytes per attribute value, accommodating more complex data payloads beyond USB's typical 64-byte interrupt limits, while core HID report handling remains consistent.[15] Battery reporting is supported through optional HID protocol messages and the HIDBatteryPower SDP attribute, providing power level indications.[9]
Subsequent updates introduced HID over GATT (HoG) in the HID over GATT Profile 1.0, adopted by the Bluetooth SIG on December 27, 2011, optimized for Bluetooth Low Energy (BLE) in versions 4.0 and later.[16] HoG replaces L2CAP channels with the Generic Attribute Profile (GATT) for efficient, low-power operation, defining HID services with characteristics for reports, protocols, and boot modes suitable for wearables and sensors.[16] It extends battery reporting via dedicated GATT characteristics, enhancing power management in energy-constrained devices, and maintains backward compatibility with classic HID through hybrid implementations in Bluetooth 4.2 (2014) and beyond.[16]
Other Protocols and Extensions
HID over I2C, specified by Microsoft in version 1.0 of the protocol in 2012, adapts the HID framework for use on the I2C bus, primarily targeting low-power embedded systems such as touchscreens, touchpads, and keyboards integrated into laptops and tablets.[17] This approach replaces USB-specific descriptors with I2C-compatible addressing and command structures, allowing devices to enumerate HID reports directly over the two-wire I2C interface without requiring a full USB stack, which reduces complexity and power consumption in resource-constrained environments.[18] Support for HID over I2C has been integrated into operating systems like Windows 8 and later, enabling seamless driver compatibility for I2C-attached input peripherals.[18]
HID over SPI, specified by Microsoft in version 1.0 of the protocol on July 15, 2024, extends the HID framework to the Serial Peripheral Interface (SPI) bus for embedded applications requiring higher-speed communication than I2C, such as sensors and displays in mobile devices.[19] It defines SPI-specific framing and command protocols to transport HID reports, maintaining compatibility with existing HID drivers while optimizing for low-latency, point-to-point connections in power-sensitive systems.[20]
Experimental implementations of HID over Wi-Fi using UDP have been explored for network-connected devices, particularly in scenarios requiring low-latency remote control, such as IP-based input peripherals for smart home systems or virtualized environments.[21] These approaches encapsulate HID report data within UDP packets transmitted over IP networks, bypassing traditional wired transports to enable wireless, distributed human interface functionality, though they remain non-standard and are typically limited to custom or proof-of-concept applications due to challenges in reliability and security.[21]
Extensions to the core HID protocol include the HID Power usage tables, defined by the USB Implementers Forum (USB-IF) to support power management features such as reporting battery status, charging levels, and power source information from devices like wireless mice or keyboards. Similarly, HID Audio usages within the HID framework allow for simple audio-related controls on sound devices, such as volume adjustment, mute toggles, and playback status indicators, integrated as part of the broader HID report descriptors rather than relying on the separate USB Audio Class for full streaming.[22]
Looking to future directions, post-2020 specifications for USB4 and Thunderbolt integrate HID support through enhanced tunneling mechanisms, enabling higher-speed data transfer for HID devices—up to 40 Gbps bidirectional—while maintaining backward compatibility with legacy USB HID implementations over these advanced connectors.[23] This evolution facilitates more bandwidth-intensive HID applications, such as high-resolution multitouch surfaces or haptic feedback systems, within unified cable ecosystems.[24]
Applications and Challenges
Common Devices and Use Cases
Human interface devices (HID) encompass a variety of standard peripherals that facilitate user interaction with computing systems, primarily through predefined usage pages in the HID specification. Keyboards, for instance, utilize Usage Page 0x07 (Keyboard/Keypad) to report key presses, supporting standard layouts such as the 101- or 104-key configurations including alphanumeric characters, modifiers like Left Control, and function keys, enabling text input and command execution across operating systems.[12] Mice, classified under Usage Page 0x01 (Generic Desktop Controls) with Usage 0x02 (Mouse), provide relative or absolute positioning via X and Y axes, along with button states and wheel movements, allowing precise cursor control in graphical user interfaces.[12]
Game controllers, such as joysticks, operate within Usage Page 0x01 with Usage 0x04 (Joystick), supporting multi-axis inputs including X, Y, Z, and rotational axes, as well as multiple buttons and hat switches for immersive control in gaming and simulation environments.[12] These devices enable complex interactions like directional movement and action triggers, often integrating additional features such as player selectors to distinguish multi-user setups.[12]
Touchscreens and digitizers fall under Usage Page 0x0D (Digitizers), with specific support for touch screens (Usage 0x04) and touch pads (Usage 0x05), facilitating direct manipulation of on-screen elements through coordinate reporting.[12] Multitouch protocols, defined in the HID Usage Tables under multi-touch digitizer usages, allow reporting of multiple simultaneous contacts using elements like Contact Identifier, Contact Count, and Contact Count Maximum, enabling gestures such as pinch-to-zoom on modern devices.[12]
In practical applications, HID devices support operating system-level input stacking, where multiple devices contribute to unified input processing; for example, the Windows Raw Input API enables applications to receive unprocessed data directly from HID sources like keyboards and mice, bypassing default system translations for low-latency handling in games or specialized software.[25] Accessibility devices, including Braille displays standardized under HID protocols, integrate seamlessly with screen readers by reporting tactile outputs and inputs via dedicated usages, promoting inclusive computing for visually impaired users.[26] These implementations highlight HID's role in diverse scenarios, from everyday productivity to specialized assistive technologies.
Limitations and Security Issues
One key limitation of the USB HID protocol is the fixed maximum report size of 64 bytes for full-speed devices, which can lead to inefficiencies for high-resolution input devices such as advanced touchscreens or precision pointing devices that require transmitting larger datasets per update.[27] This constraint often necessitates splitting data across multiple reports or reducing polling rates, potentially impacting responsiveness in bandwidth-intensive scenarios.[27]
The HID specification provides no native support for audio or video streaming, as it is designed primarily for low-latency control and data input from devices like keyboards and mice; audio functionality falls under the separate USB Audio Device Class, while video is handled by the USB Video Class.[27]
Compatibility challenges arise from the boot protocol, which restricts devices to predefined, simplified report formats—such as 8-byte keyboards or 3-byte mice—for compatibility with legacy BIOS and UEFI systems, limiting the capabilities of complex devices like multi-function game controllers that rely on extended report structures.[27] Additionally, support for custom usages defined in HID Usage Tables varies across operating systems; while Windows and macOS offer robust built-in handling for standard and many custom usages, Linux distributions may require kernel modules or userspace drivers for full compatibility, leading to inconsistent behavior.[28][29]
Security vulnerabilities in HID implementations stem from the protocol's design, which includes no built-in authentication mechanism, allowing any connected HID device to be trusted immediately by the host without verification.[27] The original USB HID specification also lacks encryption for data transmission, exposing inputs to interception in untrusted environments.[27] A prominent example is the BadUSB attack, demonstrated in 2014 by researchers Karsten Nohl and Jakob Lell, where malicious firmware reprograms a USB device to emulate an HID keyboard and inject unauthorized keystrokes, potentially executing commands or installing malware.[30] Similarly, devices like the USB Rubber Ducky exploit this by rapidly simulating keyboard inputs to deliver payloads, bypassing traditional antivirus detection.[31]
For Bluetooth HID, implementations prior to version 4.2 are susceptible to pairing hijacking attacks, such as man-in-the-middle exploits during legacy pairing processes that lack strong cryptographic protections, enabling unauthorized devices to intercept or spoof connections.[32]
On the host side, modern operating systems like Windows incorporate protections through Microsoft Defender for Endpoint's device control policies, which allow blocking unauthorized USB devices and restricting HID emulation starting from Windows 10 version 2004 (2020), combined with Group Policy settings to disable automatic driver installation for non-essential ports.[33][34]