platform/upstream/libinput.git
7 months agotools: add rel dial support to libinput-list-devices
Peter Hutterer [Tue, 22 Oct 2024 01:54:45 +0000 (11:54 +1000)]
tools: add rel dial support to libinput-list-devices

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>

7 months agotest: split the touchpad tests into a palm and a dwt test collection
Peter Hutterer [Thu, 17 Oct 2024 23:42:11 +0000 (09:42 +1000)]
test: split the touchpad tests into a palm and a dwt test collection

dwt and palm tests have a lot of timeouts to wait for so let's split
those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: split the tablet left-handed tests out into a separate collection
Peter Hutterer [Thu, 17 Oct 2024 23:30:12 +0000 (09:30 +1000)]
test: split the tablet left-handed tests out into a separate collection

These aren't complicated but there's a lot of them so let's run them
separately to make the overall tablet test shorter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agoCI: move the "device" test suite to the "misc" set of suites
Peter Hutterer [Thu, 17 Oct 2024 22:56:38 +0000 (08:56 +1000)]
CI: move the "device" test suite to the "misc" set of suites

That one is still with the gestures but only takes 1-2 minutes, the
gestures takes 13 minutes. Let's move it to misc which currently has an
overall runtime of only 2 min anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: split out the touchpad tap tests into multiple collections
Peter Hutterer [Thu, 17 Oct 2024 09:35:16 +0000 (19:35 +1000)]
test: split out the touchpad tap tests into multiple collections

These take a long time and have a reasonable high chance of failure due
to the timing constraints. Let's split them up so they don't hog the
runners for that long and in case they fail, we only need to re-run a
short test.

Before: one test running approx 21 min, now 3 tests running approx 7 +
11 + 4 min.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agomeson: break out the test suites into manual list
Peter Hutterer [Thu, 17 Oct 2024 09:34:11 +0000 (19:34 +1000)]
meson: break out the test suites into manual list

If we start having multiple TEST_COLLECTION() in the same file we can
no longer use the file name - so a manually maintained list it is.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: make the TEST_COLLECTION() macro re-usable in the same file
Peter Hutterer [Thu, 17 Oct 2024 09:25:39 +0000 (19:25 +1000)]
test: make the TEST_COLLECTION() macro re-usable in the same file

Concat the line number to the generated variable names, this way we can
have more than one TEST_COLLECTION() in the same file.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: detach the suite handling from the file names
Peter Hutterer [Thu, 17 Oct 2024 09:55:25 +0000 (19:55 +1000)]
test: detach the suite handling from the file names

Instead of extracting the suite name from the test's file name use the
current suite that is being parsed. This way we pave the way for
multiple suites in the same file.

This uses a global because otherwise we'd have to redo all the
litest_add() functions but it does the job here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotest: match the tablet's pad test collection with the file name
Peter Hutterer [Thu, 17 Oct 2024 10:30:08 +0000 (20:30 +1000)]
test: match the tablet's pad test collection with the file name

This is currently a requirement, so let's match this before we run
into issues here re-structuring stuff.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>

7 months agotablet: fix a memory leak caused by an early return
Peter Hutterer [Thu, 17 Oct 2024 22:38:47 +0000 (08:38 +1000)]
tablet: fix a memory leak caused by an early return

Previously we'd return early, failing to libwacom_destroy() the device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1064>

7 months agoCI: set the LITEST_JOBS in the template, not the script
Peter Hutterer [Thu, 17 Oct 2024 03:57:19 +0000 (13:57 +1000)]
CI: set the LITEST_JOBS in the template, not the script

Fixes: 70c57e964450 ("CI: drop the job count for the valgrind test suite to 2")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1063>

7 months agotest: use a litest helper instead of return code comparison
Peter Hutterer [Wed, 16 Oct 2024 01:27:27 +0000 (11:27 +1000)]
test: use a litest helper instead of return code comparison

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: rename a variable to indicate suites, not tests
Peter Hutterer [Wed, 16 Oct 2024 01:26:15 +0000 (11:26 +1000)]
test: rename a variable to indicate suites, not tests

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: rename all_tests to all_test_suites
Peter Hutterer [Wed, 16 Oct 2024 01:24:15 +0000 (11:24 +1000)]
test: rename all_tests to all_test_suites

This is a a list of struct suite with the various tests inside that
suite.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: check for verbosity immediately in main()
Peter Hutterer [Wed, 16 Oct 2024 01:14:11 +0000 (11:14 +1000)]
test: check for verbosity immediately in main()

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: check for empty tests immediately, not later when we're running
Peter Hutterer [Wed, 16 Oct 2024 01:12:42 +0000 (11:12 +1000)]
test: check for empty tests immediately, not later when we're running

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: init the global devices/test lists immediately
Peter Hutterer [Wed, 16 Oct 2024 01:10:18 +0000 (11:10 +1000)]
test: init the global devices/test lists immediately

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: add restore_tty helper and use it
Peter Hutterer [Wed, 16 Oct 2024 00:55:55 +0000 (10:55 +1000)]
test: add restore_tty helper and use it

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: init the device list via argument
Peter Hutterer [Wed, 16 Oct 2024 00:26:31 +0000 (10:26 +1000)]
test: init the device list via argument

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: add a helper for deleting a created file
Peter Hutterer [Tue, 15 Oct 2024 01:46:58 +0000 (11:46 +1000)]
test: add a helper for deleting a created file

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: switch a bunch of tests from abort() to one with a message
Peter Hutterer [Mon, 14 Oct 2024 11:35:36 +0000 (21:35 +1000)]
test: switch a bunch of tests from abort() to one with a message

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: fix litest_abort_msg() not starting a new line
Peter Hutterer [Mon, 14 Oct 2024 11:42:26 +0000 (21:42 +1000)]
test: fix litest_abort_msg() not starting a new line

Most callers of litest_abort_msg() don't add '\n' so the output was
mangled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agodoc: correct that the test suite is indeed run in the CI
Peter Hutterer [Tue, 15 Oct 2024 05:31:52 +0000 (15:31 +1000)]
doc: correct that the test suite is indeed run in the CI

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>

7 months agotest: switch the tests to use enum comparisons
Peter Hutterer [Mon, 16 Sep 2024 06:49:38 +0000 (16:49 +1000)]
test: switch the tests to use enum comparisons

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add macros to compare enum values
Peter Hutterer [Mon, 16 Sep 2024 06:30:40 +0000 (16:30 +1000)]
test: add macros to compare enum values

This requires switching a lot of int_eq/int_ne over to enum_eq/enum_ne
because the compiler doesn't infer the right type from a harcoded enum
value - it just defaults to int.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: switch a bunch of integer comparisons to right sizes
Peter Hutterer [Fri, 11 Oct 2024 03:55:56 +0000 (13:55 +1000)]
test: switch a bunch of integer comparisons to right sizes

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: switch ck_assert over to litest_assert
Peter Hutterer [Mon, 16 Sep 2024 06:20:26 +0000 (16:20 +1000)]
test: switch ck_assert over to litest_assert

This is the first step in switching away from the check framework.
Our litest macros already do almost exactly the same anyway so most of
this is a simple sed with a few compiler fixes where things mismatch
(nonnull -> notnull) and (_tol -> _epsilon).

This now generates a whole bunch of integer mismatch warnings: check
casts everything to intmax_t whereas we use typeof, so lots of warnings
especially for enums.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add litest string comparison macros
Peter Hutterer [Mon, 16 Sep 2024 06:13:44 +0000 (16:13 +1000)]
test: add litest string comparison macros

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: replace manual "almost equal" with the new double epsilon
Peter Hutterer [Mon, 14 Oct 2024 00:14:56 +0000 (10:14 +1000)]
test: replace manual "almost equal" with the new double epsilon

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix some checks using ints to compare doubles
Peter Hutterer [Mon, 14 Oct 2024 05:26:57 +0000 (15:26 +1000)]
test: fix some checks using ints to compare doubles

Theoretically we should be using ck_assert_double_eq here for
consistency but this patch  is part of a series eventually
replacing those calls, so let's jump to litest_assert_double
directly to avoid further rebase conflicts.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix a touch test comparing ints to doubles
Peter Hutterer [Mon, 14 Oct 2024 05:20:21 +0000 (15:20 +1000)]
test: fix a touch test comparing ints to doubles

We were checking doubles for integers but better to check that we're
close to the maximum range without actually being over.

This worked because check typecasts to uint_max_t but let's be explicit
here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add a macro to compare two doubles with a specific epsilon
Peter Hutterer [Mon, 16 Sep 2024 06:05:11 +0000 (16:05 +1000)]
test: add a macro to compare two doubles with a specific epsilon

Same as ck_assert_double_tol

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: initialize a variable to make scan-build happy
Peter Hutterer [Sun, 13 Oct 2024 01:06:39 +0000 (11:06 +1000)]
test: initialize a variable to make scan-build happy

Assuming safe_atoi works as expected, `fuzz` cannot be
uninitialized by the time we get here. But let's init it anyway to make
scan-build happy.

[202/249] Compiling C object libinput-test-suite.p/test_test-touch.c.o
../../../test/test-touch.c:964:2: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
  964 |         litest_assert_int_eq(fuzz, 10); /* device-specific */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that this error message is the result of a follow-up commit,
this commit is shuffled before so we have bisectable build.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add litest_assert_event_type_not_one_of
Peter Hutterer [Mon, 14 Oct 2024 08:58:24 +0000 (18:58 +1000)]
test: add litest_assert_event_type_not_one_of

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: replace ck_abort with litest_abort_msg()
Peter Hutterer [Tue, 8 Oct 2024 09:27:28 +0000 (19:27 +1000)]
test: replace ck_abort with litest_abort_msg()

Weirdly, that also required initializing two variables to NULL to stop a
compiler warning.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix missing END_TEST for strv_for_each_test
Peter Hutterer [Sat, 12 Oct 2024 10:21:59 +0000 (20:21 +1000)]
test: fix missing END_TEST for strv_for_each_test

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix double parsing test
Peter Hutterer [Sun, 13 Oct 2024 09:01:50 +0000 (19:01 +1000)]
test: fix double parsing test

We should check that we actually have a double here...

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix a data type in the utils test
Peter Hutterer [Sat, 12 Oct 2024 10:21:20 +0000 (20:21 +1000)]
test: fix a data type in the utils test

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: add a missing va_end
Peter Hutterer [Mon, 14 Oct 2024 08:56:05 +0000 (18:56 +1000)]
test: add a missing va_end

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

7 months agotest: fix uinput creation for the slotted devices with too many slots
Peter Hutterer [Mon, 14 Oct 2024 09:29:15 +0000 (19:29 +1000)]
test: fix uinput creation for the slotted devices with too many slots

Kernel commit 206f533a0a7c
       "Input: uinput - reject requests with unreasonable number of slots"
limits the number of slots to 99 - let's manually adjust that so we can
keep creating uinput devices.

Since these are just a test device and we don't use the slots here
anyway (they're all fake MT devices) we can manually work around this.
The real devices won't be affected by this since this is a limitation
in uinput, not the input subsystem.

Also move the comment one line up in the ms-surface device, the previous
comment referred to the wrong event code.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1061>

8 months agotest: make litest-test-suite --list YAML-compatible
Peter Hutterer [Sun, 13 Oct 2024 23:14:59 +0000 (09:14 +1000)]
test: make litest-test-suite --list YAML-compatible

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>

8 months agotest: move the test devices into the test_device_section
Peter Hutterer [Sun, 13 Oct 2024 09:20:57 +0000 (19:20 +1000)]
test: move the test devices into the test_device_section

Better naming this way

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>

8 months agotest: switch unused argc/argv to the list of tests
Peter Hutterer [Sun, 13 Oct 2024 09:16:32 +0000 (19:16 +1000)]
test: switch unused argc/argv to the list of tests

This means we don't rely on the "all_tests" global here though it also
means we need to move the cleanup into the caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>

8 months agoquirks: add Logitech ERGO M575(S)
Muhammad Talal Anwar [Mon, 7 Oct 2024 21:06:05 +0000 (21:06 +0000)]
quirks: add Logitech ERGO M575(S)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1058>

8 months agogestures: change a boolean to an enum for more expressive code
Peter Hutterer [Fri, 13 Sep 2024 05:31:34 +0000 (15:31 +1000)]
gestures: change a boolean to an enum for more expressive code

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: add debugging for state transitions
Peter Hutterer [Fri, 13 Sep 2024 04:41:36 +0000 (14:41 +1000)]
gestures: add debugging for state transitions

Our state machine allows falling through multiple transitions, so let's
make it possible to debug this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: get rid of tp_gestures_start
Peter Hutterer [Fri, 13 Sep 2024 02:34:41 +0000 (12:34 +1000)]
gestures: get rid of tp_gestures_start

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: rename gesture_notify_hold to gesture_notify_hold_begin()
Peter Hutterer [Fri, 13 Sep 2024 01:58:26 +0000 (11:58 +1000)]
gestures: rename gesture_notify_hold to gesture_notify_hold_begin()

HOLD gestures only have begin/end so let's rename this so it's
immediately obvious which one we're sending.

notify_swipe/pinch pass the event type in so it's clear that it's a
BEGIN vs an UPDATE.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: rename most events to FOO_START
Peter Hutterer [Fri, 13 Sep 2024 01:25:22 +0000 (11:25 +1000)]
gestures: rename most events to FOO_START

These events aren't used to signal scroll/swipe/pinch/..., merely to
signal the start of that gesture. So let's rename it to make the code
clearer (e.g. why do we log a bug when for a FOO event when we're in
state FOO?).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: push tp_gesture_start() for hold gestures into the state handling
Peter Hutterer [Thu, 12 Sep 2024 10:10:42 +0000 (20:10 +1000)]
gestures: push tp_gesture_start() for hold gestures into the state handling

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: push tp_gesture_end() into the actual state machine
Peter Hutterer [Thu, 12 Sep 2024 09:36:38 +0000 (19:36 +1000)]
gestures: push tp_gesture_end() into the actual state machine

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: log a bug if we're trying to reset an actual gesture
Peter Hutterer [Thu, 12 Sep 2024 08:47:36 +0000 (18:47 +1000)]
gestures: log a bug if we're trying to reset an actual gesture

Now that end/cancel are separate states, we shouldn't get here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: distinguish between a gesture reset and a gesture end/cancel
Peter Hutterer [Mon, 9 Sep 2024 03:59:25 +0000 (13:59 +1000)]
gestures: distinguish between a gesture reset and a gesture end/cancel

All current states treat them the same way but let's distinguish those
two so we can have different code depending on whether a gesture was
cancelled/reset or ended properly.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: replace switch-timeout based gesture_cancel calls with a state
Peter Hutterer [Thu, 12 Sep 2024 08:29:40 +0000 (18:29 +1000)]
gestures: replace switch-timeout based gesture_cancel calls with a state

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: rename tp_gesture_handle_state and tp_gesture_post_gesture
Peter Hutterer [Tue, 10 Sep 2024 03:00:36 +0000 (13:00 +1000)]
gestures: rename tp_gesture_handle_state and tp_gesture_post_gesture

Confusingly, tp_gesture_handle_state() would do almost nothing with our
state machine and the various tp_gesture_handle_state_foo() were called
later from tp_gesture_post_gesture().

Rename those functions into so that we have
tp_gesture_update_finger_state() first followed by
tp_gesture_handle_state() which is responsible for dealing with the
state machine.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: make a error message more informative
Peter Hutterer [Thu, 12 Sep 2024 09:45:33 +0000 (19:45 +1000)]
gestures: make a error message more informative

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agogestures: log the finger count together with the gesture state
Peter Hutterer [Fri, 13 Sep 2024 04:10:51 +0000 (14:10 +1000)]
gestures: log the finger count together with the gesture state

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>

8 months agoquirks: add a quirk for the HONOR MagicBook Art 14 touchpad
Wentao Guan [Mon, 23 Sep 2024 08:51:47 +0000 (08:51 +0000)]
quirks: add a quirk for the HONOR MagicBook Art 14 touchpad

The touchpad need ModelPressurePad=1 to enable moving cursor,
and need AttrEventCode=-BTN_RIGHT to use right key by touchpad
two-fingers press..

Closes: #1040
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1040
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1053>

8 months agoquirks: Add quirk for Google Chromebook Cret
WeirdTreeThing [Mon, 30 Sep 2024 01:37:22 +0000 (21:37 -0400)]
quirks: Add quirk for Google Chromebook Cret

Signed-off-by: Brady Norander <bradyn127@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1056>

8 months agoquirks: touchpad quirk for ICL Si1516/Si1512
Ajrat Makhmutov [Tue, 24 Sep 2024 15:22:00 +0000 (18:22 +0300)]
quirks: touchpad quirk for ICL Si1516/Si1512

Exactly the same quirk as for Graviton N15i-k2 and Graviton N15i.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1054>

8 months agoquirks: touchpad quirk for Graviton N15i
Ajrat Makhmutov [Tue, 24 Sep 2024 15:15:01 +0000 (18:15 +0300)]
quirks: touchpad quirk for Graviton N15i

Exactly the same quirk as for Graviton N15i-K2.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1054>

8 months agoCI: skip the valgrind tests for marge-bot
Peter Hutterer [Mon, 30 Sep 2024 13:39:30 +0000 (15:39 +0200)]
CI: skip the valgrind tests for marge-bot

marge-bot rebases and edits the commit message but there's not way for
it to introduce a memleak that wasn't spotted in the user pipeline
first. Since those tests are very flaky, let's skip them when running
the marge-bot pipeline.

Closes #1042

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1057>

8 months agoFix a few potential NULL dereferences
Peter Hutterer [Fri, 20 Sep 2024 11:33:38 +0000 (21:33 +1000)]
Fix a few potential NULL dereferences

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>

8 months agoutil: add a safe version of strlen
Peter Hutterer [Fri, 20 Sep 2024 11:16:20 +0000 (21:16 +1000)]
util: add a safe version of strlen

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>

8 months agoquirks: adjust pressure range for Google Krane, Wormdingler and Coachz
Daniel Fuchs [Tue, 24 Sep 2024 16:07:27 +0000 (16:07 +0000)]
quirks: adjust pressure range for Google Krane, Wormdingler and Coachz

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1055>

8 months agotools: add --set-calibration to the debug-events man page
Peter Hutterer [Wed, 4 Sep 2024 05:26:39 +0000 (15:26 +1000)]
tools: add --set-calibration to the debug-events man page

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1051>

8 months agotest: fix macro grouping in the litest.h header
Peter Hutterer [Mon, 16 Sep 2024 06:08:02 +0000 (16:08 +1000)]
test: fix macro grouping in the litest.h header

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>

8 months agotest: use litest_assert_event_type instead of direct type check
Peter Hutterer [Wed, 18 Sep 2024 04:44:38 +0000 (14:44 +1000)]
test: use litest_assert_event_type instead of direct type check

This provides better debugging logs and is slightly less code in
the checks too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>

8 months agotest: use litest_wait_for_event instead of a NONE event check
Peter Hutterer [Wed, 18 Sep 2024 08:28:26 +0000 (18:28 +1000)]
test: use litest_wait_for_event instead of a NONE event check

Technically we're not really waiting here since we expect the
event to already be there but for these tests the distinction doesn't
matter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>

8 months agotest: fix use of wrong enum for setting clickfinger maps
Peter Hutterer [Wed, 18 Sep 2024 08:37:33 +0000 (18:37 +1000)]
test: fix use of wrong enum for setting clickfinger maps

Hidden by ck_asset_int_eq type-casing everything to intmax_t

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>

8 months agotest: use litest_assert_empty_queue instead of a manual none check
Peter Hutterer [Wed, 18 Sep 2024 04:57:51 +0000 (14:57 +1000)]
test: use litest_assert_empty_queue instead of a manual none check

This provides better debugging printfs and is the now-recommended way to
check this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>

8 months agotest: add litest_dispatch() for better test debugging
Peter Hutterer [Fri, 13 Sep 2024 05:13:38 +0000 (15:13 +1000)]
test: add litest_dispatch() for better test debugging

Wraps libinput_dispatch() with a location which will make things a bit
easier to track. Output (in --verbose) is something like:

  gestures_swipe_3fg_unaccel_fn():1346 - dispatching

Which makes it easier to associate the various calls to libinput
dispatch with the other output from libinput.

This patch switches all uses of libinput_dispatch() in test cases over
but not the litest functions that may call dispatch too. Remains to be
seen if that is necessary.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

8 months agotest: abort on libinput bugs again
Peter Hutterer [Fri, 13 Sep 2024 02:56:28 +0000 (12:56 +1000)]
test: abort on libinput bugs again

This was always intended but a bug prevented the actual abort.
strstr returns NULL when we cannot find the substring so we always
triggered the first noop condition on bugs.

Fixes: bd7b91065b13 ("evdev: warn if our event processing lags by 10ms or more")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

8 months agotest: improve event debugging a bit
Peter Hutterer [Thu, 12 Sep 2024 03:40:44 +0000 (13:40 +1000)]
test: improve event debugging a bit

Add a litest_checkpoint macro and convert a few of the litest_assert
macros to make use of that - this gives us a printf of the call site in
case it fails.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

9 months agotest: highlight the gesture state machine log messages in yellow
Peter Hutterer [Thu, 12 Sep 2024 04:59:38 +0000 (14:59 +1000)]
test: highlight the gesture state machine log messages in yellow

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

9 months agogestures: use a colon-suffixed debug prefix like the other state machines
Peter Hutterer [Thu, 12 Sep 2024 04:59:06 +0000 (14:59 +1000)]
gestures: use a colon-suffixed debug prefix like the other state machines

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

9 months agotest: make litest_wait_for_event_of_type auto-terminating
Peter Hutterer [Wed, 11 Sep 2024 06:23:08 +0000 (16:23 +1000)]
test: make litest_wait_for_event_of_type auto-terminating

Wrap this in a macro so we cannot forget to pass -1

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

9 months agotest: make litest_drain_events_of_type auto-terminating
Peter Hutterer [Wed, 11 Sep 2024 06:19:33 +0000 (16:19 +1000)]
test: make litest_drain_events_of_type auto-terminating

Wrap this in a macro so we cannot forget to pass -1

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>

9 months agotriage-policies: add reminder for info in commit messages
Peter Hutterer [Sun, 8 Sep 2024 23:45:46 +0000 (09:45 +1000)]
triage-policies: add reminder for info in commit messages

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1043>

9 months agotriage-policies: add a blurb for the help-needed label
Peter Hutterer [Sun, 8 Sep 2024 23:38:49 +0000 (09:38 +1000)]
triage-policies: add a blurb for the help-needed label

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1043>

9 months agotools/debug-events: move the event type str to a helper function
Peter Hutterer [Mon, 9 Sep 2024 05:25:52 +0000 (15:25 +1000)]
tools/debug-events: move the event type str to a helper function

This isn't really necessary for the code as-is it makes debugging things
easier.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1044>

9 months agogestures: cancel the hold before initializing the pinch
Peter Hutterer [Tue, 10 Sep 2024 04:44:23 +0000 (14:44 +1000)]
gestures: cancel the hold before initializing the pinch

If we're in state HOLD we have an ongoing hold gesture - make sure we
cancel that one first before we initialize the pinch.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1046>

9 months agotriage-policies: point to the new hid-recorder written in rust
Peter Hutterer [Tue, 10 Sep 2024 02:09:29 +0000 (12:09 +1000)]
triage-policies: point to the new hid-recorder written in rust

It provides a more useful and easier to read report output, so let's go
with that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1045>

9 months agoCI: retry valgrind jobs if they fail
Peter Hutterer [Fri, 6 Sep 2024 04:21:06 +0000 (14:21 +1000)]
CI: retry valgrind jobs if they fail

Our valgrind jobs are very timing-sensitive so it's very common that
they fail with an error when the reason is just valgrind being slower
and we miss a deadline somewhere.

Retry them if they fail, hopefully that gives us more reliable
pipelines.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1040>

9 months agotools/debug-events: add ability to compress motion events
Peter Hutterer [Fri, 6 Sep 2024 04:45:30 +0000 (14:45 +1000)]
tools/debug-events: add ability to compress motion events

If --compress-motion-events is given (and stdout is a tty) reduce
the output printed to one line per repeated motion/axis/scroll sequence
(with a count). Example output:
 event6   POINTER_MOTION          108 +1.912s  1.00/ -1.00 ( +1.00/ -1.00))
 event6   POINTER_BUTTON              +2.008s BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_BUTTON              +2.074s BTN_LEFT (272) released, seat count: 0
 event6   POINTER_MOTION           39 +5.249s  0.00/  0.99 ( +0.00/ +1.00)
 event6   POINTER_BUTTON              +5.385s BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_MOTION           66 +6.031s -1.00/  0.00 ( -1.00/ +0.00)
 event6   POINTER_BUTTON              +6.401s BTN_LEFT (272) released, seat count: 0

The event count (108, 39 and 66) is only printed for more than one event
in sequence so the output is otherwise identical (but 4 spaces wider
now)

If stdout is not a tty the event count is printed but no compression
happens since we rely on a ansi escape sequence for that. Could be fixed
by changing the current print statements to print a \n before the
current event instead of at the end of the current line.

This makes debugging events easier as button events and similar are no
longer obscured by pages of motion events in between.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>

9 months agotools/debug-events: ignore old-style pointer axis events completely
Peter Hutterer [Mon, 9 Sep 2024 05:30:05 +0000 (15:30 +1000)]
tools/debug-events: ignore old-style pointer axis events completely

Since they're interleaved with the more modern finger/wheel/continuous
events they mess up our repeate count, preventing compression for those
events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>

9 months agodoc/api: fix wrong references to the tap drag config
Peter Hutterer [Fri, 6 Sep 2024 01:28:30 +0000 (11:28 +1000)]
doc/api: fix wrong references to the tap drag config

It's _tap_get_drag_, not _tap_drag_get_ (and same for set/get_default)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1039>

9 months agoquirks: allow for parsing multiple products
Peter Hutterer [Fri, 30 Aug 2024 04:48:45 +0000 (14:48 +1000)]
quirks: allow for parsing multiple products

This allows for a slight optimization of the quirks parser: where
multiple devices from the same vendor require the same quirk, allow
for multiple product matches in the form:

MatchProduct=0x0001;0x0002;

This is stored as a fixed-sized zero-terminated array - a product ID of
zero isn't something we need to worry about in real situations.

Closes #879

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>

9 months agoutil: add a strv_for_each helper function
Peter Hutterer [Tue, 3 Sep 2024 04:31:02 +0000 (14:31 +1000)]
util: add a strv_for_each helper function

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>

9 months agotouchpad: add sticky mode to drag-lock
satrmb [Mon, 2 Sep 2024 14:29:02 +0000 (16:29 +0200)]
touchpad: add sticky mode to drag-lock

Sticky mode removes the timeout from drag-lock, only a tap ends a drag.
Timeout mode remains available without changes.

Sticky mode is exposed as a new value for the existing drag-lock setting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1037>

9 months agoCI: Run pre-commit hooks
José Expósito [Sat, 31 Aug 2024 16:42:58 +0000 (18:42 +0200)]
CI: Run pre-commit hooks

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>

9 months agoFix pre-commit errors
José Expósito [Sat, 31 Aug 2024 16:46:07 +0000 (18:46 +0200)]
Fix pre-commit errors

Some files had pre-commit style issues. Fix them.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>

9 months agoUpdate quirks for HP Dragonfly Chromebook
Tim Hanson [Fri, 30 Aug 2024 05:00:48 +0000 (05:00 +0000)]
Update quirks for HP Dragonfly Chromebook

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1034
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1033>

9 months agoquirks: add quirk for Razer Blade 142024 Keyboard
Peter Hutterer [Thu, 22 Aug 2024 09:25:57 +0000 (19:25 +1000)]
quirks: add quirk for Razer Blade 142024 Keyboard

Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1031>

9 months agotriage-policies: add an entry for pointing users to 60-evdev.hwdb
Peter Hutterer [Mon, 26 Aug 2024 04:42:51 +0000 (14:42 +1000)]
triage-policies: add an entry for pointing users to 60-evdev.hwdb

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1032>

9 months agolibinput 1.26.2 1.26.2
Peter Hutterer [Sun, 18 Aug 2024 23:26:17 +0000 (09:26 +1000)]
libinput 1.26.2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 months agotablet: Remove unnecessary scale factor on REL_HWHEEL_HI_RES
Jason Gerecke [Mon, 29 Jul 2024 22:46:57 +0000 (22:46 +0000)]
tablet: Remove unnecessary scale factor on REL_HWHEEL_HI_RES

The two high-res axes should already be scaled appropriately by the
kernel. This unnecessary scale factor causes 1 click of the dial to
produce an event delta of +-14400 rather than the expected +-120.

Fixes: beca99812208 ("tablet: add API for relative dials")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1029>

10 months agoquirks: add quirk for Minisforum V3 touchpad dwt
Jami Kettunen [Sat, 20 Jul 2024 17:42:43 +0000 (20:42 +0300)]
quirks: add quirk for Minisforum V3 touchpad dwt

Disable while typing didn't work since the detachable (USB)
keyboard/touchpad case weren't being considered as one unit; mark the
keyboard as internal to correct this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1028>

10 months agodoc/user: fix a typo
Peter Hutterer [Fri, 19 Jul 2024 00:07:30 +0000 (10:07 +1000)]
doc/user: fix a typo

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1027>

11 months agoquirks: add quirk for the Minisforum V3 volume keys
Jami Kettunen [Sun, 7 Jul 2024 18:39:19 +0000 (21:39 +0300)]
quirks: add quirk for the Minisforum V3 volume keys

They didn't work without the keyboard case also being attached to the
tablet PC.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1026>