From 38013bbf167bb7a6c78484a790c596704aa82921 Mon Sep 17 00:00:00 2001 From: Vasilito Date: Sat, 25 Apr 2026 13:15:12 +0100 Subject: [PATCH] Wire evdevd input devices into udev-shim and enable udev in libinput MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 input chain wiring: udev-shim: when scheme:evdev is registered (by evdevd), probe for event0..event7 devices and create /dev/input/eventN nodes pointing to scheme:evdev/eventN. This bridges evdevd's evdev devices into the /dev/input namespace that libinput and compositors expect. libinput: remove -Dudev=false and add libudev-stub as a dependency. The libudev-stub recipe provides libudev.so that reads from scheme:udev (udev-shim), giving libinput a working udev enumeration path instead of stub functions that return NULL. Input chain is now: hardware → /scheme/input → evdevd → scheme:evdev → udev-shim → /dev/input/eventN → libudev-stub → libinput → KWin. --- .../system/udev-shim/source/src/scheme.rs | 36 +++++++++++++++++++ recipes/wip/libs/other/libinput/recipe.toml | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/local/recipes/system/udev-shim/source/src/scheme.rs b/local/recipes/system/udev-shim/source/src/scheme.rs index 7045841a..7d726711 100644 --- a/local/recipes/system/udev-shim/source/src/scheme.rs +++ b/local/recipes/system/udev-shim/source/src/scheme.rs @@ -126,6 +126,42 @@ impl UdevScheme { )); } + // evdevd exposes event0(event1)(mouse), event2(touchpad) via scheme:evdev. + // Probe which exist and create /dev/input/eventN nodes for libinput. + if scheme_registered("evdev") { + for n in 0..8u8 { + let name = format!("event{n}"); + if std::path::Path::new(&format!("/scheme/evdev/{name}")).exists() { + let (devpath, kind) = match n { + 0 => ( + "/devices/platform/evdev-keyboard0", + InputKind::Keyboard, + ), + 1 => ( + "/devices/platform/evdev-mouse0", + InputKind::Mouse, + ), + _ => ( + &*format!("/devices/platform/evdev-generic{n}"), + InputKind::Generic, + ), + }; + let label = match kind { + InputKind::Keyboard => "Redox Evdev Keyboard", + InputKind::Mouse => "Redox Evdev Mouse", + _ => "Redox Evdev Generic", + }; + self.devices.push(DeviceInfo::new_platform_input( + label, + devpath, + kind, + "", + "", + )); + } + } + } + self.assign_virtual_nodes(); Ok(self.devices.len()) diff --git a/recipes/wip/libs/other/libinput/recipe.toml b/recipes/wip/libs/other/libinput/recipe.toml index 4792da87..7573453d 100644 --- a/recipes/wip/libs/other/libinput/recipe.toml +++ b/recipes/wip/libs/other/libinput/recipe.toml @@ -1,4 +1,4 @@ -#TODO: needs libevdev working; udev integration is disabled so the compositor owns device discovery +#TODO: needs libevdev working; udev integration via libudev-stub (scheme:udev) [source] tar = "https://gitlab.freedesktop.org/libinput/libinput/-/archive/1.30.2/libinput-1.30.2.tar.bz2" patches = ["redox.patch"] @@ -10,9 +10,9 @@ mesonflags = [ "-Dmtdev=false", "-Ddebug-gui=false", "-Dtests=false", - "-Dudev=false", "-Ddocumentation=false", ] dependencies = [ "libevdev", + "libudev-stub", ]