Products › lamco-dsi-tools › Interfaces › Kernel uinput

uinput: Injecting input through /dev/uinput on a Wayland desktop

uinput (/dev/uinput) is the Linux kernel's way to create virtual input devices: How it works under Wayland, the rights it needs, and how to check it.

Linux kernel /dev/uinput

uinput is the Linux kernel interface, opened as /dev/uinput, through which a program creates a virtual input device and writes key, pointer and touch events into it as if they came from hardware. Automation tools, remapping daemons, game controller drivers and some remote desktop servers use it, because it works below the display server and so on any desktop, Wayland or X11. lamco-dsi-tools (DSI: Desktop session interfaces) reads the node's owner and mode without opening it, says whether the user may write it, and sends input through it with a small helper that's the only program of the toolkit that opens it.

What it is

A program opens /dev/uinput for writing, declares with ioctls which event types and codes its device will send (keys, relative axes, absolute axes), sets up the device's name and identity with UI_DEV_SETUP and each absolute axis with UI_ABS_SETUP, and creates it with UI_DEV_CREATE. The kernel then shows a new evdev device under /dev/input/, and the compositor's input stack picks it up like a keyboard or mouse that was just plugged in. The program writes struct input_event records, each group ended by SYN_REPORT, and removes the device with UI_DEV_DESTROY or by closing the file.

Three things follow from working at that level. There's no dialog and no session: Events written to a uinput device reach every program that reads input devices, whichever session the writer started from. The keys are kernel key codes, and what they type is decided by the compositor's active keyboard layout. And the right to do it is the kernel's to grant: Opening the node needs write permission on it, which on most systems a normal user doesn't have, so a program gets it as root, through a group, or through a udev rule or access control list the administrator set up.

So the first question with uinput is permission, and a capture answers it before anything tries: Whether the node is there, and whether its mode bits let this user write it. A device for touch is a touchscreen in the kernel's multitouch protocol B, with slots and tracking ids. The wlroots virtual input protocols send no touch at all.

Which desktops offered it

DesktopState
GNOME Shell 48.7 (Debian 13)present
GNOME Shell 51.0 (Fedora 45)present
KDE Plasma, KWin 6.5.6 (NixOS)present
KDE Plasma, KWin 6.8.2 (KDE neon)present
Sway 1.9present
Hyprland 0.56.2present
COSMIC, cosmic-comp 1.0.0present
labwc 0.20.3 (Budgie session, CachyOS)present
Cinnamon Wayland session (Linux Mint)present

The row is present everywhere and raised INPUT-008 everywhere: The node existed on every machine, and the capturing user couldn't open it without more rights. That's how Linux is normally set up, and the row says nothing about the desktop. The captures were taken on 2026-11-27 and 2026-11-28 with dsisee observe, one version of each desktop on one virtual machine.

The README's run record: On Sway 1.9, kernel inject was refused without rights, and with rights against the witness it paired 10 of 10 steps. A touch through the kernel route on 2026-11-28: On Sway 1.9 a tap (2 of 2 steps) and a drag (22 of 22) were delivered. On GNOME Shell 48.7 the drag was delivered, 22 of 22, and the tap wasn't; that day's build reported it as 2 of 2 because its pairing took the drag's events.

The project's record of runs, reconciled on 2026-12-04, adds:

  • Touch through the kernel route, again, on GNOME Shell 48.7 and KWin 6.8.2 on 2026-11-29: A tap and a drag delivered on each. On GNOME the witness recorded two touch downs and two touch ups, the tap's and the drag's.
  • The cursor as metadata on the portal route, on KWin 6.8.2 on 2026-11-29: Eight pointer moves through the kernel route showed as a change of position in exactly eight buffers of the screen cast.
  • The full build for 64-bit ARM, on GNOME Shell 48.7 on an emulated aarch64 machine on 2026-12-04: A closed loop on the kernel route, dsido kernel inject text hello with --elevate-with sudo, a fullscreen dsisee input witness and dsitell loop, which paired 10 of 10 keys.

How to check it with lamco-dsi-tools

dsisee input routes                  # the uinput node, its owner and mode, and what each route has for touch
dsisee observe --out capture.json    # the node and every input device the kernel lists
dsitell health capture.json          # the input function, with INPUT-008 when this user may not write the node

The kernel-input dissector reads /dev/uinput with stat and never opens it. It records whether the node exists, its owner and mode, who the instrument runs as, and each device in /proc/bus/input/devices with whether it's virtual. dsitell health works out from the mode bits whether that user may write the node, and says that an access control list wasn't read. The route can't stand in for libei or the wlroots protocols in INPUT-001: It's on nearly every machine and needs rights the session's user lacks.

Driving it with dsido

dsisee input witness --duration 60 --out witness.json &                  # a window that records what reaches it
dsido kernel inject text "hello" --elevate-with sudo --out inject.json   # type through a uinput device
dsido kernel inject touch drag --at 300,300 --to 900,300 --out drag.json # one finger, on a touchscreen device
dsitell loop inject.json witness.json                                    # pair each step with its event

dsido opens nothing itself. It starts the helper dsido-uinput, kept in the directory dsido is in, and hands it the steps. The helper reports who it runs as and the node's owner and mode, then tries the open, and a refusal is recorded as refused with those facts. It changes no permission, loads no kernel module, asks for no password, and refuses to run set-user-ID. --elevate-with names the program that starts it with more rights, such as sudo. Each run creates one device named dsido virtual input with only what the steps need, and removes it afterwards.

Findings

  • INPUT-008: The uinput node is there and this user may not open it.
  • INPUT-006: An injection route refused the injector.
  • INPUT-005: Input couldn't be injected through a route.
  • INPUT-001: No input route was found, which the uinput node doesn't change.

Related