Commit graph

5286 commits

Author SHA1 Message Date
Peter Hutterer
99ceda011c util: add strdup_printf helper functions
More straightforward than using xasprintf

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
3858a6c4f8 test: print events discarded while waiting for another event type
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
bfbecc5ef3 test: vary the colors in the test output a bit
Instead of everything bright red, let's vary the colors so it's easier
to spot the different assertions we add.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
aaad75ec19 test: mark _litest_checkpoint as printf function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
2ec9389a0d test: stringify the LITEST_ value as the device's name
This avoids inconsistencies between the LITEST_ enum value and the
shortname but also makes it easier to grep for any test cases that use
the same define. At the cost of the test names not looking very nice
anymore but oh well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
b0cfcfab34 test: standardize the wacom device names
Consistently use the pen/pad/finger suffix for the subdevices, both in
the device's name and the device type.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
7ae22591f3 test: add a note that the Huion PIDs are shared
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
99097c983d test: don't include an internal header in the totem tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
11aa71e78e tools/list-devices: print vid/pid as well
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1153>
2025-03-13 05:29:34 +00:00
Peter Hutterer
4ac52b4f1b tools: support sendevents mode in debug-events
Disabling sendevents was already supported via an fnmatch() and
--disable-sendevents but to test things like disabling on an external
mouse, let's expose this option too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1152>
2025-03-13 05:17:07 +00:00
Peter Hutterer
67428b64e0 doc: fix two duplicated references
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1155>
2025-03-12 11:43:25 +10:00
Peter Hutterer
dd78765674 pre-commit: add a hook for checking for duplicate empty lines
It's a bit annoying to only find those during a CI pipeline run, so
let's add a hook for it. Pre-commit doesn't seem to have something
useful for duplicate line detection so let's hack up a quick script
that can do this for us, together with the other whitespace checks in
the CI so we're consistent.

Excluded from the duplicate line checks are anything "Not C" and the
"include/" directory since we don't control those files.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1154>
2025-03-11 11:41:34 +00:00
Peter Hutterer
58315eb9d4 test: remove duplicate empty lines from the test/ directory
We've had a CI job for checking this since but it omitted the test
directory.

Fixes: bb6ff0ec00 ("gitlab CI: add a job to check for whitespace issues")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1154>
2025-03-11 11:41:34 +00:00
Zhou Qiankang
84e814561c quirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ IAH
* The ThinkBook 14 G7+ IAH also has the same issue as the ThinkBook 14 G7+ ASP.

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1151>
2025-03-09 15:46:34 +08:00
Thomas Newman
7030dc7c8d quirks: set pressure pad for ThinkPad X9 15 Gen 1 Forcepad
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1150>
2025-02-28 23:00:22 -05:00
Mingcong Bai
06d730e372 quirks: raise AttrTrackpointMultiplier for ThinkPad T470/T480/A485 to 0.75
As I tested my friend's ThinkPad A485, I found that the default multiplier
resulted in jumpy cursor and a slightly too quick acceleration curve. Upon
checking for Lenovo quirks, I found that since commits 383a60abea
("Better Thinkpad T480 trackpoint multiplier") and a1566e3492 ("quirks:
Thinkpad T470 trackpoint multiplier"), the TrackPoint multiplier for both
T470 and T480 (which shares the same keyboard FRUs with the A485) were set
to 0.4.

However, per my testing, by setting the multiplier to 0.4, the TrackPoint
speed became so painfully slow that it began to hurt my index finger...
I suspect the original commiters have set custom acceleration curves on
their own system, but I might be wrong.

Playing with the multiplier, I found 0.75 to be the most appropriate and,
interestingly, with anything >= 0.8, the TrackPoint began to become jumpy,
with the cursor appearing to have a very low poll rate on the screen (the
higher the multiplier, the worse it gets).

Since, as I mentioned above, the keyboard and TrackPoint parts are shared
between these three models, I'm assuming that this multiplier will work
well for them.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1149>
2025-02-27 22:47:14 +08:00
Peter Hutterer
48cd4c7287 tablet: track pressure ranges per tablet
Tablets may have different ABS_PRESSURE ranges with the oldest tablets
having 1k pressure range, then 2k, and the newer ones 8k.

If the same tool is used across two tablets with different ABS_PRESSURE
ranges, the first tablet in proximity calculated the range on where to
normalize to. As a result the other tablet either couldn't reach the
full pressure (2k pressure first, then 8k) or the full pressure range
was reached at a fraction of the full range (8k pressure first, then
2k).

Fix this by moving the threshold handling into a separate struct and
hardcoding up to 4 of those per tool. That is 2 more than the more
complicated setups I've heard of (and this only applies to tracking the
same stylus across those tablets anyway).

This duplicates the pressure offset heuristics but that's easier than
figuring out how to handle heuristics across potentially two tablets.

The range configuration is left as-is on the assumption that this one is
per tool, not per tablet.

Closes #1089

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1143>
2025-02-25 05:18:58 +00:00
Peter Hutterer
1de6ac8916 test: rename the 12WX test device short name and enum
Make this more specific, we have quite a few other cintiqs in here

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1143>
2025-02-25 05:18:53 +00:00
Peter Hutterer
f70f803365 quirks: add quirk for the RazerBlade182024 Keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1148>
2025-02-24 08:56:02 +00:00
satrmb
a71f560f3e test: fix off-by-ones in two ranges, prevent the same in remaining ranged tests
touchpad_move_after_touch contains support for up to 5 fingers but was only run
with 2..4 fingers.
touchpad_multitap and several others using the same parameter definition were
long ago tested with 3..7 taps. In 8f92b091 this was reduced to 3..4 for CI
performance, while the commit message indicates 3..5 were intended.

The common theme is that the upper bound of `struct range` is interpreted
as exclusive, while some uses assumed it would be inclusive.
There are relatively recent helper functions range_init_inclusive and
range_init_exclusive (since 817dc423) to avoid this trap. Use them on the
remaining two ranged tests.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1142>
2025-02-20 09:34:20 +01:00
satrmb
6f9a54c573 test: convert most ranged tests to parametrized ones
The two remaining ranged tests (abs_device_no_range, abs_mt_device_no_range)
are better served staying with ranges because parametrized tests need to
explicitly list all members of the range, which for these tests is not only
pretty big, but also contains abs axes reserved for future use. Those axes
have no names yet, making a future-proof conversion pretty much impossible.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1142>
2025-02-20 09:34:14 +01:00
satrmb
3a60c47e33 test: add optional value names to parametrized tests
Only implemented for i32 values so far, used for enums and enum-like constants,
replaces a runtime lookup from stringly-typed parameters.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1141>
2025-02-20 08:18:48 +01:00
Peter Hutterer
bf3a67de6c gestures: if 3fg drag fingers are in a nice position, start dragging
Similar to the condition just north of here, if we have 3 fingers in a
roughly linear line and 3fg dragging is enabled, assume we're actually
trying to drag. This reduces the minimum movement otherwise required
to detect the type of gesture.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
1d9e307e2b touchpad: implement support for three-finger drag
Exposed via new configuration option this enables 3 and 4 finger
dragging on touchpads. When enabled a 3/4 finger swipe
gesture is actually a button down + motion + button up sequence.

If tapping is disabled the drag starts immediately, if tapping is
enabled the drag starts after the tap timeout/motion so we can distinguish
between a tap and a drag.

When fingers are released:
- if two fingers remain -> keep dragging
- if one finger remains -> release drag, switch to pointer motion

When 3/4 fingers are set down immediately after releasing all fingers
the drag continues, similar to the tap drag lock feature. This drag lock
is not currently configurable.

This matches the macos behavior for the same feature.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
ae86d8b1b6 gestures: disambiguate between a tap timeout and a hold timeout
Where the tapping code calls into the timeout function make sure we have
a separate event for this. This way we know whether the current gesture
event is caused by the hold timeout or something else.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
659b49b3a3 gestures: localize a set of variables better
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
16a8c1d06c gestures: rename a helper function
has_started() is a bit misleading here, this merely decides whether we
should delay any finger changes or not.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
c73fc78407 touchpad: cancel any ongoing gesture if we're about to send a button
This shouldn't have any effect in the current setup as there is
"coincidentally" no overlap between the two state machines so this is
effectively a noop.

Nonetheless, if we're about to send a tap button event we cannot be in
any other gesture than tapping so all swipe/pinch/holds need to be
cancelled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
114af53824 test: fix the touchpad finger positions for a test
The 5th finger was placed in the same position as the 4th finger which
doesn't have an effect in libinput but it looks wrong.

And the first finger was put down at 40/30 but then moved from 70/30 to
the new position, causing pointer jumps on some touchpads.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1145>
2025-02-18 05:40:44 +00:00
Peter Hutterer
5ae31d7f46 test: fix litest_test_param_get_double
Overenthusiastic search/replace caused the name argument to be a const
double*.

Fixes: 5ed75e7e9f ("test: make litest_parameters fetching more type-safe")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1144>
2025-02-18 14:58:28 +10:00
Peter Hutterer
9d214e1c19 tools/list-devices: add missing config options to the output
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
d33c83b1b1 tools/list-devices: add helper to print aligned values
This makes it easier to re-align all columns.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
c8ee24ce17 tools/list-devices: reword the man page a bit
Hopefully a slightly better explanation that what we had before.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
dbe8f7fede tools/list-devices: allow listing some devices only
$ libinput list-devices /dev/input/envent0

Now does what one would expect.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
wangyafei
3cf6c91fff quirks: add quirks for Dell laptop with Goodix Touchpad.
This touchpad is a pressure pad and needs the pressure
handling disable.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1130>
2025-02-13 02:18:02 +00:00
Peter Hutterer
5ed75e7e9f test: make litest_parameters fetching more type-safe
Require the type to be added in the litest_test_params_fetch() so we can
easily detect a mismatch. And add some type-safe getters that are much
easier to use for all the tests that only have a single parameter to
fetch anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1139>
2025-02-12 09:11:51 +00:00
Peter Hutterer
9ae15c6a45 pad: be more robust to kernel bugs of multiple EV_ABS
This is a workaround for a kernel bug with the Wacom Mobile Studio Pro
13: this device sends erroneous ABS_WHEEL events when pressing
buttons:

  - evdev:
    - [  0,      0,   1, 256,       1] # EV_KEY / BTN_0                     1
    - [  0,      0,   3,   8,      17] # EV_ABS / ABS_WHEEL                17 (+17)
    - [  0,      0,   3,   8,       0] # EV_ABS / ABS_WHEEL                 0 (-17)
    - [  0,      0,   3,  40,      15] # EV_ABS / ABS_MISC                 15 (+15)
    - [  0,      0,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +0ms

ABS_WHEEL to 17 then to 0 in the same frame. We should (and do) treat this
as a zero event and drop the 17 to the floor. Alas, we then generate a
ring event for the zero value despite our current value being zero
anyway. This again causes confusing behavior.

This is simple enough to work around, at least until the kernel is fixed
but also to prevent this happening in the future: warn if we get
multiple events and if so and the later event is zero, undo the axis
change state.

Closes: #1081
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1136>
2025-02-12 03:58:23 +00:00
Peter Hutterer
d9f121b4d1 test: add a litest_with_parameters helper macro
Magic for loop that takes care of the creation and unref for us,
hopefully improving readability a bit.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1138>
2025-02-12 11:41:56 +10:00
José Expósito
b566d64c17 quirks: Add Apple Magic Trackpad v2 USB-C (2024)
Add the missing USB-C vendor ID.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1080
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1134>
2025-02-04 14:36:01 +01:00
Peter Hutterer
184bcafe08 triage-policies: update to handle a few more things in MRs as well
Requesting libinput record, hid-recorder or punting to udev-hid-bpf
should be possible from MRs as well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1133>
2025-02-03 09:16:02 +10:00
José Expósito
3f4abaf77e quirks: Add Apple Magic Trackpad v2 2024
Add similar quirks to the previous generations.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1080
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1131>
2025-01-29 09:32:30 +01:00
José Expósito
e74d174744 quirks: Disable MT_TOOL_PALM for the Yoga Slim 7i Carbon
Lenovo Yoga Slim 7i Carbon sends bogus ABS_MT_TOOL_TYPE MT_TOOL_PALM
events. Disable them.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1077
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1128>
2025-01-21 10:16:47 +00:00
Marge Yang
af0e9a23c3 quirks: add quirk for Dell Haptics Touchpad.
This Touchpad is a pressure pad and needs the pressure
handling disable.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1127>
2025-01-21 07:26:41 +00:00
Peter Hutterer
fefeab4efe test: a boolean parameter is always true/false
Don't require the caller to provide the values, they're always the
same.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1123>
2025-01-20 12:08:46 +00:00
Peter Hutterer
86b9142a02 test: highlight the interesting part of the backtrace
This makes it easier to immediately see where things are breaking since
the full backtrace has >70% noise.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1124>
2025-01-20 11:30:01 +00:00
Peter Hutterer
6759a2f754 test: honor NO_COLOR and FORCE_COLOR for output colorization
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1124>
2025-01-20 11:30:01 +00:00
Peter Hutterer
74617de48d tools/record: record HID_BPF properties too
If this property is set we likely have a udev-hid-bpf property
loaded into the device. Knowing this is going to be important for
debugging why a device may or may not work so let's record this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Peter Hutterer
2c0c4a6516 Replace strneq() with hardcoded lengths with strstartswith()
Slightly less efficient but easier to read and it's not possible to
accidentally provide the wrong length. Plus it handles null pointers
correctly so get to skip the checks (which weren't needed for strneq()
either, but still).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Kirill Primak
00bc910df7 tablet: add missing event types in tool/pad event docs
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1126>
2025-01-20 10:08:36 +00:00
Peter Hutterer
1d8f2903ed tablet: always unset the various statuses if we're leaving proximity
The previous invocation was gated behind a TABLET_OUT_OF_AREA check
resulting in a nonresponsive tool when the tablet was moved out of
proximity outside the tablet area and the area was changed.

Move the actual status bit changes up into tablet_flush()
so we unconditionally set those.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00