aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Thébault <quentin.thebault@defenso.fr>2026-06-14 16:34:51 +0000
committerKyle Evans <kevans@FreeBSD.org>2026-08-06 23:51:31 +0000
commite73fcd4c3205b61e82548aff1ba3b645ed74e5b7 (patch)
tree605aeca8d7c3c2b9fbc59a10a89d709d8bef8b6a
parent01e37e47d240db81c7daf1388c7f949ff1c78db6 (diff)
evdev: add devnum sysctl
Add a sysctl entry for the evdev device number (devnum) to allow libudev-devd to populate the corresponding device information fields (MAJOR and MINOR) when running in a jail with no input devices exposed through devfs. Signed-off-by: Quentin Thébault <quentin.thebault@defenso.fr> Reviewed by: wulf Sponsored by: Defenso (cherry picked from commit 746c374aa94b46712e6defb3ab56dd2d6ad8db64)
-rw-r--r--sys/dev/evdev/evdev.c6
-rw-r--r--sys/dev/evdev/evdev_private.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c
index aee482518617..9249d88aa548 100644
--- a/sys/dev/evdev/evdev.c
+++ b/sys/dev/evdev/evdev.c
@@ -276,6 +276,11 @@ evdev_sysctl_create(struct evdev_dev *evdev)
SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "sw_bits", CTLFLAG_RD,
evdev->ev_sw_flags, sizeof(evdev->ev_sw_flags), "",
"Input device supported switch events");
+
+ SYSCTL_ADD_U64(&evdev->ev_sysctl_ctx,
+ SYSCTL_CHILDREN(ev_sysctl_tree), OID_AUTO, "devnum", CTLFLAG_RD,
+ &evdev->ev_devnum, 0,
+ "Input device number");
}
static int
@@ -321,6 +326,7 @@ evdev_register_common(struct evdev_dev *evdev)
ret = evdev_cdev_create(evdev);
if (ret != 0)
goto bail_out;
+ evdev->ev_devnum = dev2udev(evdev->ev_cdev);
/* Create sysctls (for device enumeration without /dev/input access rights) */
evdev_sysctl_create(evdev);
diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h
index 661259bd2594..376f90ea0b6d 100644
--- a/sys/dev/evdev/evdev_private.h
+++ b/sys/dev/evdev/evdev_private.h
@@ -111,6 +111,7 @@ struct evdev_dev
char ev_shortname[NAMELEN];
char ev_serial[NAMELEN];
struct cdev * ev_cdev;
+ dev_t ev_devnum;
int ev_unit;
enum evdev_lock_type ev_lock_type;
struct mtx * ev_state_lock; /* State lock */