feat(kvm): unattended Wayland input via uinput (VA-104 part 1) #106

Merged
David merged 1 commit from fix/VA-104-drm-kms-uinput-wayland into main 2026-07-04 00:37:21 +02:00
Owner

First increment of #VA-104 (unattended Wayland desktop): the input half.

What

A /dev/uinput pointer + keyboard backend (vervain-agent-kvm/src/uinput.rs) so a root system agent injects mouse and keyboard into a Wayland session (KWin / GNOME) with no xdg-desktop-portal consent prompt - the analogue of the X11 XTEST path. The kernel presents the virtual device to libinput, so the compositor consumes its events like a physical mouse/keyboard.

  • Absolute pointer scaled from the captured display size into the device's 0..=32767 range.
  • Buttons (BTN_LEFT/RIGHT/MIDDLE/SIDE/EXTRA), wheel (REL_WHEEL/HWHEEL), and the evdev KEY_* range.
  • Windows-VK to evdev keycode map (vk_to_evdev): letters, digits, F1-F12, editing/navigation cluster, modifiers, common punctuation.
  • Reuses the proven uinput ioctl mechanics from the existing touch device (touch.rs).

The desktop input dispatch (tunnel.rs::handle_desktop_input) now prefers uinput on a Wayland session (consent-free, present in the default build), falls back to the RemoteDesktop portal only when uinput is unavailable, and keeps XTEST for X11.

Verification

just pre-commit green (fmt, clippy --deny warnings, build, tests). New unit tests cover the coordinate scaling and the keycode mapping. The device-open path is exercised in the no-/dev/uinput case (returns NotAvailable, no panic).

Not in this PR

The capture half of VA-104 - DRM/KMS scanout capture for KWin/GNOME (the black-screen fix) - is the next increment. It needs on-hardware EGL iteration (tiled/compressed scanout buffers) and lands separately. This PR makes input work unattended once capture is in place.

First increment of #VA-104 (unattended Wayland desktop): the **input** half. ## What A `/dev/uinput` pointer + keyboard backend (`vervain-agent-kvm/src/uinput.rs`) so a root system agent injects mouse and keyboard into a Wayland session (KWin / GNOME) with **no xdg-desktop-portal consent prompt** - the analogue of the X11 XTEST path. The kernel presents the virtual device to libinput, so the compositor consumes its events like a physical mouse/keyboard. - Absolute pointer scaled from the captured display size into the device's `0..=32767` range. - Buttons (`BTN_LEFT/RIGHT/MIDDLE/SIDE/EXTRA`), wheel (`REL_WHEEL/HWHEEL`), and the evdev `KEY_*` range. - Windows-VK to evdev keycode map (`vk_to_evdev`): letters, digits, F1-F12, editing/navigation cluster, modifiers, common punctuation. - Reuses the proven uinput ioctl mechanics from the existing touch device (`touch.rs`). The desktop input dispatch (`tunnel.rs::handle_desktop_input`) now prefers uinput on a Wayland session (consent-free, present in the **default** build), falls back to the RemoteDesktop portal only when uinput is unavailable, and keeps XTEST for X11. ## Verification `just pre-commit` green (fmt, clippy `--deny warnings`, build, tests). New unit tests cover the coordinate scaling and the keycode mapping. The device-open path is exercised in the no-`/dev/uinput` case (returns `NotAvailable`, no panic). ## Not in this PR The **capture** half of VA-104 - DRM/KMS scanout capture for KWin/GNOME (the black-screen fix) - is the next increment. It needs on-hardware EGL iteration (tiled/compressed scanout buffers) and lands separately. This PR makes input work unattended once capture is in place.
feat(kvm): unattended Wayland input via uinput (pointer + keyboard)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 4m28s
Create release / Create release from merged PR (pull_request) Has been skipped
e43a5d0ed9
Add a /dev/uinput pointer+keyboard backend so a root system agent injects mouse and keyboard on Wayland (KWin / GNOME) with no xdg-desktop-portal consent prompt, the analogue of the X11 XTEST path. The kernel presents the virtual device to libinput, so the compositor consumes its events like a real mouse/keyboard. Absolute pointer coordinates are scaled from the captured display size into the device's 0..=32767 range; buttons, wheel, and the evdev KEY_* range are supported, with a Windows-VK to evdev keycode map covering letters, digits, F1-F12, the editing/navigation cluster, modifiers, and common punctuation.

The desktop input dispatch now prefers uinput on a Wayland session (consent-free, works in the default build), falling back to the RemoteDesktop portal only when uinput is unavailable, and keeps XTEST for X11.

Reuses the proven uinput ioctl mechanics from the touch device. Unit-tests the coordinate scaling and the keycode mapping.

#VA-104

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
David scheduled this pull request to auto merge when all checks succeed 2026-07-04 00:36:31 +02:00
David merged commit 6059f3cdf3 into main 2026-07-04 00:37:21 +02:00
David deleted branch fix/VA-104-drm-kms-uinput-wayland 2026-07-04 00:37:22 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-agent!106
No description provided.