Commit graph

5591 commits

Author SHA1 Message Date
Peter Hutterer
dc2c1ad181 libinput 1.29.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-08-28 19:03:37 +10:00
Peter Hutterer
bdb87fef95 quirks: add quirk for the RazerBlade162025 keyboard
Generated by tools/razer-quirks-lister.py

(cherry picked from commit bdb51593fe)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1310>
2025-08-28 13:11:56 +10:00
Alexander Bruy
2098593ea8 add quirk for TongFang GX4 (X4SP4NAL) touchpad
(cherry picked from commit d9c9e0ff25)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:35:34 +10:00
Peter Hutterer
17fa8fc155 util: print nonchanged axis with a space instead of a *
When printing tablet events always print a '*' or ' ' suffix to ensure
the alignment of the next field matches. We're using a tab to align
after each field so if the string length doesn't match, our events may
print at different tab stops.

(cherry picked from commit e45cd2bc13)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:35:06 +10:00
Peter Hutterer
cef5d5f0f1 plugin: expand the plugin name prefix to 22 chars
That's the longest name we have for our internal plugins so let's make
sure those align nicely for easier debugging.

(cherry picked from commit 537552480d)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:57 +10:00
Peter Hutterer
a3696eec91 doc/user: fixes and a TOC for the Configuration Options page
A typo fix, more links and a local TOC since we now have quite a few
options.

(cherry picked from commit 5abe051a9c)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:54 +10:00
Peter Hutterer
848a051088 doc/user: add eraser buttons to the "Configuration Options" page
(cherry picked from commit 9b58177a7e)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:48 +10:00
Nat Karmios
d850ffa73f quirks: Ignore BTN_0 for Microsoft Surface Keyboard
Signed-off-by: Nat Karmios <nat@karmios.com>
(cherry picked from commit 960df4d8b8)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:25 +10:00
Matt Turner
1f4cb5a5fe test: Accept mkdir_p("/proc/foo") might return EACCES
... as it does under Gentoo's sandbox.

Fixes: 6770131e ("util: fix a memleak in mkdir_p")
(cherry picked from commit 7f3aa8058a)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:08 +10:00
Peter Hutterer
73ed87e2bb pad: don't assert when unable to find the mode group, just discard
Instead of a hard assert if we fail to find the mode group for the given
ring/dial/strip let's just log an error and discard the event.

I'm not sure this assert can be triggered in the current code base but
if it can an error message is going to be more useful to the user than
an assert.

(cherry picked from commit 2562c24f95)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:34:00 +10:00
Adam Sampson
ad2a2799c0 evdev: remove duplicate sizeof
This looks like a copy-and-paste error. In practice it was harmless on
64-bit systems because evdev_event happens to be 64 bits long, but on
32-bit systems it would allocate too little memory.

Found by GCC 15 with _FORTIFY_SOURCE=3 on ia32.

(cherry picked from commit 47d4c563f4)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:33:57 +10:00
Peter Hutterer
c2916432e4 clang-format: add litest_with_logcapture to foreach macros
(cherry picked from commit 68dbb98f04)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:33:28 +10:00
Peter Hutterer
f80504a366 tools/replay: improve the verbose output a bit
Make sure our SYN_REPORT line is indented correctly for multi-device
replay and match the output a bit closer to the one from libinput
record.

(cherry picked from commit 59f0d8f647)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1309>
2025-08-26 12:33:11 +10:00
Peter Hutterer
936cee2242 libinput 1.29.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-31 15:26:54 +10:00
Peter Hutterer
3ca34aa88a evdev: move the SYN_REPORT 1 filtering to the touchpad backend
In commit 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")
all frames with a SYN_REPORT 1 were discarded on the assumption of those
being key repeat frames. Unfortunately the kernel uses the same sequence
to simply mark *any* injected/emulated event, regardless of the cause. Key repeat
events are merely the most numerous ones but as shown in commit
7140f13d82 ("evdev: track KEY_SYSRQ frames and pass them even as repeat frames")
Alt+PrintScreen is also an emulated event.

Issue #1165 details another case: keyboards with n-key rollover can
exceed the kernel-internal event buffer, typically 8 events for devices
without EV_REL/EV_ABS. Those events will be broken up by the kernel into
multiple frames - once nevents == buffer_size the current state is
flushed as SYN_REPORT 1 frame. Then, if any more events are pending
those are flushed as SYN_REPORT 0 frame. In the case of exactly 8
events, the second frame is never present, so we cannot easily detect if
another one is coming.

Issue #1145 only affects us in the touchpad code, the rest of the
backends seem to (so far) be fine. So let's move the discarding of
SYN_REPORT 1 to the touchpad backend and leave the rest of the code
as-is.

This effectively
Reverts: 7140f13d82 ("evdev: track KEY_SYSRQ frames and pass them even as repeat frames")
Reverts: 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")

Closes #1165

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1282>
2025-07-31 00:50:30 +00:00
Peter Hutterer
96d1954dce tools: add missing AttrIsVirtual handling for listing quirks
If a device has AttrIsVirtual set in the quirks we'd abort() when trying
to list those quirks.

Fixes: efb4b6a3be ("evdev: detect virtual devices")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1281>
2025-07-30 05:43:03 +00:00
Peter Hutterer
b8651d798c tools: add a debug-tablet-pad tool
A simple tool to check the evdev and libinput events from a tablet pad.
This is near-identical to the existing debug-tablet tool but adjusted
for tablet pad events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
74705ee94c util: add a clamp macro
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
e8d24f818b util: add two macros for clearing a line
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
4a67ddc111 utils: allow strv_join on a null string
NULL in means NULL out, as the docs says, no need for an assert here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:32 +00:00
Peter Hutterer
cfec80582e meson.build: change from config.set10() and #if to config.set() and #ifdef
config.set10 is much more convenient and nicer to read but can provide
false positive if the value is 0 and #ifdef is used instead of #if. So
let's switch everything to use #ifdef instead, that way we cannot get
false positives if the value is unset.

Closes #1162

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1277>
2025-07-28 12:04:09 +10:00
Peter Hutterer
36b2afae82 plugin: ignore high-resolution wheel events from disabled wheels
Make sure we drop any potential high-resolution wheel events from a
device that isn't supposed to have them.

Where the device's axes were disabled due to a quirk, re-enabling the
axes means the device's events won't be filtered anymore. Our wheel
emulation plugin thus emulates high-resolution wheel events in addition
to the hardware events.

Fix this by simply filtering out any high-resolution wheel events on any
device that uses this plugin.

Closes #1160

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1279>
2025-07-24 09:13:12 +10:00
Peter Hutterer
6aefc2f166 libinput 1.28.903
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-21 13:34:46 +10:00
Peter Hutterer
4326413238 libinput: obfuscate the keycodes in the "Queuing ..." debug log
These messages are behind the 'internal-event-debugging' meson options
but let's be extra safe. It's rarely if ever required to see the actual
keycode anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:43 +10:00
Peter Hutterer
73103a5c38 plugin: always obfuscate keycodes
Same approach as chosen in libinput-record, this leaves the F1-F10 out
but otherwise prints every other "normal" key (including modifiers) as
KEY_A.

In the future we may need some more specific approach but for now this
will do. For the use-cases where we do need some specific approach,
libinput record and libinput debug-events will still show the full
keycode on request anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:43 +10:00
Peter Hutterer
abd5989ee8 plugin: prevent potential keycode leakage to the logs
Mixup of #if vs #ifdef caused this condition to always be treated as
true, resulting in leakage of key codes to the logs if the libinput log
level was set to debug.

Fixes: 7137eb9702 ("plugin: add ability to queue more events in the evdev_frame callback")

Closes #1163

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:20 +10:00
Peter Hutterer
7a22eb8d08 plugin/evdev: drop the duplicate event frame printing
The plugin system prints all events before they're passed to the plugin
anyway and the special evdev plugin does not do anything but pass it on.
We can thus assume that the events passed to libinput are the same as
the ones passed to this plugin.

Let's do that and adjust the print format to be closer to what
evdev_log_debug() would print.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 11:53:57 +10:00
Peter Hutterer
80b45ff28e test: a skipped test does not count as failure
There's a blurry line between NOT_APPLICABLE and SKIP but the latter
has a stronger "should run but can't right now". But where it happens
the skip shouldn't count as a failure.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 11:53:57 +10:00
Peter Hutterer
35838e9b2c test: fix litest_assert_str_not_in
Looks like an inadvertent paste or possibly a search regex gone wrong.
And the strstr condition was wrong too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 10:12:29 +10:00
Peter Hutterer
013ed167a4 libinput 1.28.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-17 11:29:06 +10:00
Peter Hutterer
eed4f84508 test: add a typical PS/2 wheel mouse
Notably without a high-resoulution wheel to ensure we run the tests on
those devices too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1275>
2025-07-17 00:36:52 +00:00
Peter Hutterer
18b34d0bc0 test: split some tablet tests into new groups
Our CI pipeline fails 9 times out of 10 on the valgrind tests. The tests
seem to finish in either 35 min or exceed the 60 min timeout limit, with
nothing in between. To avoid this let's split into more groups so we can
a) run those more in parallel and b) are less likely to hit the
timeout when run slowly.

Analysis of recent logs shows the eraser button tests to be the worst
offender, taking 752s (due to the combinatorial explosion) alone. The
various tip and proximity tests together also take some time so let's
group those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1274>
2025-07-17 00:16:02 +00:00
Peter Hutterer
c24ad64d18 meson.build: drop the timeouts to fit into the CI's 60 min limit
The vm tests had a 20 min timeout and a multiplier of 100. Our CI will
kill us (without logs) after 60 minutes.

Let's drop this to ~18min and a multiplier of 3 which gives us a few
minutes for setup before the CI terminates us. Ideally this means
we get some meson logs on timeout failures.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1274>
2025-07-17 00:16:02 +00:00
Peter Hutterer
7140f13d82 evdev: track KEY_SYSRQ frames and pass them even as repeat frames
Alt+Printscreen aka KEY_LEFTALT + KEY_SYSRQ is emulated by the kernel
and always posted with SYN_REPORT 1, see
drivers/tty/sysrq.c:sysrq_reinject_alt_sysrq()

The actual sequence when pressing Alt + Printscreen is to release Alt
first, then press it again:
- evdev:
    - [ 10, 674010,   1,  56,       0] # EV_KEY / KEY_LEFTALT               0
    - [ 10, 674010,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +2861ms
  - evdev:
    - [ 10, 674030,   1,  56,       1] # EV_KEY / KEY_LEFTALT               1
    - [ 10, 674030,   1,  99,       1] # EV_KEY / KEY_SYSRQ                 1
    - [ 10, 674030,   0,   0,       1] # ------------ SYN_REPORT (1) ---------- +0ms
  - evdev:
    - [ 10, 674031,   1,  99,       0] # EV_KEY / KEY_SYSRQ                 0
    - [ 10, 674031,   1,  56,       0] # EV_KEY / KEY_LEFTALT               0
    - [ 10, 674031,   0,   0,       1] # ------------ SYN_REPORT (1) ---------- +0ms

Handle that special case so we get our printscreen key to work as
expected anymore.

Fixes: 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1273>
2025-07-16 09:36:10 +10:00
Peter Hutterer
ccc798808a ci: don't paper over pre-commit failures
The ruff-format check only checks, it doesn't modify the files so our
CI doesn't catch formatting errors.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:26:59 +10:00
Peter Hutterer
79ea713aa3 tools: fix ruff format for libinput-replay
Fixes: 89c2f29d2c ("tools/libinput-replay: Warn if writing to local-overrides fails")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:26:59 +10:00
Peter Hutterer
7e98f2f2d2 pre-commit: update the name for the ruff check
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:24:27 +10:00
Peter Hutterer
778caa41af Add evdev_usage_name as helper for debugging
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1270>
2025-07-15 01:14:37 +00:00
Peter Hutterer
f98db521ee plugin: remove a leftover function
This one is no longer called, so no need to keep it around.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1269>
2025-07-15 10:51:42 +10:00
Peter Hutterer
0b07e77c3e plugin: remove a confusing FIXME
This is a leftover from the Lua plugin branch where the question of
whether to have public plugins before or after internal plugins is a
valid one. We don't have public plugins here, so let's remove this
fixme.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1269>
2025-07-15 10:51:42 +10:00
Peter Hutterer
c7ec39f51e test: tighten a helper function
Make sure we can pass only the right axis in

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
09acce4ce8 test: make the wheel tests stricter and always expect hires events
This would've caught #1156

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
c75d158bc0 test: swap a condition for easier readability
We have an else, so let's not do an `if not foo` condition.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
8fcacca7da util: print legacy axis events for debugging
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
1dec6f98b0 plugins: add a plugin to emulate high-resolution wheel events
Fixes a regression causing missing scroll events on devices where the
kernel only sets REL_WHEEL/REL_HWHEEL but not the corresponding
hires events. On those devices we would get the legacy axis events but
no longer the new ones.

The mouse wheel plugin will correctly emulate missing hires events
but it doesn't attach to devices where the hires bit is never set.

This plugin can be very simple - since we know we enabled the code on
this device we don't need to keep any extra state around. If our frame
handler is called for this device we want to add the hi-res events.

Theoretically this breaks if the device has only one hi-res axis enabled
but not the other one (i.e. REL_WHEEL_HI_RES but only REL_HWHEEL) but
that's too theoretical to worry about.

Closes #1156

Fixes: 31854a829a ("plugin: only register the wheel plugin on devices that have a wheel")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
gudvinr
975ce6dbf5 plugin/wheel: reduce ACC_V120_THRESHOLD
For mice with multipliers 30/120 and 40/120 nothing would change
as both will still cross threshold only after 2nd event.

But for MX Master 3 (and maybe others) that makes scroll beginning
a bit responsive, without jumping straight to 64/120 or 72/120.

Now events being emitted at 16+16+16 or 24+24 without significant
side-effects ("twitching" when resting finger on the wheel,
sudden scroll events when pressing middle button, etc). See !1262 for
some background.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1267>
2025-07-12 10:28:17 +03:00
Peter Hutterer
7716954365 libinput 1.28.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-10 11:51:28 +10:00
Peter Hutterer
6cdf46f857 plugins: restore the wheel plugin specifically for the MX Master 3
The MX Master 3 is difficult, its wheel events are all over the place
and heuristics are tricky to determine. The previous plugin behavior
was seemingly sufficient for the MX Master but not for other devices.

Restore the old behavior if the quirk is set for a device by adding a
fourth state ALWAYS_ACCUMULATE. In this state the min movement is never
updated from the original threshold, causing any wheel motion to
accumulate.

Ref: ca6b82841c ("plugin/wheel: tighten the wheel debouncing code")
Ref: bb05e0d1b5 ("plugin/wheel: don't accumulate for low HID resolution multipliers")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:24 +00:00
Peter Hutterer
f8c582db51 quirks: sort the quirk enum alphabetically
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:24 +00:00
Peter Hutterer
32c5fde0a8 Make the model quirk check available on the libinput device
Moves things one level higher to be able to use it from a plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:23 +00:00