Find a file
Quentin Thébault 4c7f7b1e5c evdev: verify fd via cached devnum on FreeBSD
evdev_device_have_same_syspath() guards against opening the wrong
device by re-resolving the fd's st_rdev through udev and comparing
syspaths. On FreeBSD this works when the input device nodes are present
in the caller's devfs, but not inside a jail whose devfs does not expose
them: udev_device_new_from_devnum() then has nothing to resolve, and the
check rejects every fd -- even fds that a seat manager (e.g. seatd)
opened on the host and passed in.

On FreeBSD the evdev syspath (/dev/input/eventN) is determined by the
device's minor number, while the cached devnum carries both that minor
and the evdev major. Comparing the full devnum against fstat(fd).st_rdev
therefore verifies the same identity as the syspath comparison -- in
fact slightly more strongly, since it also confirms the major -- without
needing the device node to be visible to the caller. libudev-devd
populates that cached devnum from the kern.evdev.input.N.devnum sysctl,
which remains readable inside a jail.

Guard the new path with __FreeBSD__ and move the existing udev-based
lookup into the #else branch. The lookup is rewritten to return
directly on each exit instead of using a shared goto label, because the
FreeBSD branch returns before those locals are declared and would
otherwise leave them (and the label) unused on a FreeBSD build. Linux
behaviour is unchanged.

Signed-off-by: Quentin Thébault <quentin.thebault@defenso.fr>
Sponsored-by: Defenso
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1471>
2026-06-19 05:25:40 +02:00
.gitlab/issue_templates gitlab: make the bug template the default template 2023-11-23 09:53:09 +10:00
.gitlab-ci CI: rebuild to pick up newer libwacom on Fedora 43 2026-01-14 09:27:28 +10:00
completion/zsh tools: add --compress-motion-events to the man page and zsh completion 2026-03-11 14:22:40 +10:00
doc tools/record: defer file creation until events arrive in autorestart mode 2026-05-27 13:37:14 +10:00
include use FreeBSD's input.h for NetBSD and OpenBSD as well 2026-06-07 13:08:42 +00:00
plugins plugin: add an example for controlling a mouse with a tablet 2026-01-21 08:44:13 +00:00
quirks quirks: add HP haptic touchpad quirk 2026-06-12 14:46:53 +08:00
src evdev: verify fd via cached devnum on FreeBSD 2026-06-19 05:25:40 +02:00
test util: sanitize control characters in str_sanitize() 2026-06-03 21:45:28 +00:00
tools tools: sanitize device names in libinput-record YAML output 2026-06-03 21:45:28 +00:00
udev libinput-device-group: sanitize phys before printing it 2026-06-04 08:43:10 +10:00
.clang-format clang-format: add litest_with_logcapture to foreach macros 2025-08-01 04:02:56 +00:00
.clang-format-ignore Add a clang-format file for consistent code formatting 2025-07-01 16:42:44 +10:00
.clang-tidy clang-tidy: fix WarningAsErrors option to actually work 2025-08-11 15:27:35 +10:00
.clang-tidy-ignore Add a clang-tidy file 2025-04-07 08:43:36 +00:00
.dir-locals.el indentation: add .dir-locals.el for emacs 2018-02-26 18:44:00 +10:00
.editorconfig editorconfig: add settings for sym files 2024-11-04 10:31:30 +00:00
.git-blame-ignore-revs git: add git-blame-ignore-revs to ignore the clang-format commits 2025-07-02 12:43:13 +10:00
.gitignore gitignore: ignore gnuplot files 2018-05-10 16:25:40 +10:00
.gitlab-ci.yml CI: rebuild to pick up newer libwacom on Fedora 43 2026-01-14 09:27:28 +10:00
.pre-commit-config.yaml pre-commit: check for merge conflicts too 2026-05-20 11:37:00 +10:00
.triage-policies.yml triage-policies: add a bugbot hook for re-closing a bug 2025-10-13 06:21:26 +00:00
.vimdir Add .vimdir for libinput-specific settings 2015-05-25 09:17:29 +10:00
CODING_STYLE.md Drop the Signed-off-by requirement 2023-07-21 09:08:46 +10:00
CONTRIBUTING.md CONTRIBUTING: Add CONTRIBUTING.md 2024-02-28 17:07:45 +01:00
COPYING Change various references to the master branch to main 2021-04-29 01:31:03 +00:00
meson.build meson.build: explicitly convert a boolean to string 2026-03-13 12:15:21 +10:00
meson_options.txt Revert "lua: drop compatibility to 5.1 to allow for luajit" 2025-11-18 01:46:53 +00:00
README.md Change various references to the master branch to main 2021-04-29 01:31:03 +00:00
SECURITY.md Add SECURITY.md directing to confidential GitLab issues 2026-06-03 05:21:09 +00:00

libinput

libinput is a library that provides a full input stack for display servers and other applications that need to handle input devices provided by the kernel.

libinput provides device detection, event handling and abstraction to minimize the amount of custom input code the user of libinput needs to provide the common set of functionality that users expect. Input event processing includes scaling touch coordinates, generating relative pointer events from touchpads, pointer acceleration, etc.

User documentation

Documentation explaining features available in libinput is available here.

This includes the FAQ and the instructions on reporting bugs.

Source code

The source code of libinput can be found at: https://gitlab.freedesktop.org/libinput/libinput

For a list of current and past releases visit: https://www.freedesktop.org/wiki/Software/libinput/

Build instructions: https://wayland.freedesktop.org/libinput/doc/latest/building.html

Reporting Bugs

Bugs can be filed on freedesktop.org GitLab: https://gitlab.freedesktop.org/libinput/libinput/issues/

Where possible, please provide the libinput record output of the input device and/or the event sequence in question.

See https://wayland.freedesktop.org/libinput/doc/latest/reporting-bugs.html for more info.

Documentation

Examples of how to use libinput are the debugging tools in the libinput repository. Developers are encouraged to look at those tools for a real-world (yet simple) example on how to use libinput.

License

libinput is licensed under the MIT license.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: [...]

See the COPYING file for the full license information.

About

Documentation generated from git commit GIT_VERSION