platform/upstream/libinput.git
21 months agoCI: do not retry the qemu runs
Benjamin Tissoires [Fri, 30 Jul 2021 10:06:40 +0000 (12:06 +0200)]
CI: do not retry the qemu runs

They should be more reliable now, so no need to try them twice

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
21 months agoCI: remove unused test
Benjamin Tissoires [Fri, 30 Jul 2021 09:28:41 +0000 (11:28 +0200)]
CI: remove unused test

I am pretty sure this one guard is a leftover from a previous version.
That is because use_for_custom_build_tests is true when
use_for_qemu_tests is, so probably a useless test here.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
21 months agoCI: make freebsd slightly more in line with others
Benjamin Tissoires [Thu, 29 Jul 2021 16:54:45 +0000 (18:54 +0200)]
CI: make freebsd slightly more in line with others

the combination of want_qemu and skip_container is not very straight
forward.

What we actually have, is that freebsd is only qemu based, so there is
no point in really having a `_QEMU` tag for it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
21 months agoCI: remove one occurrence of fedora instead of distro.name
Benjamin Tissoires [Thu, 11 Aug 2022 05:47:40 +0000 (07:47 +0200)]
CI: remove one occurrence of fedora instead of distro.name

For .{{distro.name}}-build@template, everything is parametrized with the
distro name, so having plain 'fedora' might bite us in the future.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
21 months agoCI: prettify the include of templates
Benjamin Tissoires [Thu, 29 Jul 2021 16:50:57 +0000 (18:50 +0200)]
CI: prettify the include of templates

Makes the resulting file easier to read

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
21 months agogitlab-ci: add commandline options to the meson-build.sh script
Peter Hutterer [Wed, 31 Aug 2022 05:51:20 +0000 (15:51 +1000)]
gitlab-ci: add commandline options to the meson-build.sh script

The various --skip-build, --skip-test and --skip-setup skip the
respective step, the --run-test argument runs the test even where
MESON_TEST_ARGS is nil.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
21 months agogitlab-ci: explicitly call "meson setup" to improve readability
Peter Hutterer [Wed, 31 Aug 2022 05:41:35 +0000 (15:41 +1000)]
gitlab-ci: explicitly call "meson setup" to improve readability

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
21 months agogitlab-ci: export MESON_TESTTHREADS so meson actually sees it
Peter Hutterer [Wed, 31 Aug 2022 05:37:37 +0000 (15:37 +1000)]
gitlab-ci: export MESON_TESTTHREADS so meson actually sees it

Unlike NINJA_ARGS this isn't passed into meson, it's picked from the
env.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
21 months agoevdev: remove duplicate "device is a switch" message
Peter Hutterer [Tue, 23 Aug 2022 03:22:31 +0000 (13:22 +1000)]
evdev: remove duplicate "device is a switch" message

We log this a few lines south of here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
21 months agoquirks: add generic quirks for ARM based chromebooks
Leonard Lausen [Mon, 22 Aug 2022 00:47:47 +0000 (00:47 +0000)]
quirks: add generic quirks for ARM based chromebooks

Signed-off-by: Leonard Lausen <leonard@lausen.nl>
21 months agoquirks: add quirks for Acer Spin 513 (Lazor)
Leonard Lausen [Wed, 10 Aug 2022 22:13:39 +0000 (22:13 +0000)]
quirks: add quirks for Acer Spin 513 (Lazor)

Signed-off-by: Leonard Lausen <leonard@lausen.nl>
22 months agotools: add missing dwtp option setting
Peter Hutterer [Mon, 8 Aug 2022 03:56:11 +0000 (13:56 +1000)]
tools: add missing dwtp option setting

Fixes 1f1ddbc6dff0cf0451e3c9ac923f9821278560aa

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
22 months agogitlab ci: drop EOL'd ubuntu 21.10
Peter Hutterer [Wed, 3 Aug 2022 03:42:47 +0000 (13:42 +1000)]
gitlab ci: drop EOL'd ubuntu 21.10

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
22 months agoquirks: update quirks for Lenovo IdeaPad Duet 3
Boris Pek [Fri, 15 Jul 2022 06:34:22 +0000 (09:34 +0300)]
quirks: update quirks for Lenovo IdeaPad Duet 3

My tablet has substring pvrIdeaPadDuet310IGL5-LTE in modalias and there are
other modifications of this model on a market so the mask for DMI should be
simplified to cover more devices.

Signed-off-by: Boris Pek <bpek@astralinux.ru>
22 months agodoc/user: minor rewording of the pointer accel profile list
Peter Hutterer [Thu, 14 Jul 2022 05:35:38 +0000 (15:35 +1000)]
doc/user: minor rewording of the pointer accel profile list

This just makes it easier to add new profiles to the list without ending
up with a word salad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
22 months agolibwacom: fix warnings building without libwacom
José Expósito [Tue, 12 Jul 2022 17:44:59 +0000 (19:44 +0200)]
libwacom: fix warnings building without libwacom

When the libwacom build option is set to false the compiler throws
these warnings:

../udev/libinput-device-group.c:95:1: warning: ‘wacom_handle_ekr’ defined but not used [-Wunused-function]
   95 | wacom_handle_ekr(struct udev_device *device,
      | ^~~~~~~~~~~~~~~~
[205/237] Compiling C object 'libinput-test-suite@exe/test_test-tablet.c.o'.
../test/test-tablet.c:5440:1: warning: ‘verify_left_handed_touch_sequence’ defined but not used [-Wunused-function]
 5440 | verify_left_handed_touch_sequence(struct litest_device *finger,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test/test-tablet.c:5385:1: warning: ‘verify_left_handed_tablet_sequence’ defined but not used [-Wunused-function]
 5385 | verify_left_handed_tablet_sequence(struct litest_device *tablet,
 #     | ^~~~~~~~~~~~~~~~
 #     | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the required guards to fix the warnings.

Fix #791.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
22 months agoevdev: fix a tab vs space indentation issue
Peter Hutterer [Mon, 11 Jul 2022 11:01:35 +0000 (21:01 +1000)]
evdev: fix a tab vs space indentation issue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
22 months agomeson: use install_emptydir to create directory
illiliti [Sun, 3 Jul 2022 15:14:15 +0000 (18:14 +0300)]
meson: use install_emptydir to create directory

instead of install_subdir. Fixes muon - a strictly-conforming meson
implementation which doesn't implement deprecated and broken-by-design
functionality.

For more info, see: https://mesonbuild.com/Reference-manual_functions.html#install_subdir

Signed-off-by: illiliti <illiliti@protonmail.com>
23 months agoquirks: Add quirks to improve tablet-mode on the Surface Laptop Studio
Maximilian Luz [Mon, 4 Jul 2022 23:33:04 +0000 (01:33 +0200)]
quirks: Add quirks to improve tablet-mode on the Surface Laptop Studio

The Microsoft Surface Laptop Studio can operate in multiple postures. In
one of these, dubbed "slate/tent", the screen is angled roughly 45°,
covering the keyboard but not the touchpad. Unfortunately, this state is
(as far as we can tell) indiscernible to the display being flipped 180°
backwards (dubbed "slate/flipped"), where the keyboard points away from
the user and is now behind the screen.

Due to this, it makes sense to enable tablet-mode in this (general)
"slate" state, which is what the corresponding kernel driver currently
does. This, for example, can tell desktop environments to bring up a
touch keyboard in certain situations and to allow for automatic screen
rotation (which is required in the "flipped" mode).

Unfortunately, libinput disables all integrated peripherals, including
the touchpad, when tablet-mode is on, rendering the touchpad unusable in
the "slate/tent" state. Therefore, set ModelTabletModeNoSuspend=1 to
keep the touchpad functional. For simplicity, apply this quirk to all
input devices on the Surface Laptop Studio. Those are already disabled
by firmware in the respective postures, meaning things work well without
suspension by libinput.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
23 months agoquirks: Add quirks for Surface Laptop Studio touchpad
Maximilian Luz [Mon, 4 Jul 2022 23:24:21 +0000 (01:24 +0200)]
quirks: Add quirks for Surface Laptop Studio touchpad

The touchpad on the Microsoft Surface Laptop Studio is force-sensitive.
The default values used by libinput do not seem to work well (causing
touches to not be recognized), so configure it with known-good values.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
23 months agoquirks: add volume rocker quirk for Lenovo IdeaPad Duet 3i
Max Huber [Sun, 10 Jul 2022 12:11:57 +0000 (12:11 +0000)]
quirks: add volume rocker quirk for Lenovo IdeaPad Duet 3i

Signed-off-by: Max Huber <ycbcr@disroot.org>
23 months agoquirks: add Lenovo Legion 7 keyboard
Dale A. Jackson [Fri, 1 Jul 2022 17:26:44 +0000 (10:26 -0700)]
quirks: add Lenovo Legion 7 keyboard

Fixes disable-when-typing for the keyboard model on this laptop

Signed-off-by: Dale A. Jackson <JacksonWrath@gmail.com>
23 months agoCODING_STYLE: update with a better description for variable assignments
Peter Hutterer [Tue, 21 Jun 2022 05:11:08 +0000 (15:11 +1000)]
CODING_STYLE: update with a better description for variable assignments

Loop variables shouldn't be re-used.

Avoid uninitialized variables

Sort variables to make function calls more obvious

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agogitlab CI: dnf remove gtk4-devel for the no-debug-gui deps job
Peter Hutterer [Mon, 27 Jun 2022 00:00:55 +0000 (10:00 +1000)]
gitlab CI: dnf remove gtk4-devel for the no-debug-gui deps job

We've long preferred GTK4 and that's installed on our images, so let's
make sure that gets removed together with GTK3 (which isn't actually
installed anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agomeson.build: fix build without Wayland
Peter Hutterer [Sun, 26 Jun 2022 23:47:41 +0000 (09:47 +1000)]
meson.build: fix build without Wayland

Introduced in 6a1bd5b0c9, we now have two potentially undeclared
variables if GTK is available but doesn't have Wayland support.

../meson.build:576:1: ERROR: Unknown variable "dep_wayland_client".

Fixes 6a1bd5b0c9be55d21c6e066a94fc6fd77fea96ce
Fixes #786

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agotest: exclude the two high-delay debounce tests from the valgrind CI run
satrmb [Tue, 28 Jun 2022 11:02:22 +0000 (13:02 +0200)]
test: exclude the two high-delay debounce tests from the valgrind CI run

The `debounce_bounce_high_delay` and `debounce_spurious_trigger_high_delay`
tests are failing with annoying frequency in valgrind, but that is
entirely due to valgrind being too slow for the tight timing reqirements
of these tests. Skipping them in valgrind has next to no potential to hide
memory leaks because the code paths leading to success are also covered by
other tests which are less picky about timing, and the CI test suite run
without valgrind still tests for their success.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
23 months agomeson.build: drop listing of header files from compilation targets
Peter Hutterer [Wed, 15 Jun 2022 22:20:54 +0000 (08:20 +1000)]
meson.build: drop listing of header files from compilation targets

"Meson uses Ninja which uses compiler dependency information to
automatically figure out dependencies between C sources and headers, so
it will rebuild things correctly when a header changes. [...]
If, for whatever reason, you do add non-generated headers to the sources
list of a target, Meson will simply ignore them."

https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agogitlab CI: drop the manual meson to junit conversion
Peter Hutterer [Mon, 13 Jun 2022 04:07:56 +0000 (14:07 +1000)]
gitlab CI: drop the manual meson to junit conversion

Meson supports this natively since version 0.55 which is available in
all our tested distributions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agolibinput 1.21.0 1.21.0
José Expósito [Sat, 11 Jun 2022 11:47:52 +0000 (13:47 +0200)]
libinput 1.21.0

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
23 months agogitlab CI: bump to F35 and F36, as well as Ubuntu 21.10 and 22.04
Peter Hutterer [Wed, 8 Jun 2022 06:43:39 +0000 (16:43 +1000)]
gitlab CI: bump to F35 and F36, as well as Ubuntu 21.10 and 22.04

F33 and F34 are both EOL. This also fixes the RPM build job to
automatically use the latest Fedora version and adds
wayland-protocols-devel which is now needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
23 months agomeson.build: check gtk targets before building
Peter Hutterer [Fri, 10 Jun 2022 00:31:37 +0000 (10:31 +1000)]
meson.build: check gtk targets before building

We have two different dependencies on Wayland: GTK support and the
wayland-protocols we use directly. If we have GTK support but
wayland-protocols is not installed at meson configure time, our build
fails.

To avoid having multiple ifdefs in the code, let's define two new ones:
HAVE_GTK_WAYLAND and HAVE_GTK_X11, both set if GTK supports that
particular target (from pkgconfig) and we have the other support
libraries we need.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: fix a typo
Peter Hutterer [Tue, 7 Jun 2022 23:25:59 +0000 (09:25 +1000)]
test: fix a typo

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: use a ranged test instead of a duplicated one
Peter Hutterer [Tue, 7 Jun 2022 23:25:02 +0000 (09:25 +1000)]
test: use a ranged test instead of a duplicated one

These two tests were identical except for the WHEEL/HWHEEL
differentiator, let's make this into a ranged test instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agowheel: fix Lenovo Scrollpoint quirk
José Expósito [Mon, 6 Jun 2022 18:24:16 +0000 (20:24 +0200)]
wheel: fix Lenovo Scrollpoint quirk

The IBM/Lenovo Scrollpoint mouse features a trackpoint-like stick that
sends a great amount of scroll deltas.

In order to handle the device, a quirk is in place to normalize the
scroll events as they were relative motion.

However, when high-resolution scroll was implemented, we started
normalizing the hi-res events instead of the lo-res events by mistake.

Fix the quirk by normalizing the right deltas.

Fixes: 6bb02aaf307a ("High-resolution scroll wheel support")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Tested-by: Peter Ganzhorn <peter.ganzhorn@gmail.com>
2 years agotest: ensure we always have an axis event where we expect one
Peter Hutterer [Mon, 6 Jun 2022 23:55:32 +0000 (09:55 +1000)]
test: ensure we always have an axis event where we expect one

If we never got an event, we'd skip over the while loop and generate a
false positive.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: fix the lowres-only wheel event tests
Peter Hutterer [Tue, 7 Jun 2022 01:56:04 +0000 (11:56 +1000)]
test: fix the lowres-only wheel event tests

These tests gave us false positives for devices without a REL_WHEEL or
REL_HWHEEL because one of the helper functions papered over missing
events.

We have two tests here, one for horizontal, one for vertical but they
mixed WHEEL and HWHEEL in both tests. Fix this by splitting them
properly, so each test only checks that axis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agofilter-touchpad: normalize for dpi on the touchpad-specific flat profile
satrmb [Sun, 29 May 2022 09:29:49 +0000 (11:29 +0200)]
filter-touchpad: normalize for dpi on the touchpad-specific flat profile

On mice, switching the acceleration profile to flat disables dpi normalization,
because high or even switchable dpi are generally major features of a
high-end mouse, and switching to flat acceleration indicates that the user
wants to reduce the effects of any cursor acceleration to a minimum.
Therefore we skip normalization there and let the user take full advantage
of their expensive hardware.

On touchpads, particularly those built into a laptop, users have to deal with
whatever hardware they have; touchpad dpi is an afterthought at best, or
a disaster at worst. Switching to the flat profile is more likely to be
about avoiding the non-linear acceleration curve of the adaptive profile.

Hence the flat profile for touchpads shouldn't copy what the one for mice does,
but rather use dpi normalization like the adaptive profile. This keeps flat
acceleration on low-resolution touchpads from dropping to unusably slow speeds.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2 years agotablet: require a minimum pressure before we process pressure events
Peter Hutterer [Fri, 6 May 2022 05:21:08 +0000 (15:21 +1000)]
tablet: require a minimum pressure before we process pressure events

Tools default to 1% lower threshold (tip up) and 5% upper threshold (tip
down). But our distance vs pressure exclusion would reset the distance
for *any* pressure value, regardless how low that value was and how high
distance was in comparison.

A very low pressure value of less than 1% would then result in a
normalized pressure of 0, so we'd effectively just reset the distance to
zero and do nothing with the pressure. This can cause distance jumps
when the tool arbitrarily sends low pressure values while hovering as
seen in https://github.com/libsdl-org/SDL/pull/5481#issuecomment-1118969064

Commit 61bdc05fb0f84303f97daaba6ae6b49c976dbfbf from Dec 2017
  "tablet: set the tip-up pressure threshold to 1%"
was presumably to address this but no longer (?) works.

Fix this by addressing multiple issues at the same time:
- anything under that 1% threshold is now considered as zero pressure
  and any distance value is kept as-is. Once pressure reaches 1%,
  distance is always zero.
- axis normalization is now from 1% to 100% (previously: upper threshold
  to 100%). So a tip down event should always have ~4% pressure and we
  may get tablet motion events with nonzero pressure before the tip down
  event.
  From memory, this was always intended anyway since a tip event should
  require some significant pressure, maybe too high compared to e.g.
  pressure-sensitive painting
- where a tablet has an offset, add the same 1%/5% thresholds, on top of
  that offset. And keep adjusting those thresholds as we change the
  offset. Assuming that the offset is the absolute minimum a worn-out
  pen can reach, this gives us the same behaviour as a new pen. The
  calculation here uses a simple approach so the actual range is
  slightly larger than 5% but it'll do.

  Previously, the lower threshold for an offset pen was the axis minimum
  but that can never be reached. So there was probably an undiscovered
  bug in there.

And fix a bunch of comments that were either wrong, confusing or
incomplete, e.g. the pressure thresholds were already in device
coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotablet: use a helper variable to make the code more readable
Peter Hutterer [Fri, 6 May 2022 04:59:05 +0000 (14:59 +1000)]
tablet: use a helper variable to make the code more readable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: rename a test function to make it easier to select
Peter Hutterer [Fri, 6 May 2022 06:24:43 +0000 (16:24 +1000)]
test: rename a test function to make it easier to select

Because --filter-test does substring matching it's easier to have it
with a unique name rather than one that is a prefix of another.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotablet: remove an always-true part of an if condition
Peter Hutterer [Fri, 6 May 2022 04:57:40 +0000 (14:57 +1000)]
tablet: remove an always-true part of an if condition

A few lines north of here we return early if neither bit is set. If we
get to this point, at least one bit is set so this part of the condition
always evaluates to true.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoRemove "device-" file
José Expósito [Wed, 18 May 2022 21:17:35 +0000 (23:17 +0200)]
Remove "device-" file

The file was unintentional added in a merge request:
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/771

Fixes: 4d26736e ("Quirk all StarLabs trackpads")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoQuirk all StarLabs trackpads
Sean Rhodes [Thu, 12 May 2022 08:07:26 +0000 (09:07 +0100)]
Quirk all StarLabs trackpads

Quirk all the StarLabs trackpads as they are all the same design,
a clickpad with physical buttons that act as one button.

Fixes #771.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2 years agoquirks: remove an unused quirk
Peter Hutterer [Mon, 16 May 2022 02:24:16 +0000 (12:24 +1000)]
quirks: remove an unused quirk

Removed in b925a0878b0b51fe30016546b9e48a7613dccd4d
   quirks: switch the models with missing buttonpad to use the new attr

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: move the canvas quirk enum to the right order
Peter Hutterer [Mon, 16 May 2022 02:23:57 +0000 (12:23 +1000)]
quirks: move the canvas quirk enum to the right order

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: Add quirk for StarLite Mk IV
Sean Rhodes [Mon, 9 May 2022 11:14:11 +0000 (12:14 +0100)]
quirks: Add quirk for StarLite Mk IV

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2 years agotest: install libinput-test-utils as part of install-tests
Peter Hutterer [Fri, 6 May 2022 01:00:59 +0000 (11:00 +1000)]
test: install libinput-test-utils as part of install-tests

This tests a bunch of internal utility functions that may work
differently depending on compiler flags, etc. Let's make that test
available so it can be verified on an installed system.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: add a libinput test tool as entry point for our test suites
Peter Hutterer [Fri, 6 May 2022 00:51:33 +0000 (10:51 +1000)]
tools: add a libinput test tool as entry point for our test suites

We already install libinput-test-suite if the meson option install-tests
is set, see
  commit be7045cdc70d8c026d981997852cc706dab3d5b8
  test: make the test suite runner available as installed binary

To make other tests easily available and more discoverable, add a new
tool "libinput test" with the matching man page. This will also help us
to enforce some of the namespacing a bit better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools/analyze-recording: improve the repeated-events line printing
Peter Hutterer [Fri, 6 May 2022 04:24:41 +0000 (14:24 +1000)]
tools/analyze-recording: improve the repeated-events line printing

When redirecting to a file, we don't want lines like this:
   .. +2 ... +5 ... +9

Let's not print anything until we have collected all those lines and
then print the final result, we don't need a live update here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools/analyze-recording: add --print-state to always print values
Peter Hutterer [Fri, 6 May 2022 03:15:25 +0000 (13:15 +1000)]
tools/analyze-recording: add --print-state to always print values

Helpful in comparing values that update frequently - without this the
last printed value may be way off the page when some other value comes
in that it needs to be compared to.

Values not seen yet default to zero - we can't query those from a
recording but it'll be good enough this way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools/record: fix indentation for libinput events
Peter Hutterer [Fri, 6 May 2022 03:44:58 +0000 (13:44 +1000)]
tools/record: fix indentation for libinput events

Commit 0cdf459643bfa6264bd2d1af8f7749529ebffee1
  tools/record: get rid of indent push/pop, replace with fixed indents

Introduced some magic to detect if there's a '-' at the start of the
format string to fix the identation. This only works if the format
string is constant though, leading to an indentation error when record
is run with --with-libinput.

Fixes 0cdf459643bfa6264bd2d1af8f7749529ebffee1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: don't print a carriage return if we're not on a tty
Peter Hutterer [Wed, 4 May 2022 01:20:01 +0000 (11:20 +1000)]
tools: don't print a carriage return if we're not on a tty

Otherwise redirecting the output to a file leaves us with ugly ^M

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools: allow limiting the axes in libinput analyse recording
Peter Hutterer [Wed, 4 May 2022 01:14:30 +0000 (11:14 +1000)]
tools: allow limiting the axes in libinput analyse recording

Use --ignore ABS_X,ABS_Y or --only ABS_X,ABS_Y to ignore or limit to
only a specific axis set. Especially for tablet devices with their
multitudes of axes this makes analysing a particular set easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoAttrLidSwitchReliability quirk default unreliable->reliable
Alexander Courtis [Tue, 26 Apr 2022 01:55:22 +0000 (01:55 +0000)]
AttrLidSwitchReliability quirk default unreliable->reliable

2 years agoevdev: strip the device name of format directives
Peter Hutterer [Tue, 29 Mar 2022 23:25:22 +0000 (09:25 +1000)]
evdev: strip the device name of format directives

This fixes a format string vulnerabilty.

evdev_log_message() composes a format string consisting of a fixed
prefix (including the rendered device name) and the passed-in format
buffer. This format string is then passed with the arguments to the
actual log handler, which usually and eventually ends up being printf.

If the device name contains a printf-style format directive, these ended
up in the format string and thus get interpreted correctly, e.g. for a
device "Foo%sBar" the log message vs printf invocation ends up being:
  evdev_log_message(device, "some message %s", "some argument");
  printf("event9 - Foo%sBar: some message %s", "some argument");

This can enable an attacker to execute malicious code with the
privileges of the process using libinput.

To exploit this, an attacker needs to be able to create a kernel device
with a malicious name, e.g. through /dev/uinput or a Bluetooth device.

To fix this, convert any potential format directives in the device name
by duplicating percentages.

Pre-rendering the device to avoid the issue altogether would be nicer
but the current log level hooks do not easily allow for this. The device
name is the only user-controlled part of the format string.

A second potential issue is the sysname of the device which is also
sanitized.

This issue was found by Albin Eldstål-Ahrens and Benjamin Svensson from
Assured AB, and independently by Lukas Lamster.

Fixes #752

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotools/record: fix the indentation of the system: section
Peter Hutterer [Thu, 7 Apr 2022 04:44:53 +0000 (14:44 +1000)]
tools/record: fix the indentation of the system: section

Fixes 0cdf459643bfa6264bd2d1af8f7749529ebffee1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoUpdate valgrind.h to a newer version
Tom Stellard [Tue, 5 Apr 2022 01:27:15 +0000 (01:27 +0000)]
Update valgrind.h to a newer version

This updates valgrind.h to the version that was packaged in
valgrind-devel-3.18.1-9.fc36.  This new version contains a fix for a
build failure with clang.

Signed-off-by: Tom Stellard <tstellar@redhat.com>
2 years agodoc/user: add a page to troubleshoot right-click Clickpads
Peter Hutterer [Mon, 28 Mar 2022 00:14:24 +0000 (10:14 +1000)]
doc/user: add a page to troubleshoot right-click Clickpads

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agomeson: replace a meson.source_root() with the explicit directory
Peter Hutterer [Mon, 28 Mar 2022 00:21:58 +0000 (10:21 +1000)]
meson: replace a meson.source_root() with the explicit directory

Removes the warning that source_root() has been deprecated since 0.56.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agomeson: fix a meson warning
Peter Hutterer [Mon, 28 Mar 2022 00:16:51 +0000 (10:16 +1000)]
meson: fix a meson warning

run_command() wants a check kwarg now:

WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: disable hold gestures when are not required
José Expósito [Mon, 28 Mar 2022 10:44:55 +0000 (12:44 +0200)]
test: disable hold gestures when are not required

Certain tests that make use of verify_left_handed_touch_motion can fail
depending on how quick they are executed, specially when using Valgrind.

Instead of ignoring the hold end event, use the existing mechanism to
disable hold gestures where we are not interested in them.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoutil: auto-declare the element variable in ARRAY_FOR_EACH
Peter Hutterer [Mon, 7 Mar 2022 04:44:21 +0000 (14:44 +1000)]
util: auto-declare the element variable in ARRAY_FOR_EACH

All cases we have in our code base have an otherwise unused variable to
loop through the array. Let's auto-declare this as part of the loop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotouchpad: new option dwtp (disable-while-trackpointing)
pudiva chip líquida [Tue, 8 Mar 2022 01:33:40 +0000 (01:33 +0000)]
touchpad: new option dwtp (disable-while-trackpointing)

Add option to control whether the touchpad should be disabled while the
trackpoint is in use.

Fix #731

Signed-off-by: pudiva chip líquida <pudiva@skylittlesystem.org>
2 years agocoding style: allow C99 variable declaration
José Expósito [Wed, 2 Mar 2022 07:48:03 +0000 (08:48 +0100)]
coding style: allow C99 variable declaration

Allow to declare variables before they are used in new written code.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: modernize variable declaration in evdev_device_is_joystick_or_gamepad
José Expósito [Wed, 2 Mar 2022 07:35:23 +0000 (08:35 +0100)]
evdev: modernize variable declaration in evdev_device_is_joystick_or_gamepad

Declare the variables used to keep track of joystick buttons and
keyboard keys right before they are used for better readability and
consistency.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: check well-known keyboard keys on joystick/gamepad detection
José Expósito [Tue, 1 Mar 2022 19:08:11 +0000 (20:08 +0100)]
evdev: check well-known keyboard keys on joystick/gamepad detection

Create a list of well-known keyboard keys containing one the most
representative key(s) of a group.
The rule is based on the assumption that if the representative key is
present, other keys of the group should be present as well.

The groups are:

 - Modifiers group: KEY_LEFTCTRL.
 - Character group: KEY_CAPSLOCK.
 - Numeric group: KEY_NUMLOCK.
 - Editing keys: KEY_INSERT.
 - Multimedia keys: KEY_MUTE, KEY_CALC, KEY_FILE, KEY_MAIL,
   KEY_PLAYPAUSE and KEY_BRIGHTNESSDOWN.

When 4 of these keys are found, the device is tagged as a keyboard.

Fix #745

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogitlab CI: fail the sanity check stage if the fork is not public
Peter Hutterer [Thu, 24 Feb 2022 00:12:00 +0000 (10:12 +1000)]
gitlab CI: fail the sanity check stage if the fork is not public

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agolibinput 1.20.0 1.20.0
José Expósito [Sat, 19 Feb 2022 12:32:09 +0000 (13:32 +0100)]
libinput 1.20.0

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: add lenovo legion slim 7
Markus Wall [Tue, 15 Feb 2022 18:21:52 +0000 (19:21 +0100)]
quirks: add lenovo legion slim 7

This makes disable-when-typing for the touchpad work properly
on the Lenovo Legion Slim 7.

Signed-off-by: Markus Wall <markuswall@yahoo.se>
2 years agoAdd quirks for Lenovo Legion Y740
Markus Wall [Mon, 14 Feb 2022 13:01:47 +0000 (14:01 +0100)]
Add quirks for Lenovo Legion Y740

This makes disable-when-typing for the touchpad work properly
on the Lenovo Legion Y740.

Tested on Lenovo Legion Y740-15IRHg.

Signed-off-by: Markus Wall <markuswall@yahoo.se>
2 years agodoc/user: clarify fork visibility
José Expósito [Mon, 14 Feb 2022 18:30:34 +0000 (19:30 +0100)]
doc/user: clarify fork visibility

Clarify that when forking libinput the public visibility level should be
selected. Otherwise, CI pipelines will fail on merge requests.

Also, update the fork URL.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodoc: correct the documentation for reporting trackpoint bugs
Peter Hutterer [Thu, 10 Feb 2022 23:29:18 +0000 (09:29 +1000)]
doc: correct the documentation for reporting trackpoint bugs

libinput measure trackpoint-range was removed in 1.12

Fixes #734

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agopad: load libwacom device by path, not by usbid
Alberto Fanjul [Sat, 5 Feb 2022 08:08:35 +0000 (09:08 +0100)]
pad: load libwacom device by path, not by usbid

to avoid conflicts with vendors reusing vid:pid try to find first by path

Signed-off-by: Alberto Fanjul <albertofanjul@gmail.com>
2 years agolibinput 1.19.901 1.19.901
José Expósito [Thu, 3 Feb 2022 06:56:40 +0000 (07:56 +0100)]
libinput 1.19.901

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoUpdate 50-system-hp.quirks with 15-bl000 volume button quirks
Tiger Kaovilai [Thu, 3 Feb 2022 01:28:55 +0000 (01:28 +0000)]
Update 50-system-hp.quirks with 15-bl000 volume button quirks

https://bugzilla.redhat.com/show_bug.cgi?id=2048628

Signed-off-by: Passawit Kaovilai <passawit.kaovilai@gmail.com>
2 years agodoc: document disambiguation between two finger pinch and scroll
José Expósito [Mon, 24 Jan 2022 17:56:40 +0000 (18:56 +0100)]
doc: document disambiguation between two finger pinch and scroll

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogestures: fix disambiguation between two finger pinch and scroll
José Expósito [Mon, 24 Jan 2022 17:55:20 +0000 (18:55 +0100)]
gestures: fix disambiguation between two finger pinch and scroll

The changes introduced in b5b6f835af2e99b6a4e64fb0174ab551ed141763 to
add support for hold gestures introduced a regression:

The mechanism that was in place to improve the disambiguation between
two finger pinch and scroll during the beginning of the gesture stopped
working and instead a bug warning was printed on the log.

Fix the regression by allowing to go from the scroll state to the pinch
state.

Fix #726

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agogitlab CI: update to latest CI templates
Peter Hutterer [Tue, 25 Jan 2022 06:36:48 +0000 (16:36 +1000)]
gitlab CI: update to latest CI templates

This include ci-templates commit 0c312d9c7255f which hopefully fixes our
current headaches with the one non-signed-off commit that somehow
managed to find its way into the repo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: Add Asus ROG Strix G15 2021 keyboard quirk
spacefreak86 [Thu, 20 Jan 2022 04:44:07 +0000 (04:44 +0000)]
quirks: Add Asus ROG Strix G15 2021 keyboard quirk

2 years agotools: remove hardcoded value for boolean quirks
José Expósito [Sat, 15 Jan 2022 12:45:48 +0000 (13:45 +0100)]
tools: remove hardcoded value for boolean quirks

When a boolean quirk was displayed its real value was ignored and
instead a hardcoded value of 1 was always used.

Get the quirk real value and display it.

Fix #725

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agowheel: allow to scroll while middle button is pressed
José Expósito [Wed, 29 Dec 2021 17:17:02 +0000 (18:17 +0100)]
wheel: allow to scroll while middle button is pressed

Since cd4f2f32b57a ("fallback: disable mouse scroll wheel while middle
button is pressed") the mouse wheel is inhibited while the mouse wheel
is pressed.

The original intention of this feature was to avoid unintended scroll
while pressing the scroll wheel. However, now that high-resolution
scroll is fully integrated in libinput we can improve this feature and
filter unintended scroll (below half a detent) and allow it when it is
intended (over half a detent).

Remove the "WHEEL_STATE_PRESSED" state from the wheel state machine and
let the general heuristics handle this case.

Also, remove the specific tests for this feature as now it is covered
by the general test cases.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: Remove Lenovo Trackpoint Keyboard II quirk
José Expósito [Wed, 29 Dec 2021 17:11:55 +0000 (18:11 +0100)]
quirks: Remove Lenovo Trackpoint Keyboard II quirk

The device sends its own scroll events when its trackpoint is moved
while the middle button is pressed.

Because scroll events are not going to be inhibited after a certain
amount of scroll is detected in a follow up commit, remove the quirk.

This reverts 53bd70f4c7e2 ("quirks: Lenovo Trackpoint Keyboard II")

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agomeson.build: disable -Wunused when building the litest selftest
Peter Hutterer [Wed, 22 Dec 2021 22:18:06 +0000 (08:18 +1000)]
meson.build: disable -Wunused when building the litest selftest

We use check directly to test the various litest bits, so if ifdef out
the litest main() and a few other bits. This results in compiler
warnings that aren't worth fixing - a lot of moving code around for no
real benefit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: silence a clang compiler warning
Peter Hutterer [Mon, 12 Jul 2021 11:09:15 +0000 (21:09 +1000)]
evdev: silence a clang compiler warning

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

2 years agotablet: handle a BTN_TOOL_PEN on top of BTN_TOOL_RUBBER
Peter Hutterer [Wed, 17 Nov 2021 06:24:00 +0000 (16:24 +1000)]
tablet: handle a BTN_TOOL_PEN on top of BTN_TOOL_RUBBER

The Wacom 524C device triggers a kernel bug in the InRange and Invert
handling. Every time BTN_TOUCH is set/unset the device also sets/unsets
BTN_TOOL_PEN even when we nominally have the eraser in proximity.

The event sequence effectively looks like this:

    # on prox in
    BTN_TOOL_RUBBER 1
    -- SYN_REPORT ---
    # on tip down
    BTN_TOOL_PEN 1
    BTN_TOUCH 1
    -- SYN_REPORT ---
    # on tip up
    BTN_TOUCH 0
    BTN_TOOL_PEN 0
    -- SYN_REPORT ---
    # on prox out
    BTN_TOOL_RUBBER 1
    -- SYN_REPORT ---

To work around this, bias our duplicate tool detection code towards the
eraser - if we have an eraser in-prox already and the pen goes
in-prox, ignore it and continue with the eraser. But if we have a pen
in-prox and the eraser goes in-prox as well, force a prox-out for the
pen and put the eraser in-prox.

Recording originally from
https://github.com/linuxwacom/xf86-input-wacom/issues/186

Fixes #702

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add a test device for the Wacom 524C device
Peter Hutterer [Wed, 17 Nov 2021 04:29:35 +0000 (14:29 +1000)]
test: add a test device for the Wacom 524C device

This device triggers a kernel bug in the InRange and Invert handling,
every time BTN_TOUCH is set the device also sets BTN_TOOL_PEN even when
we currently have the eraser in proximity.

Recording from https://github.com/linuxwacom/xf86-input-wacom/issues/186

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: allow for a hold end event when verifying touch motion
Peter Hutterer [Wed, 8 Dec 2021 06:26:16 +0000 (16:26 +1000)]
test: allow for a hold end event when verifying touch motion

Depending on how quick the test suite runs we may get a hold end event
here. Let's silently ignore that one since we aren't interested in it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agogestures: do not use thumb for pinch when is used to press the clickpad
José Expósito [Wed, 8 Dec 2021 16:32:03 +0000 (17:32 +0100)]
gestures: do not use thumb for pinch when is used to press the clickpad

The changes made in ca3df8a076d54a93b3c2fb8a5eea4326d487050c to improve
pinch detection introduced a regression:

When the thumb is used to press the clickpad it is automatically tagged
as thumb and the gesture state machine does not initialize it, leaving
its initial X and Y position set to 0.
When another finger is put on the clickpad, the distance moved by the
thumb is checked and because its initial position is 0 movement is
detected.

Add an additional check to take into account only thumbs that are used
in the gesture.

Fix #708

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agodoc/user: write an article explaining the different contexts
Peter Hutterer [Tue, 7 Dec 2021 05:39:10 +0000 (15:39 +1000)]
doc/user: write an article explaining the different contexts

This is a common question I need to answer, let's make this a link I can
copy/paste instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotimer: only warn about timer expiry issues when we're more than 20ms behind
Peter Hutterer [Tue, 7 Dec 2021 01:18:07 +0000 (11:18 +1000)]
timer: only warn about timer expiry issues when we're more than 20ms behind

The most common trigger for this is the debouncing timer which is a mere
12ms and is effectively unavoidable, virtually every caller will
trigger those messages at some point.

Let's add a grace period of 20ms below which we don't log this message
to avoid logspam. And in the process, bump the equivalent warning
message up to 20ms as well.

Related #711

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotimer: rate-limit the "timer expiry in the past" error messages
Peter Hutterer [Tue, 7 Dec 2021 01:11:32 +0000 (11:11 +1000)]
timer: rate-limit the "timer expiry in the past" error messages

We already ratelimit the normal notification about event processing
lagging behind but in the case of timers actually expiring late, we'd
pass those messages on. So lots of clicks on a slow-reponse system
resulted in lots of messages triggered by the debounce timers.

Use the same ratelimiting as the event processing warning, 5 messages
per hour which should be a good balance between warning and not spamming
the log.

Fixes #711

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoevdev: improve joystick and gamepad detection
José Expósito [Tue, 23 Nov 2021 17:07:53 +0000 (18:07 +0100)]
evdev: improve joystick and gamepad detection

The EVDEV_UDEV_TAG_JOYSTICK is set when a joystick or gamepad button
is found. However, it can not be used to identify joysticks or
gamepads because there are keyboards that also have it. Even worse,
many joysticks also map KEY_* and thus are tagged as keyboards.

In order to be able to detect joysticks and gamepads and
differentiate them from keyboards, apply the following rules:

  1. The device is tagged as joystick but not as tablet
  2. It has at least 2 joystick buttons
  3. It doesn't have 10 keyboard keys

Fix #701
Fix #415
Fix #703

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoevdev: refactor joystick/gamepad detection
José Expósito [Tue, 23 Nov 2021 17:07:27 +0000 (18:07 +0100)]
evdev: refactor joystick/gamepad detection

Move the logic to detect joysticks and gamepads to its own function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotouchpad: revert the clickpad detection mechanism
José Expósito [Thu, 2 Dec 2021 11:52:56 +0000 (12:52 +0100)]
touchpad: revert the clickpad detection mechanism

Use the previous heuristics to detect clickpads where a touchpad was
handled as a clickpad when:

 - The property INPUT_PROP_BUTTONPAD is set
 - The property INPUT_PROP_BUTTONPAD is NOT set but the touchpad only
   has BTN_LEFT

Revert a37d6dcc9c2ec7ebd0d3609e01da1cfcec28db6e:
"touchpad: if we have a right button, let's assume it's not a clickpad"
MR:  https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/614
BUG: https://gitlab.freedesktop.org/libinput/libinput/-/issues/595

Fix #704

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agoquirks: changes touchpad pressure Lenovo Yoga 2 Pro
Joaquin Gonzalez [Tue, 16 Nov 2021 05:40:07 +0000 (02:40 -0300)]
quirks: changes touchpad pressure Lenovo Yoga 2 Pro

Adds touchpad pressure configuration for Lenovo Yoga 2 Pro in order to avoid random cursor jumps on finger up.

Signed-off-by: Joaquin Gonzalez <joaquin.gonzalez.uy@gmail.com>
2 years agodoc/user: fix broken link to "Observations on trackpoint input data"
José Expósito [Sun, 28 Nov 2021 12:49:14 +0000 (13:49 +0100)]
doc/user: fix broken link to "Observations on trackpoint input data"

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2 years agotest: add a tablet test for eraser tip down
Peter Hutterer [Wed, 17 Nov 2021 05:55:22 +0000 (15:55 +1000)]
test: add a tablet test for eraser tip down

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add missing tool event in the aiptek tablet test device
Peter Hutterer [Wed, 17 Nov 2021 22:21:42 +0000 (08:21 +1000)]
test: add missing tool event in the aiptek tablet test device

Needed for eraser tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agotest: add tip down/up helper functions
Peter Hutterer [Wed, 17 Nov 2021 04:46:07 +0000 (14:46 +1000)]
test: add tip down/up helper functions

Add two helper functions that set/unset BTN_TOUCH together with the
specified axes and switch all tests over.

Devices can override the tip down/up sequence.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2 years agoquirks: add ModelBouncingKeys for A4Tech X-710BK Mouse
Alexander Radovich [Tue, 16 Nov 2021 06:38:06 +0000 (07:38 +0100)]
quirks: add ModelBouncingKeys for A4Tech X-710BK Mouse

Signed-off-by: Alexander Radovich <rexuru17@gmail.com>