Input Subsystem - Userspace Integration¶
This note describes how input events generated by kernel drivers are consumed and interpreted in userspace.
End-to-End Data Flow¶
Hardware (GPIO button)
↓
Kernel Driver (input_report_key)
↓
Input Core
↓
evdev (/dev/input/eventX)
↓
Userspace (udev / libinput / application)
Input Event vs Behavior¶
👉 Important:
Event Model Recap¶
Userspace Layers¶
1. evdev¶
- Interface:
/dev/input/eventX - Raw event stream
- Used by tools and applications
Example:
2. udev¶
- Detects device type
- Adds properties
Example:
Typical output:
3. libinput / GUI stack¶
- Used by Wayland / X11
- Maps input events to UI actions
4. Application¶
- Custom logic defined by user
Example:
Mechanism vs Policy¶
Linux design principle:
Example: GPIO Button Application¶
Kernel driver:
Userspace application:
Why Behavior Is Not in Kernel¶
Reasons:
- Different applications need different behavior
- Avoid hardcoding policy in kernel
- Improve flexibility and reusability
Input vs IIO vs Char Driver¶
| Model | Kernel Role | Userspace Role |
|---|---|---|
| Char Driver | everything | minimal |
| IIO | data provider | decode |
| Input | event provider | interpret |