본문 바로가기

MCU

Bluetooth: HID # Boot mode # Report mode

728x90
반응형

HID (Human Interface Device Profile)

  - Bluetooth Classic, BLE 모두 사용 가능

  - Bluetooth Classic에서부터 도입되었지만, BLE와 사용성이 잘 맞아서 HoG 라는 표현도 있음

    (HID on GATT *GATT는 BLE에서만 사용되는 Profile)

  - 사람이 직접 input 입력에 사용하는 장치들에 쓰이는 Profile (마우스, 키보드, 게임 컨트롤러, 리모컨 등)

 

 

Report mode & Boot mode 

  Report mode

  - 데이터를 유연하게 형식을 정해서 전송 가능한 모드

  - 유연성이 있으나 그만큼 속도 등에서는 조금 떨어질 수 있다.

 

  Boot mode

  - input 데이터를 매우 정형화하여 보내도록 강제

  - 전송 데이터 타입을 강제하는 만큼 그 속도에서는 강점을 보인다.

  - 특히 일반적인 장치들과 매우 호환성이 높기 때문에, BIOS 등에서도 키보드의 입력 등이 작동 되도록

    Boot mode를 사용하는 것이 권장되는 환경이 있음

    (ESP32의 예제 코드에서는 Boot mode를 마우스, 키보드에서만 사용하라고 주석으로 설명되어 있는 부분이 있음)

 

-------------------------- Chat GPT --------------------------

 

The Human Interface Device (HID) profile is a part of the Bluetooth specification that enables Bluetooth devices to function as input devices in a universal and standardized manner. This includes devices like keyboards, mice, game controllers, and other pointing devices. The HID profile is designed to provide a low-latency link with relatively low power consumption, making it ideal for wireless peripherals.

Key Features of the HID Profile

  • Interoperability: One of the primary advantages of the HID profile is its support for a wide range of devices across different platforms and operating systems. Devices that adhere to the HID profile can typically connect to most computers, tablets, and smartphones without needing proprietary drivers.
  • Low Latency: For devices like keyboards and mice, responsiveness is crucial. The HID profile is optimized for low-latency communication, ensuring that input is registered quickly and accurately on the host device.
  • Low Power Consumption: Many HID devices, such as wireless keyboards and mice, are battery-powered. The HID profile is designed to minimize power consumption, extending the battery life of these devices.
  • Versatility: The HID profile supports a wide range of human input devices, not just keyboards and mice. It includes support for joysticks, gamepads, and even more specialized devices like barcode scanners.

How HID Works

The HID profile operates over the Bluetooth protocol stack. It uses the Generic Attribute Profile (GATT) in Bluetooth Low Energy (BLE) and the L2CAP (Logical Link Control and Adaptation Protocol) in Bluetooth Classic to transport data between devices. This enables it to leverage the inherent advantages of Bluetooth technology, such as wireless connectivity and broad compatibility.

HID and Other Bluetooth Profiles

While the HID profile is specifically tailored for human input devices, other Bluetooth profiles handle different types of device interactions:

  • GAP (Generic Access Profile): Provides the foundation for all other Bluetooth profiles, managing device discovery, connection, and security procedures.
  • SSP (Simple Secure Pairing): A feature introduced in Bluetooth 2.1, SSP simplifies the pairing process and enhances security.

Use Cases

Common use cases for the HID profile include:

  • Wireless Keyboards and Mice: Perhaps the most common application, allowing for cable-free desks.
  • Game Controllers: Enabling wireless gaming on computers, consoles, and mobile devices.
  • Remote Controls: For media centers, TVs, and smart home devices, providing a way to control devices without direct physical interaction.

Conclusion

The HID profile is a critical part of the Bluetooth ecosystem, providing standardized support for a wide range of input devices. By leveraging Bluetooth technology, the HID profile ensures that devices are easily connectable, offer low latency, and consume minimal power. This makes it an ideal wireless solution for a multitude of human interface devices.

 
 
Q
Low Latency: For devices like keyboards and mice, responsiveness is crucial. The HID profile is optimized for low-latency communication, ensuring that input is registered quickly and accurately on the host device. You told like that. In ESP32 with HID, I saw that there are report_mode and boot_mode about HID, and boot_mode only can be used in mice and keyboards. is that related with low latency?
 
ChatGPT

Yes, the distinction between report mode and boot mode in the context of HID devices, such as those implemented on the ESP32, is indeed relevant to considerations of device functionality and, indirectly, to latency and compatibility, especially for keyboards and mice.

Boot Mode vs. Report Mode

  • Boot Mode: This is a simplified mode of operation defined by the USB HID specification, which Bluetooth HID profiles also adopt for compatibility. Boot mode is designed to ensure that basic keyboard and mouse functionalities are available immediately upon device startup, even before specific drivers or configurations are loaded. This mode supports a limited set of features—just enough to provide basic input functionality. For keyboards and mice, this means a standard set of keys or mouse movements/buttons are supported. Because of its simplicity and standardized nature, boot mode can offer lower complexity, which can translate into quick, responsive interactions suitable for the basic input tasks these devices perform.
  • Report Mode: This mode provides a more complex and customizable way of describing the device's capabilities and the data it sends. Report mode allows for a richer set of features beyond what boot mode supports, enabling devices to report a wider array of inputs and to be more specifically tailored to the needs of the application or the preferences of the user. In report mode, a device can define its own data packets (reports) to include various buttons, dials, and other controls not covered by the boot mode's standard set.

Latency Considerations

While the choice between boot mode and report mode might not directly dictate the latency of a device, it influences the complexity of the interaction between the device and the host. Generally, a simpler interaction model, as seen in boot mode, can be processed more quickly by the host, potentially reducing the time between input and response. However, modern systems and efficient implementations of report mode can also achieve low-latency communication, especially when the additional functionality of report mode is required.

Why Boot Mode Is Important

  • Compatibility: Boot mode ensures basic compatibility across different systems, allowing keyboards and mice to be used even in environments with limited driver support (like BIOS settings on a PC).
  • Quick Setup: Devices in boot mode are immediately usable without the need for custom configurations, making them ideal for scenarios where basic input functionality is needed right away.

Conclusion

In the context of the ESP32 and other devices implementing the HID profile, boot mode and report mode offer different levels of complexity and feature support for connected devices. While boot mode is particularly noted for keyboards and mice due to its compatibility and simplicity, which can contribute to a perception of lower latency for basic tasks, both modes are important for accommodating a wide range of user needs and device functionalities. The choice between them depends on the specific requirements of the application, including desired features and compatibility considerations.

 

 

 
Q
Can HID only be used in BLE? not Bluetooth Classic?
 
ChatGPT

The Human Interface Device (HID) profile can be used with both Bluetooth Low Energy (BLE) and Bluetooth Classic. It's a versatile profile designed to enable wireless communication between devices like keyboards, mice, game controllers, and other input devices with computers or smartphones. The implementation of HID over Bluetooth Classic and BLE, however, serves different needs and has different characteristics.

HID on Bluetooth Classic

  • Bluetooth Classic HID: Originally, the HID profile was defined for Bluetooth Classic. It's widely used for devices that require continuous data transmission with minimal latency, such as keyboards, mice, and game controllers. Bluetooth Classic provides higher data rates compared to BLE, making it suitable for devices that need to send frequent updates to the host device.
  • Usage: Most traditional wireless keyboards and mice utilize the HID profile over Bluetooth Classic due to its robustness and higher throughput, which is ideal for real-time input devices.

HID on Bluetooth Low Energy (BLE)

  • BLE HID (HID over GATT): With the advent of Bluetooth 4.0 and the introduction of Bluetooth Low Energy, the HID profile was adapted to work over BLE as HID over GATT (HoG). This adaptation allows HID devices to benefit from the low power consumption of BLE, making it ideal for battery-powered input devices that don't require the high data rates of Bluetooth Classic.
  • Advantages: The primary advantage of using HID over BLE is significantly lower power consumption, which extends the battery life of devices. It's particularly beneficial for devices that transmit data less frequently or can tolerate a bit more latency, such as some types of game controllers, remote controls, and smart home devices.

Choosing Between BLE and Bluetooth Classic for HID

The choice between using BLE or Bluetooth Classic for an HID device depends on the specific requirements of the device, including factors like:

  • Data Rate Requirements: Devices that need to transmit large amounts of data quickly, like high-performance gaming mice, may benefit from the higher data rates offered by Bluetooth Classic.
  • Power Consumption: For devices where conserving battery life is a priority, BLE's lower power consumption makes it the better choice.
  • Compatibility: Consideration must also be given to the types of devices the HID device needs to connect with, as some older devices may not support BLE.

In summary, HID can be used with both Bluetooth Low Energy and Bluetooth Classic, each offering distinct advantages depending on the use case. BLE provides an energy-efficient option for less data-intensive applications, while Bluetooth Classic caters to devices requiring higher data throughput and minimal latency.

 

 

 
Q
I woner that how HID and other profiles be different? What is the principle and main differences in hardware or software?
 
ChatGPT

The Human Interface Device (HID) profile is one of many profiles defined in the Bluetooth specifications to enable specific use cases and functionalities for Bluetooth-enabled devices. Each Bluetooth profile is tailored to a particular application or type of data exchange, such as audio streaming, message access, or human input device communications. The differences between HID and other profiles largely lie in their intended use cases, the types of data they handle, and how they structure the communication between devices. These distinctions manifest both in software (how the profiles are implemented in device firmware or operating system drivers) and, to some extent, in hardware (specific capabilities or features of the Bluetooth module).

HID Profile

  • Purpose: Specifically designed for human input devices like keyboards, mice, game controllers, and other pointing devices.
  • Data Types: Handles keystrokes, mouse movements, button presses, and similar input data.
  • Characteristics: Generally requires low latency to ensure responsive input, and may vary in power consumption depending on whether it uses Bluetooth Classic or BLE (Bluetooth Low Energy).

Other Bluetooth Profiles

Other Bluetooth profiles are designed for different types of data exchange or interaction between devices. Some examples include:

  • Advanced Audio Distribution Profile (A2DP): Facilitates high-quality audio streaming from an audio source (like a smartphone) to a receiver (like wireless headphones or speakers). A2DP requires higher bandwidth and typically uses Bluetooth Classic due to its higher data throughput capabilities.
  • Generic Attribute Profile (GATT): Central to BLE operations, it structures data in a hierarchy of services and characteristics for a wide range of applications beyond HID, from healthcare devices to fitness trackers.
  • Phone Book Access Profile (PBAP): Allows a car's hands-free system to access the contacts list on a connected smartphone, enabling features like caller ID and automatic contact dialing.

Hardware and Software Differences

  • Hardware: While most modern Bluetooth chips support both Bluetooth Classic and BLE, the specific use of hardware resources (like power amplifiers, antennas, and RF circuits) can vary depending on the profile's requirements. For example, devices using A2DP for high-quality audio streaming might prioritize components that ensure better signal integrity and bandwidth, while HID devices, especially those using BLE for low power consumption, might prioritize energy efficiency.
  • Software: The implementation of each profile involves specific stacks and drivers that understand and manage the data according to the profile's standards. For HID devices, this includes interpreting and transmitting input data efficiently. For audio devices using A2DP, this involves encoding, decoding, and streaming audio data.

Principle of Operation

The underlying principle of Bluetooth profiles is to standardize the communication between devices for specific applications, ensuring interoperability and a consistent user experience. Profiles define the roles devices play (e.g., source, sink, server, client), the formats of data exchanged, and the procedures for initiating, managing, and terminating communications. The hardware supports these operations by providing the necessary wireless communication capabilities, while the software implements the logic and protocols specific to each profile.

In summary, the main differences between HID and other Bluetooth profiles lie in their specific use cases, the nature of the data they handle, and the requirements for latency, bandwidth, and power consumption. These differences dictate the hardware features that are prioritized in device design and the software stack's structure and operation to support each profile's functionalities.

 
 
Q
Tell me how Boot mode and report mode are different in principle? I am wonder more detail principle
 
ChatGPT

In the context of Bluetooth Human Interface Devices (HID), such as keyboards and mice, the concepts of Boot Mode and Report Mode represent two different ways that these devices can communicate input data to a host device (like a computer or smartphone). These modes define how the data describing the device's inputs (e.g., key presses, mouse movements) is formatted and transmitted. The distinction between these modes primarily lies in their level of standardization and flexibility, impacting device compatibility and functionality.

Boot Mode

  • Principle: Boot Mode is defined in the HID specification to ensure basic interoperability with host devices without requiring any special drivers or configurations. It's named "Boot Mode" because it ensures that a keyboard or mouse can be used during the boot process of a computer, even before any specific device drivers are loaded.
  • Data Format: In Boot Mode, the data format for inputs is highly standardized. For keyboards, this typically includes a limited set of keys that correspond to the standard 101-key layout. For mice, it includes movement along the X and Y axes and a few buttons. This standardized data format allows for immediate, out-of-the-box functionality with most operating systems and BIOS configurations.
  • Limitations: The simplicity and standardization of Boot Mode come at the cost of flexibility. Devices in Boot Mode cannot take advantage of unique features or extended inputs that go beyond the predefined set of controls.

Report Mode

  • Principle: Report Mode offers a customizable way of defining HID reports, which are the data packets that describe the device's inputs. In Report Mode, a device can define its own report format, allowing for a broader range of inputs and controls beyond what is specified for Boot Mode.
  • Data Format: The device manufacturer specifies the structure of HID reports in Report Mode, which can include any number of buttons, dials, sliders, and other controls. This mode is used to fully utilize the device's capabilities, including special features not covered in Boot Mode. For example, a gaming mouse might have additional buttons for in-game actions, or a keyboard might include media control keys.
  • Flexibility and Compatibility: While Report Mode provides greater flexibility and functionality, it requires the host to understand the custom report format, which might necessitate specific drivers or software. This can potentially limit immediate compatibility with some systems but allows for a much richer user experience when fully supported.

Summary of Differences

  • Standardization: Boot Mode is highly standardized to ensure basic compatibility across all systems, while Report Mode allows for custom, device-specific input reports.
  • Functionality: Boot Mode supports a limited set of features to guarantee basic functionality, especially useful during system boot. Report Mode unlocks the device's full capabilities, enabling all custom features and controls.
  • Compatibility: Devices in Boot Mode can generally work with any system without the need for additional drivers. Devices in Report Mode may require specific software or drivers to interpret the custom reports, although many modern operating systems support a wide range of HID devices in Report Mode out of the box.

In essence, the choice between Boot Mode and Report Mode reflects a trade-off between universal compatibility and the ability to leverage advanced features and customizations offered by the device.

728x90
반응형

'MCU' 카테고리의 다른 글

usbipd: WSL2에 USB port 인식 시키기  (0) 2024.04.24
falling-edge, rising-edge  (0) 2024.04.18