From a7c50f7d73989c2d6f3a30b333b1b83d4dadfd7f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 26 Sep 2026 21:38:38 +0100 Subject: [PATCH] input-support: add a package for input device handling The evdev character devices come out 0600 root:root, so a display server or any other process reading keyboards and pointers runs as root. Add an input-support package which allocates the input group and puts the input nodes into it, and make the evdev and joydev modules depend on it. The one device profile that ships evdev lists the package directly. kmod-input-core stays ungated: it carries no device node of its own, and most drivers built on it deliver their events to in-kernel consumers such as the keyboard and button handlers. Signed-off-by: Daniel Golle --- package/kernel/linux/modules/input.mk | 4 ++-- package/system/hardware-support/Makefile | 18 ++++++++++++++++++ .../hardware-support/files/40-input.json | 6 ++++++ target/linux/ramips/image/mt76x8.mk | 3 ++- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 package/system/hardware-support/files/40-input.json diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk index 4b4a2125249..ef48c1c3c0c 100644 --- a/package/kernel/linux/modules/input.mk +++ b/package/kernel/linux/modules/input.mk @@ -104,7 +104,7 @@ $(eval $(call KernelPackage,input-core)) define KernelPackage/input-evdev SUBMENU:=$(INPUT_MODULES_MENU) TITLE:=Input event device - DEPENDS:=+kmod-input-core + DEPENDS:=input-support +kmod-input-core KCONFIG:=CONFIG_INPUT_EVDEV FILES:=$(LINUX_DIR)/drivers/input/evdev.ko AUTOLOAD:=$(call AutoLoad,60,evdev) @@ -196,7 +196,7 @@ $(eval $(call KernelPackage,input-matrix-keypad)) define KernelPackage/input-joydev SUBMENU:=$(INPUT_MODULES_MENU) TITLE:=Joystick device support - DEPENDS:=+kmod-input-core + DEPENDS:=input-support +kmod-input-core KCONFIG:=CONFIG_INPUT_JOYDEV FILES:=$(LINUX_DIR)/drivers/input/joydev.ko AUTOLOAD:=$(call AutoProbe,joydev) diff --git a/package/system/hardware-support/Makefile b/package/system/hardware-support/Makefile index 457926fdad1..392293629b0 100644 --- a/package/system/hardware-support/Makefile +++ b/package/system/hardware-support/Makefile @@ -78,6 +78,23 @@ define Package/accel-support/install $(call InstallFragment,$(1),35-accel.json) endef +define Package/input-support + $(call Package/hardware-support/Default) + TITLE:=Input device support + USERID:=:input=41 +endef + +define Package/input-support/description + Feature gate for input devices. Allocates the input group and installs + the hotplug rules which put the evdev character devices into it. Kernel + modules exposing input devices and userspace using the group depend on + this package. +endef + +define Package/input-support/install + $(call InstallFragment,$(1),40-input.json) +endef + define Build/Prepare endef @@ -90,3 +107,4 @@ endef $(eval $(call BuildPackage,audio-support)) $(eval $(call BuildPackage,video-support)) $(eval $(call BuildPackage,accel-support)) +$(eval $(call BuildPackage,input-support)) diff --git a/package/system/hardware-support/files/40-input.json b/package/system/hardware-support/files/40-input.json new file mode 100644 index 00000000000..a5cd7c82a08 --- /dev/null +++ b/package/system/hardware-support/files/40-input.json @@ -0,0 +1,6 @@ +[ + [ "if", + [ "eq", "SUBSYSTEM", "input" ], + [ "makedev", "/dev/%DEVNAME%", "0660", "input" ] + ] +] diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 4e9bd2de0c2..c5d68f159de 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -737,7 +737,8 @@ define Device/qding_qc202 IMAGE_SIZE := 7872k DEVICE_VENDOR := Qding DEVICE_MODEL := QC202 - DEVICE_PACKAGES := kmod-i2c-mt7628 kmod-gpio-beeper kmod-input-matrix-keypad kmod-input-evdev uboot-envtools + DEVICE_PACKAGES := kmod-i2c-mt7628 kmod-gpio-beeper kmod-input-matrix-keypad kmod-input-evdev \ + input-support uboot-envtools IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | qding-header qc202 endef