Commit graph

5243 commits

Author SHA1 Message Date
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
Peter Hutterer
2f2612e8d7 test: use litest_checkpoint to annotate a test case
Had to debug something here and we might as well keep the printable
annotations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
55d47903b4 test: switch the tablet tests to parametrized tests
No functional change but the tests now include the parameters in
easy-to-read fashion which makes it easier to figure out which
combination is failing.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
c3bf478d41 util: add truefalse and yesno macros for easy string conversion
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
d52bb9ed4d tools/per-slot-delta: optionally show the distance to the original point
This makes it easier to quickly gather how far a touch has moved since
it started, compared to the initial starting position. This again makes
it easier to determine if a threshold required for e.g. scrolling has
been met.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5f8f715017 tools/per-slot-delta: refactor the printing of a slot
This makes it easier to optionally print extra components of that slot.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5df1d26aa2 tools/per-slot-delta: use a Point class for slot position/delta
Better abstraction, especially when we introduce more than just those
two.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
a7ff3e0508 tools/per-slot-delta: remove some duplication for axis handling
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
01f133fbc4 tools/per-slot-delta: use dataclasses and enums
Slight modernization of the code

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
530ca423a7 Improve the event queuing debugging a bit
Print a bit more information if this ifdef is disabled for
debugging, in this case for button events. That's all
I need for now, we can extend later.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1122>
2025-01-09 11:36:32 +10:00
Peter Hutterer
5388299117 test: slightly improve the failure message for litest_assert_not_null
Now prints
        FAILED: ev != NULL
which is less ambiguous/confusing than the previous
        FAILED: ev expected to be not NULL

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1122>
2025-01-09 11:36:26 +10:00
Peter Hutterer
d9de017d6c test: fix --filter-params handling
The previous implementation skipped parameters that were filtered, so
our test cases got called with parameters missing. Fix this by filtering
any test case that has a negative fnmatch on any parameter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1120>
2025-01-08 10:18:31 +00:00
Peter Hutterer
11dec0bd9b test: switch touchpad button tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 11:59:14 +10:00
Peter Hutterer
6ee8e8d9b6 test: change tap tests to use parameters
This also fixes the invocation of the
touchpad_3fg_tap_btntool_pointerjump which was written as ranged test
but never got invoked with a range (but _i defaults to zero).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 10:50:52 +10:00
Peter Hutterer
4bbad8adf0 test: change switch tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 10:48:32 +10:00
Peter Hutterer
812611ca2e test: switch touchpad tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 09:21:01 +10:00
Peter Hutterer
44fecb9a98 doc/user: link to the explanation why we can't change the tap default
We don't have an API for "device really should have tapping enabled" so
right now the only indicator of whether that's the case is when the
device has tapping enabled by default. This kind of prevents us from
switching the default, so let's at least link to the comment explaining
this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1115>
2025-01-07 09:10:50 +00:00
Peter Hutterer
800eeaea7e test: change the x/y type from int to double in a helper
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
f168f7d83a test: fix a typo in a comment
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
45389468a7 evdev: print the EV_SYN with better alignment to other messages
This affects the debugging output only and it's invocation is if 0 by
default.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
1e445f3f84 test: implement support for parametrizing tests
litest supports ranged tests but they are not enough, doubly so with
tests where we want to parametrize across multiple options.

This patch adds support for just that, in clunky C style.
The typical invocation for a test is by giving the test parameter
a name, a number of values and then the values themselves:

	struct litest_parameters *params = litest_parameters_new("axis", 's', 2, "ABS_X", "ABS_Y",
	                                                         "enabled", 'b', '2', true, false,
	                                                         "number", 'u', '2', 10, 11,
	                                                         NULL);
	litest_add_parametrized(sometest, LITEST_ANY, LITEST_ANY, params);
	litest_parameters_unref(params);

Currently supported are u (uint32), i (int32), d (double), b (bool),
c (char) and s (string).

In the test itself, the `test_env->params` variable is available and
retrieval of the parameters works like this:

	const char *axis;
	uint32_t number;
	bool enabled;
	litest_test_param_fetch(test_env->params,
	                        "axis", &axis,
	                        "enabled", &enabled,
	                        "number", &number,
	                        NULL);

Note that since this is an effectively internal test-suite only
functionality we don't do type-checking here, it's assumed that if you
write the code to pass parameters into a test you remember the type
of said params when you write the test code.

Because we don't have hashmaps or anything useful other than lists the
implementation is a bit clunky: we copy the parameter into the test
during litest_add_*, permutate it for our test list which gives us yet
another linked list C struct, and finally copy the actual value into
the test and test environment as it's executed. Not pretty, but it
works.

A few tests are switched as simple demonstration. The name of the
test has the parameters with their names and values appended now, e.g.:
   "pointer:pointer_scroll_wheel_hires_send_only_lores:ms-surface-cover:axis:ABS_X"
   "pointer:pointer_motion_relative_min_decel:mouse-roccat:direction:NW"

Filtering by parameters can be done via globs of their string
representation:
   libinput-test-suite --filter-params="axis:ABS_*,enabled:true,number:10*"

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
f9f9bccba2 test: force an unnecessary abort after litest_abort_msg()
This is the easy way to get static analyzers to understand that calling
litest_abort_msg() always fails.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
7efec8f2e7 test: move a switch case up for better grouping
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
da296c9976 util: Add a multivalue special type
A stripped down version of e.g GVariant that's enough for the few
parameter types we need to support.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
5e5799a319 test: log litest_checkpoint to stderr
Otherwise the logs are detached from libinput's logs (which are printed
to stderr) which makes the checkpoint function mostly useless since it
doesn't actually group the messages as expected.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1116>
2025-01-07 11:40:00 +10:00
Peter Hutterer
9ac040f72a util: add etrace to trace to stderr
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1116>
2025-01-07 11:40:00 +10:00
Peter Hutterer
3aa004b964 libinput 1.27.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-01-06 15:04:14 +10:00
Peter Hutterer
e68d80b13b CI: bump to Fedora 41
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1111>
2024-12-23 07:17:31 +00:00
Peter Hutterer
b1f804c5f1 Fix two scan-build warnings that appear on F41
../../../src/util-files.h:61:3: warning: The 1st argument to 'close' is <= -2 but should be >= -1 [unix.StdCLibraryFunctions]
   61 |                 close(*fd);

 ../../../test/test-quirks.c:66:8: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
   66 |                 rc = fputs(file_content, fp);

The latter is bogus because we have a litest_assert for this but
somehow this is ignored, so... shrug.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1111>
2024-12-23 07:17:31 +00:00
Peter Hutterer
117d91b93f tools/libinput-replay: use list comprehension instead of append
And remove the unnecessary del processes, we're in a block so processes
ceases to exist there anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
Peter Hutterer
193aacf61a tools/libinput-replay: interrupt only the ongoing event sequence with ctrl+c
If libinput replay is currently replaying events, stop that sequence and
go back to the start if the user presses Ctrl+C. Only on the second
Ctrl+C do we fully exit.

This helps debugging long recordings where we don't want to keep
producing events after some initial event sequence.

Closes #1064

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
WeirdTreeThing
a03058db72 quirks: Add quirk for Google Chromebook Banshee
Signed-off-by: Brady Norander <bradyn127@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1108>
2024-12-20 16:41:16 -05:00
Peter Hutterer
0288781383 gestures: change the debug log messages for state debugging
Prefix the result of handle_event with "event" and the handle_state with
"state"

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1106>
2024-12-20 09:47:46 +00:00
Peter Hutterer
3563b6780f gestures: use a macro for debugging transition states
This avoids bugs where we forget to update a state but also provides
some bounds checking now to ensure our array is large enough to store
those transitions.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1106>
2024-12-20 09:47:46 +00:00
Peter Hutterer
2e9d8df74e tools/debug-gui: color the fingers with different colors
Follow-up to commit 713892c162 ("Number the fingers by slot in debug-gui")
this changes the colors slightly for each finger, making it easier to
track visually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1103>
2024-12-20 01:15:11 +00:00
Peter Hutterer
4131e4d2c0 quirks: the Wacom Bamboo 2FG 6x8 is a semi-mt touchpad
See #919

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1104>
2024-12-20 00:43:50 +00:00
Peter Hutterer
3b2ff75a0d triage-policies: fix the hwdb.d directory
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1100>
2024-12-19 07:27:23 +00:00
Peter Hutterer
632b6dad63 triage-policies: add an entry to punt to udev-hid-bpf
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1105>
2024-12-19 07:17:06 +00:00
Joshua Noeske
ce7b7c94e7 gestures: fix transformation of scroll to pinch
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1099>
2024-12-18 15:50:50 +01:00
Peter Hutterer
d63689003f tools: only warn once about our lack of support for multiple fingers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1096>
2024-12-18 08:49:34 +00:00
Peter Hutterer
eef0650759 touchpad: init the thumb size threshold to INT_MAX
For consistency with the pressure threshold, both are guarded behind
a use_size/use_pressure boolean anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1095>
2024-12-18 08:24:41 +00:00
Peter Hutterer
52679e1296 tools/libinput-replay: print a separator line for EV_SYN events
If running with --verbose having that line makes it a lot easier to
look at the event sequence.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1094>
2024-12-18 08:07:18 +00:00
Peter Hutterer
f44a181a8e triage-policies: default close after pointing the user to 60-evdev.hwdb
In line with our new process of closing bugs let's close after this
bugbot message too. If the hwdb doesn't fix it then the reporter can
always re-open.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1097>
2024-12-18 07:39:57 +00:00
Peter Hutterer
c6c0db1d8d triage-policies: add missing "actions" for the bugbot::evdev-hwdb
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1098>
2024-12-18 11:12:23 +10:00