蓝牙 HIDP 与其它传输边界

蓝牙 HIDP 与其它传输边界

1. HID Core 不等于 USB HID

hid_device 的 bus 可为 USB、Bluetooth、I2C、Virtual、sensor hub 等。传输层只需实现 hid_ll_driver 契约:

  • parse;
  • start/stop;
  • open/close;
  • request/raw_request;
  • output_report;
  • power/idle(可选)。

2. Bluetooth HIDP

代码主要在:

1
net/bluetooth/hidp/

而不是 drivers/hid/CONFIG_BT_HIDP 建立 Bluetooth L2CAP control/interrupt channel,将远端 descriptor 和 reports 接入 HID Core。

概念路径:

1
2
3
4
5
6
7
8
Bluetooth connection/session
-> hid_allocate_device(BUS_BLUETOOTH)
-> hid_add_device()
-> HID generic/vendor driver

L2CAP interrupt data
-> HIDP transaction decode
-> hid_input_report()

输出/Feature 通过 HIDP control channel transaction。

3. HID over GATT

BLE HID over GATT 常由 BlueZ 在用户态处理后通过 UHID 注入,内核并非所有情况下都有独立 HOGP HID transport。分析蓝牙键鼠需同时检查 BlueZ 日志和 /dev/uhid

4. Sensor Hub

  • Intel ISH:drivers/hid/intel-ish-hid/
  • AMD SFH:drivers/hid/amd-sfh-hid/
  • HID sensor 语义:hid-sensor-hub.c
  • 各传感器 consumer 多位于 IIO 等目录。

这些 x86 平台 transport 对 RK3588 通常无关,但 HID sensor usage 模型仍可复用。

5. Hyper-V/Surface

hid-hyperv.csurface-hid/ 是特定虚拟化/平台通道。源码存在不表示 ARM64 RK3588 产品启用。

6. SPI HID

drivers/hid/ 树没有一个与 I2C HID 对称的通用 spi-hid/ 构建目录。某些 SPI 触控/键盘可能:

  • 使用 input 专用驱动;
  • 使用厂商 MFD;
  • 在其它目录实现 HID transport;
  • 由用户态/UHID 代理。

不能从 HID core 推断板上 SPI 外设自动受支持。

7. 传输共同约束

  • raw_requesthid_add_device() 强制要求;
  • parse 必须提供 dev_rdesc
  • input 可以在 IRQ/软中断/线程上下文进入;
  • start/stop 与 connect/disconnect 成对;
  • open/close 有共享引用;
  • PM 必须保证 report request 与断电不竞态;
  • max report buffer 不得超过 transport 能力。

8. RK3588 Bluetooth

主配置启用 CONFIG_BT_HIDP=y。实际还依赖:

  • UART/USB Bluetooth controller;
  • firmware;
  • BlueZ;
  • pairing/security;
  • input/hid vendor driver;
  • Android Bluetooth service(如使用 Android)。

调试:

1
2
3
4
btmon
bluetoothctl info
cat /sys/bus/hid/devices/*/uevent
dmesg | grep -Ei 'bluetooth|hidp|uhid'

文章互动

阅读 --

留言

0 条留言

正在加载留言…