![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Device-tree binding and DM registration: Input device model (DM).
| Topic | Page |
|---|---|
| Userspace API | Input userspace API (UAPI) |
| Touch class bridge | Input touch bridge |
| Power / restart keys | Input power keys |
Header: drivers/input.h. Typical stack: low-level driver → **rt_input_event / reporters** → handlers (GUI, shell) or **/dev/inputN** (Input userspace API (UAPI)).
| Path | API |
|---|---|
| In-kernel listener | **rt_input_add_handler** |
| POSIX process (Smart) | **open / read / ioctl / poll on /dev/inputN** — Input userspace API (UAPI) |
| Legacy touch GUI | **struct rt_touch_device** — Input touch bridge |
Use **rt_input_*** when… | Consider raw **rt_device** read when… |
|---|---|
You want Linux-like EV_KEY / EV_REL / EV_ABS / multitouch slot semantics and multiple listeners. | You have a single proprietary app talking to a vendor IOCTL-only touch stack. |
You need polling (**rt_input_setup_polling**) for GPIO keys without IRQ storms. | GPIO IRQ latency is fine and you do not need unified event routing. |
rt_input_set_capability** before **rt_input_device_register** so users know which **type/code** pairs are valid.rt_input_report_*** then **rt_input_sync** to close the frame (**SYN_REPORT**). Missing **sync** merges events poorly for consumers.rt_input_trigger** routes through optional **idev->trigger**—use when you wrap another input device; otherwise **rt_input_event** is enough.rt_input_add_handler → callback**: invoked from **rt_input_event** path—assume thread or workqueue unless your driver documents IRQ delivery; keep **callback short**.poller->poll**: runs on timer tick—**must not block** or take mutexes that can deadlock with the same thread calling **rt_input_sync**.rt_input_setup_touch** / **rt_input_report_touch_*** require **RT_INPUT_TOUCHSCREEN** — Input touch bridge.rt_input_device_register**: registers underlying **rt_device**; failures leave partially init state—clean up partial setup in error paths.rt_input_remove_config**: tears down polling/touch dynamic config before unregister if you toggled features at runtime.rt_input_set_absinfo: consumers cannot clamp—set min/max/resolution for axes you report.components/drivers/include/drivers/input.hcomponents/drivers/include/drivers/input_uapi.hdt-bindings/input/event-codes.h