udev-dev: Enumerate evdev devices via kern.evdev.input sysctls#12
Conversation
| if (ret != 0) | ||
| return (ret); | ||
| #ifdef HAVE_SYSCTLBYNAME | ||
| ret = udev_dev_enumerate_evdev_sysctl(ue); |
There was a problem hiding this comment.
That results in duplicate entries for input/event devices. Check for /dev/input existence before falling back to sysctls
There was a problem hiding this comment.
Thanks for looking at this! My understanding of how entries are added to the udev list is that duplicates are automatically removed on insert:
Lines 53 to 71 in 0f2c177
Am I not reading that correctly?
There was a problem hiding this comment.
I do not see reasons to do extra device scan pass. Actually you may read security.jail.jailed sysctl value and do extra enumeration attempt if it is not zero.
There was a problem hiding this comment.
You're right that's enough for my use case. I added that check in 7432dbf.
bc83206 to
7432dbf
Compare
When /dev/input/ is not visible to the calling process (for example, a FreeBSD jail without the corresponding devfs ruleset), the existing scandir-based enumeration in udev_dev_enumerate() cannot discover any input devices, even though the kern.evdev.input.* sysctls remain readable and the per-device property handlers already populate from those sysctls. Add a sysctl tree-walk fallback that runs after the scandir pass when running in a jail. The walk uses CTL_SYSCTL_NEXT to discover the actual children of kern.evdev.input without a fixed upper bound, then resolves each unit's name via CTL_SYSCTL_NAME to extract the unit number for the /dev/input/eventN syspath. Devices already discovered by scandir are deduplicated by udev_list_insert. This lets libinput (and other libudev consumers) enumerate input devices in jails where the evdev sysctls are accessible but the devnodes are not. Signed-off-by: Quentin Thebault <quentin.thebault@defenso.fr> Sponsored-by: Defenso
7432dbf to
5fee3dd
Compare
|
Merged. Thank you! |
Test setup:
seatdexposed through nullfslibinputwith patch to trustseatdprovided by fd even if no device node is found: freebsd/freebsd-ports@90514b8 (under review in libinput: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1471)cagecompositor andfootterminal