platform/upstream/libinput.git
3 years agotouchpad: a touchpad with only one button is a clickpad
Peter Hutterer [Wed, 14 Apr 2021 05:18:13 +0000 (15:18 +1000)]
touchpad: a touchpad with only one button is a clickpad

There is only one touchpad with a physical left button but no right button and
that is the old Apple touchpad, discontinued in 2008. Not a huge number of
those left, I assume.

So let's change our assumptions because these days the vast majority of
touchpads are clickpads - any touchpad that only has a left button is treated
as clickpad, even where the kernel doesn't set the INPUT_PROP_BUTTONPAD.

We do need to check for BTN_LEFT as well though, because Wacom touchpads (i.e.
the touch part of non-integrated Wacom tablets) don't have a left button
either.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotouchpad: use some helper variables to make the code easier to read
Peter Hutterer [Wed, 14 Apr 2021 06:26:21 +0000 (16:26 +1000)]
touchpad: use some helper variables to make the code easier to read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotouchpad: factor out clickpad assignment to a helper
Peter Hutterer [Wed, 14 Apr 2021 06:18:21 +0000 (16:18 +1000)]
touchpad: factor out clickpad assignment to a helper

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoquirks: add quirk for Lenovo Yoga Slim 9 Touchpad
Udo Rader [Tue, 20 Apr 2021 02:15:03 +0000 (02:15 +0000)]
quirks: add quirk for Lenovo Yoga Slim 9 Touchpad

This touchpad is a pressure pad and needs the pressure
handling disabled.

Fixes #604

Signed-off-by: Udo Rader <udo.rader@bestsolution.at>
3 years agoquirks: add palm size quirk for the Gigabyte Aero 15
Peter Hutterer [Wed, 14 Apr 2021 05:04:39 +0000 (15:04 +1000)]
quirks: add palm size quirk for the Gigabyte Aero 15

Fixes #599

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogestures: move the logic to detect gestures to its own function
JoseExposito [Wed, 7 Apr 2021 16:23:06 +0000 (18:23 +0200)]
gestures: move the logic to detect gestures to its own function

Move the code in used to detect motion based gestures (scroll, swipe and pinch)
to tp_gesture_detect_motion_gestures.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agogestures: move up some functions to use them later
JoseExposito [Mon, 29 Mar 2021 15:31:46 +0000 (17:31 +0200)]
gestures: move up some functions to use them later

Move tp_gesture_same_directions, tp_gesture_mm_moved and tp_gesture_init_pinch
to be able to use them in future commits.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agogestures: move the code to get raw pointer motion to its own function
JoseExposito [Wed, 7 Apr 2021 15:50:56 +0000 (17:50 +0200)]
gestures: move the code to get raw pointer motion to its own function

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agogestures: rename int filter_motion to bool ignore_motion
JoseExposito [Mon, 12 Apr 2021 16:12:25 +0000 (18:12 +0200)]
gestures: rename int filter_motion to bool ignore_motion

Use a bool instead of an int and also rename the variable to avoid ambiguity
with tp_filter_motion().

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agolibinput: change gesture notify cancel parameter from int to bool
JoseExposito [Mon, 12 Apr 2021 07:18:39 +0000 (09:18 +0200)]
libinput: change gesture notify cancel parameter from int to bool

Change the "cancel" parameter in the existing notify methods (swipe, pinch and
gesture_notify) from int to bool. It is used as boolean, the fact that it's an
int is just a historical quirkyness.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agoquirks: mark the 0x252 razer keyboard as internal
Chris Dickson [Fri, 9 Apr 2021 16:17:24 +0000 (11:17 -0500)]
quirks: mark the 0x252 razer keyboard as internal

Signed-off-by: Chris Dickson <hobochili@pm.me>
3 years agoevdev: don't truncate event time to 32 bits
Peter Hutterer [Fri, 9 Apr 2021 00:12:45 +0000 (10:12 +1000)]
evdev: don't truncate event time to 32 bits

This causes a bunch of "your system is too slow" messages in e.g. the various
gesture tests.

Fixes 95a72990
Fixes #601

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoevdev: don't check the event time if it's higher than the dispatch time
Peter Hutterer [Mon, 22 Mar 2021 03:55:34 +0000 (13:55 +1000)]
evdev: don't check the event time if it's higher than the dispatch time

The dispatch time is taken during libinput_dispatch(), i.e. at the beginning
of an event sequence. We always read all events off the device, so where
events come in while we're inside the main dispatch loop, our event time may
be later than the saved dispatch_time. This causes an uint underflow and our
tdelta > 10 will be true for that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotablet-pad-leds: Open led file with O_NONBLOCK | O_CLOEXEC
Jonas Ådahl [Tue, 6 Apr 2021 14:33:42 +0000 (16:33 +0200)]
tablet-pad-leds: Open led file with O_NONBLOCK | O_CLOEXEC

We don't want the file to be left open after any fork/exec, and we don't
want the read to be blocking; so open it as such.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
3 years agotouchpad/clickfinger: limit middle click to 3 fingers
JoseExposito [Sun, 4 Apr 2021 14:59:40 +0000 (16:59 +0200)]
touchpad/clickfinger: limit middle click to 3 fingers

Don't middle click on clickpads with click method clickfinger when more than
3 fingers are used.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agoquirk: fix sensitivity for Dell Latitude 7490 pointing-stick
Ben Weston [Sat, 3 Apr 2021 22:01:07 +0000 (23:01 +0100)]
quirk: fix sensitivity for Dell Latitude 7490 pointing-stick

Signed-off-by: Ben Weston <b.weston60@gmail.com>
3 years agotools/record: line up the "neutral state" message
Peter Hutterer [Fri, 26 Mar 2021 05:07:41 +0000 (15:07 +1000)]
tools/record: line up the "neutral state" message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: rework the event printing
Peter Hutterer [Fri, 26 Mar 2021 03:40:21 +0000 (13:40 +1000)]
tools/record: rework the event printing

For historical (but not very good) reasons, libinput record printed events
from the first device to the output file (or stdout) and buffered everything
else. On ctrl+c, the other devices' descriptions and the buffered events were
appended to the output file.

This makes the printing code rather complex. Simplify it by giving each device
a separate FILE* - the first device points to the real output file, the others
to a tempfile. On Ctrl+C we just append those tempfiles to the real output
file one-by-one and done.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: rename the output file handling
Peter Hutterer [Fri, 26 Mar 2021 03:03:29 +0000 (13:03 +1000)]
tools/record: rename the output file handling

Less confusing than having output_file, out_file, and outfile.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: remember the first device in the context
Peter Hutterer [Fri, 26 Mar 2021 02:58:11 +0000 (12:58 +1000)]
tools/record: remember the first device in the context

No functional changes since we can get this easily from the list itself, but
in the future the first device will be used more extensively.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: append the devices in-order
Peter Hutterer [Fri, 26 Mar 2021 02:56:43 +0000 (12:56 +1000)]
tools/record: append the devices in-order

Using list_insert() here means the last device specified on the commandline is
the one that ends up in the file first - not very obvious...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: get rid of indent push/pop, replace with fixed indents
Peter Hutterer [Fri, 26 Mar 2021 02:46:19 +0000 (12:46 +1000)]
tools/record: get rid of indent push/pop, replace with fixed indents

Our file format is static enough that we don't need to use push/pop, we know
exactly which line is going where. So let's replace it with a static
indent instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: mark the iprintf function as printf
Peter Hutterer [Fri, 26 Mar 2021 01:30:24 +0000 (11:30 +1000)]
tools/record: mark the iprintf function as printf

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: switch the output file from an fd to a FILE*
Peter Hutterer [Fri, 26 Mar 2021 00:39:30 +0000 (10:39 +1000)]
tools/record: switch the output file from an fd to a FILE*

This is prep work to be more consistent with the use of tempfile later for
individual devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: deduplicate the device opening logic
Peter Hutterer [Fri, 26 Mar 2021 00:06:47 +0000 (10:06 +1000)]
tools/record: deduplicate the device opening logic

With a new helper function strv_from_argv we can re-use the device opening
loop for all the use-cases we have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: free the namelist when we're done
Peter Hutterer [Thu, 25 Mar 2021 22:40:06 +0000 (08:40 +1000)]
tools/record: free the namelist when we're done

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: localize a variable
Peter Hutterer [Thu, 25 Mar 2021 22:39:48 +0000 (08:39 +1000)]
tools/record: localize a variable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: de-duplicate an error message
Peter Hutterer [Thu, 25 Mar 2021 22:37:30 +0000 (08:37 +1000)]
tools/record: de-duplicate an error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: factor out the output file collection
Peter Hutterer [Thu, 25 Mar 2021 22:34:50 +0000 (08:34 +1000)]
tools/record: factor out the output file collection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/code-formatting: Add EditorConfig file
JoseExposito [Fri, 19 Mar 2021 07:37:02 +0000 (08:37 +0100)]
tools/code-formatting: Add EditorConfig file

EditorConfig helps maintain consistent coding styles for multiple developers
working on the same project across various editors and IDEs:
https://editorconfig.org/

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agofallback: disable mouse scroll wheel while middle button is pressed
JoseExposito [Sat, 13 Mar 2021 19:06:06 +0000 (20:06 +0100)]
fallback: disable mouse scroll wheel while middle button is pressed

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agofallback: replace fallback_dispatch->wheel with an anonymous struct
JoseExposito [Thu, 11 Mar 2021 07:30:45 +0000 (08:30 +0100)]
fallback: replace fallback_dispatch->wheel with an anonymous struct

The current fallback_dispatch wheel struct, a device_coords, doesn't allow to
save extra information.
The new anonymous struct will allow to add a is_inhibited field to disable mouse
scroll while the middle button is pressed and, potentially, any required extra
state in the future.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
3 years agoquirks: add wildcard to HID-over-I2C names (for FreeBSD)
Greg V [Mon, 15 Mar 2021 22:11:41 +0000 (01:11 +0300)]
quirks: add wildcard to HID-over-I2C names (for FreeBSD)

The FreeBSD HID stack adds the device type to the evdev name,
so we get e.g. "ACPI0C50:00 18D1:5028 TouchPad".

(Maybe this shouldn't be matched by name at all though...)

Signed-off-by: Greg V <greg@unrelenting.technology>
3 years agoquirks: implement DMI support on FreeBSD
Greg V [Mon, 15 Mar 2021 22:06:01 +0000 (01:06 +0300)]
quirks: implement DMI support on FreeBSD

FreeBSD does not use Linux modaliases, so we have to generate these strings.
Unfortunately for us, the data in kenv has the chassis type pre-parsed into
a nice string, so we have to match these strings back into numbers.
Only relevant types are included to avoid bloating the code.

Signed-off-by: Greg V <greg@unrelenting.technology>
3 years agoquirks: add quirks for Apple SPI input devices
Greg V [Mon, 15 Mar 2021 22:17:06 +0000 (01:17 +0300)]
quirks: add quirks for Apple SPI input devices

The Linux applespi driver currently uses the Synaptics vendor ID
on the trackpad for some reason (even though, at least from bcm5974
we only know that Broadcom is involved..) but my upcoming FreeBSD driver
uses the Apple vendor ID everywhere, so add two quirks.

Signed-off-by: Greg V <greg@unrelenting.technology>
3 years agoquirks: recognize SPI bus
Greg V [Mon, 15 Mar 2021 22:02:54 +0000 (01:02 +0300)]
quirks: recognize SPI bus

Apple MacBooks (Broadwell/Skylake/Kaby Lake and Apple Silicon)
use SPI to communicate with the keyboard and trackpad.

Signed-off-by: Greg V <greg@unrelenting.technology>
3 years agotests: add a gesture test to ensure our unaccel deltas are in a sane range
Peter Hutterer [Mon, 15 Mar 2021 07:23:48 +0000 (17:23 +1000)]
tests: add a gesture test to ensure our unaccel deltas are in a sane range

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogestures: Filter unaccelerated deltas for gestures
Alexander Mikhaylenko [Mon, 1 Mar 2021 16:09:37 +0000 (21:09 +0500)]
gestures: Filter unaccelerated deltas for gestures

Make sure the unaccelerated deltas are comparable to scroll deltas.

edit by whot:
The original intention of the unaccelerated motion data here was to provide
both accelerated and unaccelerated motion for gestures so it was possible to
have 1:1 mapping from gesture motion to screen activity.

Normalizing to 1000dpi this way would've worked for mice but touchpad
acceleration also includes the TP_MAGIC_SLOWDOWN (amongst other tricks) which
slows down motion to around 27% *before* applying the acceleration function.
On a 1000dpi touchpad (~40 units/mm) simply normalizing touchpad motion to
1000dpi results in pointer motion that is way too fast, it's lacking that
slowdown to 27% of original speed.

This results in the accelerated and unaccelerated gesture data being in
effectively two different coordinate systems with the caller having no ability
to relate the two.

Switching to the special constant acceleration applies that slowdown and
matches the data to the part of the acceleration curve where no (additional)
acceleration is applied.

It makes the gesture unaccelerated data comparable to the accelerated data
and to scroll data which uses the same process.

Fixes #582

Signed-off-by: Alexander Mikhaylenko <alexm@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: push/pop event frames around three-touch movements
Peter Hutterer [Mon, 15 Mar 2021 07:08:55 +0000 (17:08 +1000)]
test: push/pop event frames around three-touch movements

Without this, each finger movement happens in a different evdev event frame.
Since we average deltas for gestures, this messes with the expected data.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: simplify the helper for moving three touches at the same time
Peter Hutterer [Mon, 15 Mar 2021 06:56:23 +0000 (16:56 +1000)]
test: simplify the helper for moving three touches at the same time

There's no test case where we need to do something immediately after the last
event so we might as well do everything in the same loop.

This also fixes a bug where the first movement would usually get swallowed.
Test cases in general put the finger down at x/y, then move them to some other
position. We'd expect the first event in a loop to happen at x+n/y+n, not at
x/y again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: fix debugging messages for gesture begin event
Peter Hutterer [Mon, 15 Mar 2021 06:42:11 +0000 (16:42 +1000)]
test: fix debugging messages for gesture begin event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agodoc/user: explain why we are doing motion normalization
Peter Hutterer [Wed, 10 Mar 2021 06:46:43 +0000 (16:46 +1000)]
doc/user: explain why we are doing motion normalization

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agofilter: correct comments about the threshold's unit
Peter Hutterer [Tue, 16 Mar 2021 04:28:31 +0000 (14:28 +1000)]
filter: correct comments about the threshold's unit

See d6e531349745ff38ae457169d5089ea61297accf for confirmation that the
threshold is intended to be in mm/s, the comment here is simply a leftover from
earlier times when the acceleration method was using device-units only.

Fixes #585

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: update a few tests for more modern helpers
Peter Hutterer [Mon, 15 Mar 2021 05:40:17 +0000 (15:40 +1000)]
test: update a few tests for more modern helpers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: localize a few variables
Peter Hutterer [Fri, 12 Mar 2021 06:52:53 +0000 (16:52 +1000)]
test: localize a few variables

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotouchpad: always push a touch's current point to the motion history
Peter Hutterer [Thu, 11 Mar 2021 04:45:17 +0000 (14:45 +1000)]
touchpad: always push a touch's current point to the motion history

The way touchpads (generally) work is that they get the position of each
finger on each scanout. The kernel filters touches that haven't moved to
reduce bandwidth so any touch that is logically down that we don't see an
update for is in the same position as during the last scanout.

Previously, touches that didn't sent events were effectively ignored, causing
our jump detection to fail:
- time t0: touch moves to position x/y, motion history time is set to t0
- time t1..t5: touch remains at position for several frames, no updates to the
  motion history
- time t6: touch jumps to position x+a/y+b
  - tp_detect_jumps() sees the last update time is t0 which is too long ago
    and exits without detecting a jump

This is fixed by pushing to the motion history any time we have *any* update -
if the touchpad notices a state change on any touch update all touches with
their current position, whether it changed or not.

This obsoletes the `time` field in the tp_touch struct, most of this patch is
passing down the current time to the few users of t->time.

Fixes #578

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: add a comment to the thumb speed test
Peter Hutterer [Thu, 11 Mar 2021 06:21:28 +0000 (16:21 +1000)]
test: add a comment to the thumb speed test

Incorrect comment, the purpose of this test was to ensure that an unused slot
doesn't affect how other touches are treated, see commit 928bad9.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: fix two inadvertent pointer jumps in a test
Peter Hutterer [Thu, 11 Mar 2021 05:51:47 +0000 (15:51 +1000)]
test: fix two inadvertent pointer jumps in a test

Got papered over by bugs in the implementation and didn't trigger the jump
detection or movement detection otherwise.

Related to #578

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/debug-gui: draw a sprite for the unaccelerated pointer as well
Peter Hutterer [Wed, 10 Mar 2021 05:05:59 +0000 (15:05 +1000)]
tools/debug-gui: draw a sprite for the unaccelerated pointer as well

Add a second grey v-shaped (upside down triangle) pointer that moves around
with the unaccelerated deltas. This makes it easier to visualize how the
unaccelerated pointer moves around, the snake helps for some use-cases but not
all of them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/debug-gui: move the abs pointer position into a struct point
Peter Hutterer [Wed, 10 Mar 2021 04:54:19 +0000 (14:54 +1000)]
tools/debug-gui: move the abs pointer position into a struct point

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/debug-gui: move the pointer position into a struct point
Peter Hutterer [Wed, 10 Mar 2021 04:53:08 +0000 (14:53 +1000)]
tools/debug-gui: move the pointer position into a struct point

No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/debug-gui: start the unaccelerated motion deltas in the screen center
Peter Hutterer [Wed, 10 Mar 2021 04:48:53 +0000 (14:48 +1000)]
tools/debug-gui: start the unaccelerated motion deltas in the screen center

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoutil: document our list interface
Peter Hutterer [Tue, 23 Feb 2021 23:27:35 +0000 (09:27 +1000)]
util: document our list interface

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/per-slot-delta: handle KeyboardInterrupts nicely
Peter Hutterer [Tue, 9 Mar 2021 23:44:55 +0000 (09:44 +1000)]
tools/per-slot-delta: handle KeyboardInterrupts nicely

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/per-slot-delta: print the button state too while analyzing
Peter Hutterer [Tue, 9 Mar 2021 23:44:35 +0000 (09:44 +1000)]
tools/per-slot-delta: print the button state too while analyzing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agocompletion: add missing libinput analyze subtools to the zsh completions
Peter Hutterer [Tue, 9 Mar 2021 23:04:05 +0000 (09:04 +1000)]
completion: add missing libinput analyze subtools to the zsh completions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoreplace strncmp with strneq for safety-check
weizhixiang [Sun, 7 Mar 2021 06:39:56 +0000 (14:39 +0800)]
replace strncmp with strneq for safety-check

Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
3 years agoAdd Lenovo Legion 5 keyboard to 50-system-lenovo.quirks
Pedro Ribeiro [Tue, 2 Mar 2021 11:59:50 +0000 (11:59 +0000)]
Add Lenovo Legion 5 keyboard to 50-system-lenovo.quirks

Signed-off-by: Pedro Ribeiro <pedrib@gmail.com>
3 years agotreewide: get rid of `tmp` argument in list_for_each_safe
Konstantin Kharlamov [Mon, 22 Feb 2021 16:52:40 +0000 (19:52 +0300)]
treewide: get rid of `tmp` argument in list_for_each_safe

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
3 years agoutil-list.h: simplify code by removing an excess initialization
Konstantin Kharlamov [Mon, 22 Feb 2021 18:27:51 +0000 (21:27 +0300)]
util-list.h: simplify code by removing an excess initialization

The assignment of zero is done to work around false-positives of
coverity about uninitialized variable usage. Getting rid of it inside
the macro will allow in later commit to declare a variable inside
`for-loop` rather than outside of it.

Do it by declaring a new list_first_entry_by_type helper which accepts a
type rather than a variable.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
3 years agolibinput 1.17.0 upstream_bkup_20230126 upstream_work_20220207 1.17.0 upstream/1.17.0
Peter Hutterer [Tue, 23 Feb 2021 09:02:45 +0000 (19:02 +1000)]
libinput 1.17.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: fix two coverity complaints
Peter Hutterer [Tue, 23 Feb 2021 06:55:43 +0000 (16:55 +1000)]
tools/record: fix two coverity complaints

In both cases we only read to drain the fd, we don't care about the return
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools: add a tool to print a libinput recording as a table
Peter Hutterer [Mon, 1 Feb 2021 04:23:06 +0000 (14:23 +1000)]
tools: add a tool to print a libinput recording as a table

This makes it easier to visualize changes in various axes or key states that
should not be there, doubly so for long recordings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agomeson.build: build libinput replay as well
Peter Hutterer [Tue, 23 Feb 2021 03:30:13 +0000 (13:30 +1000)]
meson.build: build libinput replay as well

Just like the other python-based tools it's just a basename copy, so let's be
consistent here and have all tools perform that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: use a helper function to get the next event for a device
Peter Hutterer [Thu, 18 Feb 2021 21:40:46 +0000 (07:40 +1000)]
tools/record: use a helper function to get the next event for a device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: switch record over to using epoll
Peter Hutterer [Thu, 18 Feb 2021 07:10:15 +0000 (17:10 +1000)]
tools/record: switch record over to using epoll

Using poll means more difficult fd management, epoll (together with am
modified version of the libinput_sources) makes this a lot easier by simply
using dispatch.

This means we are no longer reliant on a specific file descriptor order in the
poll array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: reword parts of the man page
Peter Hutterer [Fri, 19 Feb 2021 03:19:10 +0000 (13:19 +1000)]
tools/record: reword parts of the man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: use safe_basename() to get to the hid report descriptor
Peter Hutterer [Thu, 18 Feb 2021 04:06:03 +0000 (14:06 +1000)]
tools/record: use safe_basename() to get to the hid report descriptor

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoutils: add a safe version of basename
Peter Hutterer [Thu, 18 Feb 2021 03:43:23 +0000 (13:43 +1000)]
utils: add a safe version of basename

So we don't need to worry about the libgen.h include game.
And we can switch trunkname over to that, making it a bit simpler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: simplify the behavior to emulate Python's join()
Peter Hutterer [Mon, 22 Feb 2021 04:23:27 +0000 (14:23 +1000)]
tools/record: simplify the behavior to emulate Python's join()

Instead of a boolean "is_first", just change the separator.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/replay: Enter quits if there are no events
Peter Hutterer [Tue, 23 Feb 2021 00:53:31 +0000 (10:53 +1000)]
tools/replay: Enter quits if there are no events

If we have no events in any of the recorded devices, state that this is the
case and make Enter simply quit instead of a pointless while loop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/replay: search for the first event with a timestamp
Peter Hutterer [Fri, 19 Feb 2021 03:31:56 +0000 (13:31 +1000)]
tools/replay: search for the first event with a timestamp

When running with --with-libinput, the first event is the DEVICE_ADDED event
for our device. Those events do not have a timestamp.

We have to find the first event in the recording with a timestamp instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: print a header as first line
Peter Hutterer [Mon, 22 Feb 2021 04:52:16 +0000 (14:52 +1000)]
tools/record: print a header as first line

To make the file format easier to detect

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoFix worng quirk name in doc
yuri1969 [Fri, 19 Feb 2021 21:08:55 +0000 (22:08 +0100)]
Fix worng quirk name in doc

The doc mentioned 'AttrTouchPressureRange' quirk but `src/quirks.c` defines
'AttrPressureRange' instead. This led to unknown quirk name errors.

Signed-off-by: yuri1969 <1969yuri1969@gmail.com>
3 years agotools/record: fix outdated comment
Peter Hutterer [Thu, 18 Feb 2021 21:12:17 +0000 (07:12 +1000)]
tools/record: fix outdated comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: de-inline our functions
Peter Hutterer [Thu, 18 Feb 2021 04:28:12 +0000 (14:28 +1000)]
tools/record: de-inline our functions

Let's leave this up to the compiler, the usual side-effect of inline (compiler
doesn't complain about an unused static function) doesn't apply here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: correct the evdev data format in the man page
Peter Hutterer [Thu, 18 Feb 2021 22:44:23 +0000 (08:44 +1000)]
tools/record: correct the evdev data format in the man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agomeson.build: consolidate all man pages
Peter Hutterer [Wed, 17 Feb 2021 23:47:14 +0000 (09:47 +1000)]
meson.build: consolidate all man pages

They all use the same configure_file() process, so let's do them all in a
loop.

Exceptions are the test-suite man page.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agomeson.build: drop the dummy config data and use copy: true instead
Peter Hutterer [Wed, 17 Feb 2021 23:39:46 +0000 (09:39 +1000)]
meson.build: drop the dummy config data and use copy: true instead

We require the meson version this was introduced in, so let's use it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: add test cases for 2/3 finger movement after drag-lock
satrmb [Tue, 16 Feb 2021 10:13:29 +0000 (11:13 +0100)]
test: add test cases for 2/3 finger movement after drag-lock

Same as after a tap, just with a short drag between tap and 2/3 finger movement.
Also fixes a finger coord typo in one of the previously added test cases.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
3 years agolibinput 1.16.902 1.16.902
Peter Hutterer [Tue, 16 Feb 2021 03:10:18 +0000 (13:10 +1000)]
libinput 1.16.902

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: add test cases for 2/3 finger movement after tap
Peter Hutterer [Mon, 15 Feb 2021 07:48:34 +0000 (17:48 +1000)]
test: add test cases for 2/3 finger movement after tap

We have two behaviors here:
- tap + 2fg -> scrolling
- tap + 1fg move + 2f down -> dragging

Let's document this. The 3fg case only has one situation, so let's test that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: drop the needless base event conversion
Peter Hutterer [Mon, 15 Feb 2021 08:00:18 +0000 (18:00 +1000)]
test: drop the needless base event conversion

This was just there to avoid unused variable warnings but the simpler approach
to that is to just not assign a variable in the first place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: print the event type on mismatch
Peter Hutterer [Mon, 15 Feb 2021 07:34:34 +0000 (17:34 +1000)]
test: print the event type on mismatch

We already have a helper function for this, let's use it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agodoc: update the docs with a note regarding multifinger dragging
Peter Hutterer [Mon, 15 Feb 2021 07:06:34 +0000 (17:06 +1000)]
doc: update the docs with a note regarding multifinger dragging

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogitlab CI: move the no-libwacom test suite into its own stage
Peter Hutterer [Mon, 15 Feb 2021 01:49:30 +0000 (11:49 +1000)]
gitlab CI: move the no-libwacom test suite into its own stage

Easier to spot visually in the GUI that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: fix a few missing or wrong drag-lock timeouts
satrmb [Fri, 12 Feb 2021 13:35:53 +0000 (14:35 +0100)]
test: fix a few missing or wrong drag-lock timeouts

These had no consequences apart from occasional "system is too slow" messages,
because the test suite's shorter tap timeout is just barely long enough
for drag-lock, and/or because litest_assert_button_event waits for an event
anyway.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
3 years agotouchpad: permit only one finger on the touchpad at the start of a tap-drag
satrmb [Fri, 12 Feb 2021 11:09:07 +0000 (12:09 +0100)]
touchpad: permit only one finger on the touchpad at the start of a tap-drag

This only affects the actual dragging part of the tap-and-drag interaction;
n-finger tap-and-drag is supposed to be performed with a n-finger tap
followed by a 1-finger drag.
Allowing a second finger in the middle of a drag is still necessary for a
finger swap, which users may need in long-distance drags, especially when
drag-lock is disabled.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
3 years agotouchpad: stretch the tap-and-drag timeout a bit depending on finger count
satrmb [Wed, 23 Sep 2020 09:53:55 +0000 (11:53 +0200)]
touchpad: stretch the tap-and-drag timeout a bit depending on finger count

Some users reported problems triggering multi-finger tap-and-drag,
with reliability decreasing as the finger count increased.
This is plausible because they may shift towards moving the whole hand
up and down, which obviously takes more time than just a finger.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
3 years agodoc/user: generate the required package list for the CI distributions
Peter Hutterer [Mon, 15 Feb 2021 02:38:55 +0000 (12:38 +1000)]
doc/user: generate the required package list for the CI distributions

Use yq to extract the package list from the CI configuration, then dump that
into the user docs. This provides the long-requested commands to install all
dependencies without the maintenance effort or risk of going stale.

Note that we are *not* building this in the CI, it's just not needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogitlab CI: add a job to make sure we're running all test suites
Peter Hutterer [Fri, 12 Feb 2021 03:05:57 +0000 (13:05 +1000)]
gitlab CI: add a job to make sure we're running all test suites

Only needs to run when meson.build or the CI script update

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: drop the custom group names
Peter Hutterer [Fri, 5 Feb 2021 04:51:02 +0000 (14:51 +1000)]
test: drop the custom group names

The group names are forced by check (they are called suite names there) but
for our test suite they provide very little benefit. Much easier to just
use the filename a test is in as group name.

This removes the pure substring match for --filter-group, it's now fnmatch
only. group names are short enough that the typing isn't an issue and we don't
want to run tests twice (e.g. 'pad' is also in 'touchpad').

This patch caused #574 until it got fixed in d838e3a3a4c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agoutils: add a trunkname() function to extract the trunk of a filename
Peter Hutterer [Fri, 5 Feb 2021 04:36:16 +0000 (14:36 +1000)]
utils: add a trunkname() function to extract the trunk of a filename

/path/to/foo.bar returns "foo"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogitlab CI: make the test suite names a list
Peter Hutterer [Fri, 12 Feb 2021 03:03:44 +0000 (13:03 +1000)]
gitlab CI: make the test suite names a list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: use motion events to check the "system is too slow" message
Peter Hutterer [Fri, 12 Feb 2021 00:24:43 +0000 (10:24 +1000)]
test: use motion events to check the "system is too slow" message

Using buttons for this test can trigger debounce warnings instead (in
addition?) to the warning we actually check for. Let's use motion events
instead and double the loop while we're at it so we have double the chance of
triggering at least one warning.

Fixes #574 for unknown reasons

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: wrap the litest user data into a struct
Peter Hutterer [Thu, 11 Feb 2021 21:55:21 +0000 (07:55 +1000)]
test: wrap the litest user data into a struct

litest itself requires the libinput user_data to be set to its own context
struct (see close_restricted). A test that needs its own user_data must not
override this struct - if the context is accessed during libinput_dispatch()
we'll get memory corruption.

See #574

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: move a helper function close to its caller
Peter Hutterer [Thu, 11 Feb 2021 23:29:24 +0000 (09:29 +1000)]
test: move a helper function close to its caller

This is a custom log function for one single test, let's move it next to that
test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agogitlab CI: run the scan-build analysis jobs in script
Peter Hutterer [Thu, 11 Feb 2021 21:28:18 +0000 (07:28 +1000)]
gitlab CI: run the scan-build analysis jobs in script

after_script ignores any exit status so we can't actually fail the job here

Fixes #573

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotools/record: remove a useless assignment
Peter Hutterer [Thu, 11 Feb 2021 21:21:34 +0000 (07:21 +1000)]
tools/record: remove a useless assignment

It's overwritten a few lines south of here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
3 years agotest: init an array to zero to silence scan-build
Peter Hutterer [Thu, 11 Feb 2021 21:19:40 +0000 (07:19 +1000)]
test: init an array to zero to silence scan-build

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>