|
RADLib
RADical C++ application framework
|
RADInput discovers Linux evdev devices from /dev/input and /sys/class/input. RADInput::InputManager can read raw input events on a background thread and emit them through RADCore events, optionally posted back to a target RADCore::EventLoop.
InputManager derives from RADCore::RADObject and is constructed with an optional InputPaths and an optional target RADCore::EventLoop*. InputManager::discover() returns InputDeviceInfo records (path, name, sysfsPath) for the event nodes it finds. InputManager::startDevice() begins reading a single evdev node on a background reader thread, while startHotplugMonitor() / stopHotplugMonitor() run a lightweight polling loop that re-scans devices at a configurable interval. stopAll() stops every active reader, and isRunning() reports whether any reader is live.
Events are delivered through the RAD_EVENT signals eventReceived, which carries a RADInput::InputEvent (device path, timestamp, Linux type, code, and value), and devicesChanged, which carries the updated device list when hotplug detection sees a change. When an EventLoop is supplied, emissions are posted back onto that loop's thread.
Use RADInput::Calibration to map raw touch/pointer coordinates into display-space coordinates. Its map() method applies the configured input and output ranges plus the invertX / invertY flags. Tests and embedded products can pass InputPaths to point the API at a fixture tree or alternate device root.
Core features:
/dev/input and /sys/class/input.devicesChanged.InputPaths for fixtures and embedded roots.Example: