Multitouch 触控与手写设备

Multitouch 触控与手写设备

1. HID multitouch

hid-multitouch.c 处理符合或接近 HID Digitizers 规范的触摸屏/触控板。它不是传输驱动,可绑定 USB HID 或 I2C HID。

2. 核心 Usage

  • Contact ID;
  • Tip Switch;
  • In Range;
  • Confidence;
  • X/Y;
  • Contact Count/Maximum;
  • Width/Height;
  • Pressure;
  • Scan Time;
  • Button。

设备常因 descriptor 不规范需要 class/VID/PID quirk。

3. Slot 模型

1
2
3
4
5
6
7
HID report contacts
-> raw_event / event
-> map Contact ID to MT slot
-> input_mt_slot()
-> input_mt_report_slot_state()
-> report ABS_MT_*
-> input_mt_sync_frame()

Protocol B 使用稳定 slot,减少 userspace 自行追踪 contact。

4. 触摸屏与触控板

类型 特点
Direct touchscreen 坐标直接对应显示,INPUT_PROP_DIRECT
Indirect touchpad 指针手势,INPUT_PROP_POINTER
Hybrid 需 class/quirk 决定

错误分类会导致 libinput 使用错误策略。

5. Feature 初始化

multitouch probe 可能读取/设置:

  • input mode;
  • contact maximum;
  • latency mode;
  • button type。

某些设备不支持 GET_REPORT,需 HID_QUIRK_NOGET 或专用 quirk,避免 probe 卡住。

6. 专用手写板

驱动 特点
Wacom wacom_wac.c/wacom_sys.c pen/touch、工具 ID、pressure、battery/LED
hid-uclogic-* 修复大量国产数位板 descriptor
hid-waltop.c Waltop tablets
hid-ntrig.c N-Trig digitizer
hid-rmi.c Synaptics RMI over HID

专用驱动可能同时生成 pen、pad、touch 多个 input device。

7. 坐标

关键校验:

  • logical max 是否匹配面板分辨率;
  • physical max/unit 是否合理;
  • X/Y 是否交换/反向;
  • pressure 范围;
  • contact ID 稳定性;
  • report rate;
  • 显示旋转由 DRM/input userspace 或 DT 属性协调。

8. RK3588

rockchip_linux_defconfig 显式启用 HID_MULTITOUCHI2C_HID_OF,适合 I2C HID 触控屏。是否绑定 hid-multitouch 取决于 descriptor group 和设备 ID,并非所有 I2C 触摸控制器都使用 HID;大量芯片仍使用 drivers/input/touchscreen/ 专用驱动。

9. 调试

1
2
3
4
5
libinput list-devices
libinput debug-events
evtest
cat /sys/class/input/eventX/device/name
cat /sys/bus/hid/devices/*/report_descriptor > rdesc.bin

检查 raw report 正常但 evdev 异常时,重点看 descriptor、multitouch class 和 input mapping。

文章互动

阅读 --

留言

0 条留言

正在加载留言…