platform/upstream/libinput.git
5 months agolibinput 1.27.1 tizen_work_20250204 upstream upstream_work_20250204 1.27.1 upstream/1.27.1
Peter Hutterer [Mon, 6 Jan 2025 04:05:01 +0000 (14:05 +1000)]
libinput 1.27.1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 months agoCI: bump to Fedora 41
Peter Hutterer [Mon, 23 Dec 2024 03:09:47 +0000 (13:09 +1000)]
CI: bump to Fedora 41

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

5 months agoFix two scan-build warnings that appear on F41
Peter Hutterer [Mon, 23 Dec 2024 07:13:06 +0000 (17:13 +1000)]
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>

5 months agotools/libinput-replay: use list comprehension instead of append
Peter Hutterer [Fri, 20 Dec 2024 00:34:33 +0000 (10:34 +1000)]
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>

5 months agotools/libinput-replay: interrupt only the ongoing event sequence with ctrl+c
Peter Hutterer [Thu, 19 Dec 2024 01:48:49 +0000 (11:48 +1000)]
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>

5 months agoquirks: Add quirk for Google Chromebook Banshee
WeirdTreeThing [Fri, 20 Dec 2024 17:36:50 +0000 (12:36 -0500)]
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>

5 months agogestures: change the debug log messages for state debugging
Peter Hutterer [Fri, 20 Dec 2024 01:16:36 +0000 (11:16 +1000)]
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>

5 months agogestures: use a macro for debugging transition states
Peter Hutterer [Fri, 20 Dec 2024 01:04:41 +0000 (11:04 +1000)]
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>

5 months agotools/debug-gui: color the fingers with different colors
Peter Hutterer [Thu, 19 Dec 2024 03:51:42 +0000 (13:51 +1000)]
tools/debug-gui: color the fingers with different colors

Follow-up to commit 713892c162f0 ("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>

5 months agoquirks: the Wacom Bamboo 2FG 6x8 is a semi-mt touchpad
Peter Hutterer [Thu, 19 Dec 2024 04:01:51 +0000 (14:01 +1000)]
quirks: the Wacom Bamboo 2FG 6x8 is a semi-mt touchpad

See #919

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

5 months agotriage-policies: fix the hwdb.d directory
Peter Hutterer [Wed, 18 Dec 2024 22:18:54 +0000 (08:18 +1000)]
triage-policies: fix the hwdb.d directory

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

5 months agotriage-policies: add an entry to punt to udev-hid-bpf
Peter Hutterer [Thu, 19 Dec 2024 04:23:29 +0000 (14:23 +1000)]
triage-policies: add an entry to punt to udev-hid-bpf

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

5 months agogestures: fix transformation of scroll to pinch
Joshua Noeske [Wed, 18 Dec 2024 14:50:50 +0000 (15:50 +0100)]
gestures: fix transformation of scroll to pinch

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

5 months agotools: only warn once about our lack of support for multiple fingers
Peter Hutterer [Mon, 16 Dec 2024 01:52:18 +0000 (11:52 +1000)]
tools: only warn once about our lack of support for multiple fingers

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

5 months agotouchpad: init the thumb size threshold to INT_MAX
Peter Hutterer [Mon, 16 Dec 2024 01:59:47 +0000 (11:59 +1000)]
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>

5 months agotools/libinput-replay: print a separator line for EV_SYN events
Peter Hutterer [Tue, 17 Dec 2024 00:49:25 +0000 (10:49 +1000)]
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>

5 months agotriage-policies: default close after pointing the user to 60-evdev.hwdb
Peter Hutterer [Tue, 17 Dec 2024 05:35:27 +0000 (15:35 +1000)]
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>

5 months agotriage-policies: add missing "actions" for the bugbot::evdev-hwdb
Peter Hutterer [Wed, 18 Dec 2024 01:11:18 +0000 (11:11 +1000)]
triage-policies: add missing "actions" for the bugbot::evdev-hwdb

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

5 months agotriage-policies: update the bugbot::close wording and link to the wiki
Peter Hutterer [Mon, 16 Dec 2024 00:34:29 +0000 (10:34 +1000)]
triage-policies: update the bugbot::close wording and link to the wiki

Now that we have a wiki page let's link to it, it has all the details
on how and why we (plan to) do this.

Also change the wording to be make it easier to anthropomorphize bugbot
when it adds that comment, ideally leading to fewer grumpy users.

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

5 months agoAdd examples with other thresholds to the documentation
Salvo 'LtWorf' Tomaselli [Wed, 11 Dec 2024 20:29:28 +0000 (21:29 +0100)]
Add examples with other thresholds to the documentation

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

6 months agotriage-policies: add missing actions line
Peter Hutterer [Wed, 11 Dec 2024 08:57:29 +0000 (18:57 +1000)]
triage-policies: add missing actions line

Fixes: 85ec33f802ad ("triage-policies: add a bugbot command for closing bugs")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1091>

6 months agotriage-policies: add a bugbot command for closing bugs
Peter Hutterer [Wed, 11 Dec 2024 04:41:25 +0000 (14:41 +1000)]
triage-policies: add a bugbot command for closing bugs

We have labels like needinfo or triage needed but all these labels
require intervention from a privileged user - normal users cannot
set labels on a project.

The only thing users can all do is open/close/re-open bugs. So let's try
to incorporate this into our event flow: if we need something from the
user we ask for it, close the bug and when the user supplies this
information they can re-open it. This means e.g. bugs waiting forever in
triage will not show up as actionable in the issue list.

Since users aren't used to that workflow let's add a bugbot blurb that
explains that we're not really closing the issue, just using that as the
only lever we have available.

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

6 months agotools/measure-touchpad-pressure: require max > min for a range
Peter Hutterer [Mon, 9 Dec 2024 22:08:50 +0000 (08:08 +1000)]
tools/measure-touchpad-pressure: require max > min for a range

Otherwise a resulting quirk will fail when parsed by libinput which
enforces this too.

Closes #1060

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

6 months agogestures: don't handle SWIPE if we transitioned from SWIPE_START
Peter Hutterer [Thu, 5 Dec 2024 03:09:43 +0000 (13:09 +1000)]
gestures: don't handle SWIPE if we transitioned from SWIPE_START

If we get to SWIPE_START we send out the BEGIN event and transition to
state SWIPE. We must not process that state immediately to avoid sending
out a spurious UPDATE event when nothing has changed.

Same for the PINCH_START/PINCH and SCROLL_START/SCROLL states.

This also fixes a crasher where we end up with NaN in the custom
acceleration function because passing the same timestamp in twice causes
a division by zero (delta time is zero).

Closes #1053

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

6 months agopre-commit-hooks v5.0.0
andeston [Tue, 3 Dec 2024 07:17:06 +0000 (02:17 -0500)]
pre-commit-hooks v5.0.0

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

6 months agoruff-pre-commit v0.8.1
andeston [Tue, 3 Dec 2024 07:16:04 +0000 (02:16 -0500)]
ruff-pre-commit v0.8.1

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

6 months agoUpdate b2c sha
andeston [Tue, 3 Dec 2024 07:10:09 +0000 (02:10 -0500)]
Update b2c sha

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

6 months agoCI: update to latest ci-templates
Peter Hutterer [Tue, 3 Dec 2024 23:02:55 +0000 (09:02 +1000)]
CI: update to latest ci-templates

This allows for gitlab private emails in commit messages.

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

6 months agotouchpad: remove assert that may trigger during a race condition
Peter Hutterer [Sun, 24 Nov 2024 10:36:18 +0000 (20:36 +1000)]
touchpad: remove assert that may trigger during a race condition

There appears to be a race condition where an ABS_MT_TRACKING_ID -1
event is on the wire but libevdev_fetch_slot_value() for that slot
already gives us -1 as well.

If we just (re)opened our device, synching our slots would thus set zero
active slots and then trigger the assert when that event is being
processed.

It's unclear how to reliably reproduce this issue but removing the
assert and simply ignoring this event if we don't have active slots
is correct anyway.

Closes #1050

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

6 months agoquirks: lower AttrTrackpointMultiplier for ThinkPad X200s/201s to 0.25
Mingcong Bai [Sun, 1 Dec 2024 14:56:20 +0000 (22:56 +0800)]
quirks: lower AttrTrackpointMultiplier for ThinkPad X200s/201s to 0.25

Follow commit 65b53f82ff9f ("quirks: lower AttrTrackpointMultiplier for
ThinkPad X200/201 to 0.25") and lower this multiplier for Lenovo ThinkPad
X200s/201s models, as I found the identical issue as the one previously
quirked for ThinkPad X200/201.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1084>

6 months agoquirks: add pressure pad quirk for Lenovo ThinkBook 14 G6+ IMH
xzl [Thu, 28 Nov 2024 07:41:42 +0000 (15:41 +0800)]
quirks: add pressure pad quirk for Lenovo ThinkBook 14 G6+ IMH

The ThinkBook 14 G6+ IMH also has the same issue as the ThinkBook 14 G7+ ASP.

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

6 months agolibinput 1.27.0 1.27.0
Peter Hutterer [Tue, 19 Nov 2024 03:41:21 +0000 (13:41 +1000)]
libinput 1.27.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 months agoquirks: lower AttrTrackpointMultiplier for ThinkPad X200/201 to 0.25
Mingcong Bai [Thu, 14 Nov 2024 13:57:52 +0000 (21:57 +0800)]
quirks: lower AttrTrackpointMultiplier for ThinkPad X200/201 to 0.25

Upstream commit 43cd2cbf83e0 ("data: add the dell trackpoint multipliers")
broke the default acceleration profile on Lenovo ThinkPad X200/201, where
the cursor speeds became so quick that it was practically impossible to
control. Merely dragging on the TrackPoint lightly would result in the
cursor flying from corner-to-corner.

I have tested on a Lenovo ThinkPad X201 to find
`AttrTrackpointMultiplier=0.25' the most reasonable and closest to the
default behaviour on Windows 7 with Lenovo's driver.

Not sure about ThinkPad X200s/201s, but I suspect that they would have
similar issues (with the multiplier set to 1.25). I have just ordered both
models to experiment with and will report back with another patch if I
find similar issue.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1080>

7 months agoquirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ ASP
Mingcong Bai [Tue, 12 Nov 2024 03:29:27 +0000 (11:29 +0800)]
quirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ ASP

Some Lenovo ThinkBook 14 G7+ ASP models ship with pressure pads (nominally
"Force Pad"). However, they do not appear to be declared as such by the
firmware.

Add a quirk to make them work.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1079>

7 months agozsh: update completion to include latest debug-events options
Peter Hutterer [Mon, 4 Nov 2024 21:52:18 +0000 (07:52 +1000)]
zsh: update completion to include latest debug-events options

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

7 months agozsh: sort the debug-events argument (mostly) alphabetically
Peter Hutterer [Mon, 4 Nov 2024 21:45:10 +0000 (07:45 +1000)]
zsh: sort the debug-events argument (mostly) alphabetically

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

7 months agotablet: ignore movements started outside the configured area
Peter Hutterer [Fri, 1 Nov 2024 04:30:51 +0000 (14:30 +1000)]
tablet: ignore movements started outside the configured area

If a tablet has an area configured and the pen goes into proximity
outside this area, ignore all events from this sequence. This truly
deactivates that area so it can even be used for e.g. placing a pen
there.

For simplicity, a sequence that starts outside the configured area will
be completely ignored, i.e. moving into the tablet area will not trigger
any fake proximity events as we cross into the allowed area. This
requires quite a bit of effort and it's unclear if it's really needed by
users - we can reconsider when we get complaints.

We do however accept a proximity event within within 3% of the
configured area.  This gives us 6mm on a 200mm tablet where we can move
in from the area and still have events work, i.e. some error margin for
where a user needs both an area and work closes to the edge of that
area.

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

7 months agotablet: implement support for area configuration for external tablets
Peter Hutterer [Thu, 13 Jun 2024 00:31:37 +0000 (10:31 +1000)]
tablet: implement support for area configuration for external tablets

For external tablets like the Intuos series we now expose the area
rectangle configuration and the (minimum) implementation required to
make this work.

Because an area configuration may apply late and tablet events usually
get scaled by the compositor we need to store the current axis extents
in each event. This is to behave correctly in this events sequence:

1. tool proximity in
2. caller changes config, config is pending
3. tool moves, generates events
4. tool goes out of prox, new config applies
5. caller processes motion events from step 3

If the caller in step five uses any of the get_x_transformed calls these
need to be scaled relative to the original area, not the one set in
step 2.

The current implementation merely clips into the area so moving a stylus
outside the area will be equivalent to moving it along the respective
edge of the area. It's not a true dead zone yet.

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

7 months agoAdd tablet area configuration
Peter Hutterer [Wed, 12 Jun 2024 23:00:21 +0000 (09:00 +1000)]
Add tablet area configuration

This adds the configuration option to define a rectangle that serves as
an input area on external tablets such as an Intuos.

The intention behind this is to make this input area behave as if it was
the only physical input area on this tablet with libinput emulating
proximity events as required for where the tools moves in and out
of this area.

This could also be achieved with the existing calibration setting but
area configuration is not calibration and we don't want to expose other
side-effects of the matrix (e.g. scaling and rotation) for these
devices.

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

7 months agotablet: use our absinfo_x/y struct instead of the libevdev one
Peter Hutterer [Fri, 14 Jun 2024 00:36:59 +0000 (10:36 +1000)]
tablet: use our absinfo_x/y struct instead of the libevdev one

device->abs.absinfo_x/y points to the x/y axis we want to use and
that axis is used in all the evdev helper function. For consistency
use that one here too.

This is for consistency only and has no effect on tablet devices, the
only time this isn't ABS_X/Y is on multitouch devices where that points to
ABS_MT_POSITION_X/Y.

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

7 months agoMove evdev_convert_to_mm to a more generic helper
Peter Hutterer [Thu, 13 Jun 2024 04:10:06 +0000 (14:10 +1000)]
Move evdev_convert_to_mm to a more generic helper

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

7 months agoMove scale_axis to a utility header so we can re-use it better
Peter Hutterer [Thu, 13 Jun 2024 03:09:44 +0000 (13:09 +1000)]
Move scale_axis to a utility header so we can re-use it better

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

7 months agotools/debug-events: print bugs in bold red
Peter Hutterer [Fri, 1 Nov 2024 06:00:12 +0000 (16:00 +1000)]
tools/debug-events: print bugs in bold red

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

7 months agoeditorconfig: add settings for sym files
José Expósito [Mon, 4 Nov 2024 09:25:00 +0000 (10:25 +0100)]
editorconfig: add settings for sym files

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

7 months agotools: sort the options in debug-events match page
Peter Hutterer [Mon, 4 Nov 2024 05:48:21 +0000 (15:48 +1000)]
tools: sort the options in debug-events match page

We now have enough config options that having them unsorted makes it
hard to find the right option.

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

7 months agotablet: default to a built-in tablet
Peter Hutterer [Tue, 29 Oct 2024 10:17:00 +0000 (20:17 +1000)]
tablet: default to a built-in tablet

The vast majority of devices that libwacom doesn't know about are the
various built-in ones. Since the only effect in our code here is that we
enable the calibration matrix, let's default to built-in if we don't
know any better - better to have the matrix and not use it than to not
be able to calibrate a tablet.

Note that libwacom 2.11 and later also now default to a built-in tablet.

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

7 months agotest: fix two race conditions waiting for proximity events
Peter Hutterer [Thu, 31 Oct 2024 05:10:11 +0000 (15:10 +1000)]
test: fix two race conditions waiting for proximity events

This test does a prox in/out and immediately drains events.
Where we are slow enough we may drain only one (or none) of the
proximity events which causes a failure later in the test.

Similar issue with the second test where we may get a delayed tip event.

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

7 months agotablet: centralize the libwacom handling
Peter Hutterer [Mon, 28 Oct 2024 23:46:05 +0000 (09:46 +1000)]
tablet: centralize the libwacom handling

Instead of re-creating the the libwacom device from the database every
time we need it let's create it once during tablet|pad_init and pass it
down to the functions.

This allows us to have one point per tablet/pad where we can log an
error if the device is not supported by libwacom - previously this was
printed during the left-handed setup.

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

7 months agotablet: minor rework to remove one ifdef HAVE_LIBWACOM
Peter Hutterer [Mon, 28 Oct 2024 23:23:09 +0000 (09:23 +1000)]
tablet: minor rework to remove one ifdef HAVE_LIBWACOM

Change to a boolean for more obvious return values and move the ifdef
into the function so we can skip the ifdef in the caller.

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

7 months agopad: support dial modeswitch buttons
Peter Hutterer [Mon, 28 Oct 2024 01:46:27 +0000 (11:46 +1000)]
pad: support dial modeswitch buttons

This requires unreleased updates to libwacom [1], currently hiding
behind an ifdef so we don't require that particular version.

[1] https://github.com/linuxwacom/libwacom/pull/805

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

7 months agopad: rework the tablet pad mode setup
Peter Hutterer [Thu, 24 Oct 2024 05:47:02 +0000 (15:47 +1000)]
pad: rework the tablet pad mode setup

This was historically based on the LEDs on the device: we'd loop through
the LEDs and assign them to pad mode groups, then figure out which
button is the mode toggle for that group and finally which buttons
are in the same position as that toggle button.

Devices like the XP Pen ACK05 Remote don't have LEDs though but they do
have a mode toggle button [1] inside the dial. Let's support those by
switching the initialization on its head: search for mode toggle
buttons, create a mode group per toggle button, then associate
LEDs with that group.

The outcome should be functionally the same for devices with LEDs but
allows us to create mode groups where no LEDs exist.

Closes #1045

[1] As per Windows default button behavior

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

7 months agopad: don't clobber the errno if the pad led failed to initialize
Peter Hutterer [Thu, 24 Oct 2024 04:47:38 +0000 (14:47 +1000)]
pad: don't clobber the errno if the pad led failed to initialize

pad_led_destroy() may call something that sets errno, so let's protect
against that.

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

7 months agopad: remove an unused argument
Peter Hutterer [Thu, 24 Oct 2024 04:27:30 +0000 (14:27 +1000)]
pad: remove an unused argument

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

7 months agopad: rename an argument for more clarity
Peter Hutterer [Wed, 23 Oct 2024 02:49:35 +0000 (12:49 +1000)]
pad: rename an argument for more clarity

Yes, we're using the LED count here but what it is used for is the
number of modes.

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

7 months agotest: mark the pad group tests as basically broken by expectation
Peter Hutterer [Thu, 24 Oct 2024 10:17:27 +0000 (20:17 +1000)]
test: mark the pad group tests as basically broken by expectation

Since our implementation uses the sysfs LED files and we don't have
those, all our test devices have the single fallback mode and no
more. Add a comment to all these tests to make that clear and enforce a
single mode only so it's more obvious.

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

7 months agotest: fix 3 compiler warnings when building without libwacom
Peter Hutterer [Mon, 28 Oct 2024 05:56:33 +0000 (15:56 +1000)]
test: fix 3 compiler warnings when building without libwacom

signed/unsigned and an unused variable.

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

7 months agotest: fix strip values being passed to ring functions
Peter Hutterer [Mon, 28 Oct 2024 05:54:05 +0000 (15:54 +1000)]
test: fix strip values being passed to ring functions

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

7 months agoCI: collect valgrind log files too
Peter Hutterer [Mon, 21 Oct 2024 03:35:00 +0000 (13:35 +1000)]
CI: collect valgrind log files too

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

7 months agotest: add --output-file to print test logs to a file
Peter Hutterer [Mon, 21 Oct 2024 02:12:45 +0000 (12:12 +1000)]
test: add --output-file to print test logs to a file

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

7 months agotest: drop the --xml-prefix option
Peter Hutterer [Mon, 21 Oct 2024 02:08:00 +0000 (12:08 +1000)]
test: drop the --xml-prefix option

litest-runner outputs in YAML and no-one ever looks at the XML files
anyway. They are used to provide nice pipeline summaries but again,
no-one looks at those because they're not very useful.

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

7 months agoCI: disable forking for valgrind tests
Peter Hutterer [Mon, 21 Oct 2024 01:12:58 +0000 (11:12 +1000)]
CI: disable forking for valgrind tests

With the new test suite runner we get one fork per test which will
eventually slow down valgrind enough so our tests fail.

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

7 months agotest: add --filter-rangeval to only run tests with a range value
Peter Hutterer [Wed, 16 Oct 2024 23:04:36 +0000 (09:04 +1000)]
test: add --filter-rangeval to only run tests with a range value

For ranged tests (e.g. gesture tests) it's convenient to be able to run
those with a value of N (e.g. 3 fingers) instead ov having to run all of
them all the time.

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

7 months agotest: add ability to collect test results from a nonforking test
Peter Hutterer [Wed, 16 Oct 2024 22:29:22 +0000 (08:29 +1000)]
test: add ability to collect test results from a nonforking test

Use longjmp to try to get out of a test error. This will only work for
errors triggered by our own test suite (i.e. not for SIGSEGV and
friends) but that's good enough for most things.

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

7 months agotest: move the quirks setup into the global setup func
Peter Hutterer [Wed, 16 Oct 2024 08:31:51 +0000 (18:31 +1000)]
test: move the quirks setup into the global setup func

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

7 months agotest: add runner support for a global setup/teardown func
Peter Hutterer [Wed, 16 Oct 2024 08:31:35 +0000 (18:31 +1000)]
test: add runner support for a global setup/teardown func

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

7 months agotest: the created files list doesn't need to be a global
Peter Hutterer [Wed, 16 Oct 2024 01:08:41 +0000 (11:08 +1000)]
test: the created files list doesn't need to be a global

This list was used in the signal handler but that is no longer the case,
so let's localize this.

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

7 months agotest: move the rest of the custom initialization to litest_run
Peter Hutterer [Wed, 16 Oct 2024 01:04:08 +0000 (11:04 +1000)]
test: move the rest of the custom initialization to litest_run

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

7 months agotest: move tty disabling closer to the actual running of the tests
Peter Hutterer [Wed, 16 Oct 2024 01:02:21 +0000 (11:02 +1000)]
test: move tty disabling closer to the actual running of the tests

And move the litest-specific condition out into the caller so
disable_tty() only cares about the TTY, not any surrounding conditions.

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

7 months agotest: only force gdb to no-fork, valgrind can fork
Peter Hutterer [Tue, 15 Oct 2024 09:27:39 +0000 (19:27 +1000)]
test: only force gdb to no-fork, valgrind can fork

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

7 months agotest: intercept and collect valgrind errors
Peter Hutterer [Tue, 15 Oct 2024 07:05:06 +0000 (17:05 +1000)]
test: intercept and collect valgrind errors

This works because we always invoke with --exit-errorcode=3 from the
test suite. It won't work for manual invocations but oh well.

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

7 months agotest: move litest_free_test_list to inside ifndef NO_MAIN
Peter Hutterer [Tue, 15 Oct 2024 05:47:19 +0000 (15:47 +1000)]
test: move litest_free_test_list to inside ifndef NO_MAIN

This is now only called from one spot, so let's move it so it is
ifdef'd out.

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

7 months agotest: make the utils test a "pure" litest-runner test
Peter Hutterer [Tue, 15 Oct 2024 05:46:07 +0000 (15:46 +1000)]
test: make the utils test a "pure" litest-runner test

Now that we have the runner let's use it directly for this set of simple
test.

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

7 months agotest: add --exit-first to the litest test suite runner
Peter Hutterer [Tue, 15 Oct 2024 05:28:56 +0000 (15:28 +1000)]
test: add --exit-first to the litest test suite runner

Exits upon the first failed test.

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

7 months agotest: remove now-unused check-double-macros.h
Peter Hutterer [Sat, 12 Oct 2024 10:24:44 +0000 (20:24 +1000)]
test: remove now-unused check-double-macros.h

We no longer use those functions, so let's drop them.

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

7 months agotest: move the quirks context init into litest_run
Peter Hutterer [Wed, 16 Oct 2024 01:18:24 +0000 (11:18 +1000)]
test: move the quirks context init into litest_run

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

7 months agotest: add litest-runner as test suite runner
Peter Hutterer [Sat, 12 Oct 2024 00:31:42 +0000 (10:31 +1000)]
test: add litest-runner as test suite runner

This replaces check. The code is a copy of pwtest which I wrote years
ago for pipewire but adjusted for us here the last few days.

There are a few advantages over check:
- Ability to SKIP tests or mark them as NOT_APPLICABLE, the latter
  of which is used for early checks if a device doesn't meet
  requirements.
- it captures stdout/stderr separately
- colors!
- YAML output format makes it a lot easier to read the results and
  eventually parse them for e.g. "restart failed tests"

Less abstraction: we set up the tests, pass them to the runner and run
them with the given number of forks. This is an improvement over before
where we forked into N test suites which each called check which then
forked again. Since we're now keeping track of those processes
ourselves we can also write tests that are expected to fail with
signals.

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

7 months agotest: fix utils test for types for litest assertions
Peter Hutterer [Sat, 12 Oct 2024 10:31:11 +0000 (20:31 +1000)]
test: fix utils test for types for litest assertions

check always typecasts to intmax_t so a lot of type mismatches were
hidden.

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

7 months agotest: convert utils test to litest_assert
Peter Hutterer [Sat, 12 Oct 2024 10:32:34 +0000 (20:32 +1000)]
test: convert utils test to litest_assert

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

7 months agotest: make the utils test another litest
Peter Hutterer [Sat, 12 Oct 2024 10:20:14 +0000 (20:20 +1000)]
test: make the utils test another litest

This doesn't really gain us anything for now but it's prep work for
dropping check and the custom invocations of check.

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

7 months agoutil: add a generic stringbuffer with a few helper functions
Peter Hutterer [Fri, 11 Oct 2024 05:52:04 +0000 (15:52 +1000)]
util: add a generic stringbuffer with a few helper functions

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

7 months agoutil: add the range handling as separate header file
Peter Hutterer [Mon, 14 Oct 2024 04:39:07 +0000 (14:39 +1000)]
util: add the range handling as separate header file

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

7 months agotest: move the deviceless check into ltest_add_tcase
Peter Hutterer [Wed, 16 Oct 2024 01:21:29 +0000 (11:21 +1000)]
test: move the deviceless check into ltest_add_tcase

This is out of place here, check this when we are about
to add the test, not later when the tests are about to be run.

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

7 months agotest: filter out duplicate name/device combos in --list
Peter Hutterer [Sun, 13 Oct 2024 23:24:26 +0000 (09:24 +1000)]
test: filter out duplicate name/device combos in --list

This doesn't have an effect yet because ranged tests are handled inside
check. But in the future these tests will be split up individually so
de-duplicating is useful here.

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

7 months agotest: make litest_backtrace() available from outside litest.c
Peter Hutterer [Sat, 12 Oct 2024 00:35:29 +0000 (10:35 +1000)]
test: make litest_backtrace() available from outside litest.c

Prep-work for adding a new runner

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

7 months agotest: append, not insert the suites
Peter Hutterer [Thu, 17 Oct 2024 01:45:22 +0000 (11:45 +1000)]
test: append, not insert the suites

list_append() came later than list_insert() and there's an argument to
be made that tests added later should be run first since they're less
likely to succeed. But it's a lot harder to read test logs when they are
in reverse order, and with the TEST_COLLECTION() macro the order of the
test suite is not obvious anyway.

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

7 months agoutil: add a bunch more time conversions
Peter Hutterer [Mon, 21 Oct 2024 01:07:34 +0000 (11:07 +1000)]
util: add a bunch more time conversions

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

7 months agoutil: move libinput_now() into a utility function
Peter Hutterer [Mon, 21 Oct 2024 01:07:14 +0000 (11:07 +1000)]
util: move libinput_now() into a utility function

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

7 months agoutil: add xclose(fd) to close-and-reset an fd
Peter Hutterer [Tue, 15 Oct 2024 01:52:12 +0000 (11:52 +1000)]
util: add xclose(fd) to close-and-reset an fd

This prevents accidentally leaving the fd set after closing.

And it includes the -1 check so we don't need this everywhere ourselves
(not that we use it right now but valgrind likes to complain about
this).

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

7 months agopre-commit: drop black, use ruff-format instead
Peter Hutterer [Tue, 29 Oct 2024 03:25:20 +0000 (13:25 +1000)]
pre-commit: drop black, use ruff-format instead

And switch to the current-ish version of the ruff pre-commit hook,
including updating the repo.

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

7 months agotools: change direct type check to isinstance
Peter Hutterer [Tue, 29 Oct 2024 03:26:57 +0000 (13:26 +1000)]
tools: change direct type check to isinstance

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

7 months agoutil: make a float to int conversion explicit
Peter Hutterer [Wed, 19 Jun 2024 23:50:15 +0000 (09:50 +1000)]
util: make a float to int conversion explicit

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

7 months agoutil: add the backtrace printing function as separate util
Peter Hutterer [Sun, 20 Oct 2024 23:16:04 +0000 (09:16 +1000)]
util: add the backtrace printing function as separate util

Might as well make this easier to re-use since it doesn't do anything
specific to litest.

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

7 months agopad: default a pad group to mode 0 if all LEDs are off
Peter Hutterer [Tue, 22 Oct 2024 05:03:09 +0000 (15:03 +1000)]
pad: default a pad group to mode 0 if all LEDs are off

Since our API doesn't accomodate for "dunno" we need to pick a mode that
we are actually in. This happens on the Intuos Pro 2 (PTH-660) which has
all LEDs on brightness zero, resulting in a failure to set up the modes
and we're left without a mode button.

Fix it by just picking zero as the default mode until specified
otherwise.

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

7 months agopad: move a function to save on an ifdef
Peter Hutterer [Tue, 22 Oct 2024 03:34:46 +0000 (13:34 +1000)]
pad: move a function to save on an ifdef

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

7 months agopad: don't print a clobbered errno
Peter Hutterer [Tue, 22 Oct 2024 02:15:04 +0000 (12:15 +1000)]
pad: don't print a clobbered errno

is_litest_device() may change errno since it calls into libudev.

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

7 months agotools: print full pad mode group info in libinput-list-devices
Peter Hutterer [Tue, 22 Oct 2024 01:55:09 +0000 (11:55 +1000)]
tools: print full pad mode group info in libinput-list-devices

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

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>