Serio、Gameport、HID 与 Uinput 边界

Serio、Gameport、HID 与 Uinput 边界

1. Serio

Serio是低速串行输入端口抽象,典型 PS/2 i8042、UART keyboard/mouse:

1
2
serio port driver -> serio core -> protocol driver(atkbd/psmouse)
-> input_dev

RK3588主配置 # CONFIG_SERIO is not set,因此传统 AT keyboard/PS2 mouse路径不可用。

2. Gameport

Gameport服务老式模拟 joystick/MIDI gameport。现代 ARM板通常无此硬件,源码存在主要为跨平台兼容。

3. HID

USB HID:

1
USB -> usbhid -> HID Core -> hid-input -> input_dev

Bluetooth HIDP/HOGP也最终注册 input device。Input Core只看到统一 capability/event,不负责 HID report descriptor解析。

4. Native touchscreen vs HID touch

  • I2C芯片专用 protocol:drivers/input/touchscreen
  • HID over I2C:drivers/hid/i2c-hid
  • USB HID touch:drivers/hid/usbhid

排查 eventX时应沿 sysfs parent device判断上游。

5. Uinput

drivers/input/misc/uinput.c 允许用户态:

1
2
3
4
5
6
open /dev/uinput
-> UI_SET_EVBIT/UI_SET_KEYBIT/...
-> UI_DEV_SETUP
-> UI_DEV_CREATE
-> write input_event
-> virtual input_dev

也支持FF上传请求的双向交互。

6. 用途

  • 输入代理;
  • 测试;
  • 用户态协议驱动;
  • 远程桌面;
  • 无障碍;
  • 合成组合键。

7. 安全

拥有 /dev/uinput 写权限通常可注入键盘/鼠标,接近控制登录会话。只授权专用服务,不应加入宽泛用户组或透传给不可信容器。

8. Input与IIO sensor

加速度、光感等新 driver通常应使用 IIO,不应作为 input ABS事件。Rockchip厂商 drivers/input/sensors 是历史 Android sensor stack,接口选择需结合用户空间HAL。

9. 设备识别

1
2
udevadm info /dev/input/eventN
readlink -f /sys/class/input/eventN/device

父链出现 hid/USB/I2C/platform/MFD,可判断实际传输和驱动。

文章互动

阅读 --

留言

0 条留言

正在加载留言…