Commit graph

4653 commits

Author SHA1 Message Date
Peter Hutterer
562f7bcee0 libinput 1.20.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-04-20 15:24:35 +10:00
Peter Hutterer
2a8b8fde90 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>
(cherry picked from commit a423d7d326)
2022-04-20 14:08:15 +10:00
José Expósito
7850e4aecd libinput 1.20.0
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-02-19 13:32:09 +01:00
Markus Wall
4d5d6e7b4e 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>
2022-02-15 20:02:38 +01:00
Markus Wall
e3b99fb394 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>
2022-02-15 06:34:55 +00:00
José Expósito
dc86d66a32 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>
2022-02-14 19:30:34 +01:00
Peter Hutterer
6914b41de5 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>
2022-02-11 07:45:40 +00:00
Alberto Fanjul
748280f9de 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>
2022-02-07 21:26:47 +01:00
José Expósito
8e41089584 libinput 1.19.901
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-02-03 07:56:40 +01:00
Tiger Kaovilai
232c99341d 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>
2022-02-03 01:28:55 +00:00
José Expósito
e9ccd4f402 doc: document disambiguation between two finger pinch and scroll
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-01-27 08:35:30 +01:00
José Expósito
8f53377680 gestures: fix disambiguation between two finger pinch and scroll
The changes introduced in b5b6f835af 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>
2022-01-27 08:35:30 +01:00
Peter Hutterer
e9aba30a78 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>
2022-01-27 09:16:46 +10:00
spacefreak86
7d309cc101 quirks: Add Asus ROG Strix G15 2021 keyboard quirk 2022-01-20 04:44:07 +00:00
José Expósito
c8d75da26d 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>
2022-01-15 13:45:48 +01:00
José Expósito
cf6c97119f wheel: allow to scroll while middle button is pressed
Since cd4f2f32b5 ("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>
2021-12-30 08:32:40 +01:00
José Expósito
cddf956990 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 53bd70f4c7 ("quirks: Lenovo Trackpoint Keyboard II")

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-12-29 18:11:55 +01:00
Peter Hutterer
e4548f5805 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>
2021-12-23 08:18:06 +10:00
Peter Hutterer
5a568cfaf0 evdev: silence a clang compiler warning
Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
2021-12-22 15:07:56 +10:00
Peter Hutterer
57a592e2df 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>
2021-12-14 08:09:20 +00:00
Peter Hutterer
167cebf7de 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>
2021-12-14 08:09:20 +00:00
Peter Hutterer
23f5d9074b 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>
2021-12-14 08:09:20 +00:00
José Expósito
1262c81d9b gestures: do not use thumb for pinch when is used to press the clickpad
The changes made in ca3df8a076 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>
2021-12-14 05:42:35 +00:00
Peter Hutterer
00e0c17688 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>
2021-12-13 10:35:24 +10:00
Peter Hutterer
a1e9150210 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>
2021-12-07 11:54:08 +10:00
Peter Hutterer
64a49d18b9 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>
2021-12-07 11:18:01 +10:00
José Expósito
8dd8786c48 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>
2021-12-03 00:20:47 +00:00
José Expósito
a694a06b92 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>
2021-12-03 00:20:47 +00:00
José Expósito
fbe5d35dca 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 a37d6dcc9c:
"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>
2021-12-02 12:00:52 +00:00
Joaquin Gonzalez
0bd1560750 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>
2021-11-29 04:34:06 +00:00
José Expósito
556e4114b8 doc/user: fix broken link to "Observations on trackpoint input data"
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-28 13:49:14 +01:00
Peter Hutterer
aa7da4c0d9 test: add a tablet test for eraser tip down
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-24 06:17:31 +00:00
Peter Hutterer
9f62995eea 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>
2021-11-24 06:17:31 +00:00
Peter Hutterer
878d00b0e9 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>
2021-11-24 06:17:31 +00:00
Alexander Radovich
35c5ef4e30 quirks: add ModelBouncingKeys for A4Tech X-710BK Mouse
Signed-off-by: Alexander Radovich <rexuru17@gmail.com>
2021-11-23 17:15:22 +00:00
Peter Hutterer
8fecb19147 Use bit(foo) instead of (1 << foo)
Translates to the same thing, but the bit() helper is nicer and less
likely to be typoed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-18 10:11:43 +10:00
Peter Hutterer
b5f0536a4f quirks: add a quirk for the Wacom 524c device
Has tilt, doesn't use it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-18 08:32:48 +10:00
Peter Hutterer
69a3ed420f quirks: make a wacom quirk more descriptive
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-18 08:32:48 +10:00
Peter Hutterer
86698c8184 doc/user: add an example udev rule for LIBINPUT_IGNORE_DEVICE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-16 06:47:48 +00:00
Peter Hutterer
3cb39abe9b doc/user: expand the udev rules for better readability
Split it over multiple lines and use fake cat command to show where that
rule could live.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-16 06:47:48 +00:00
Peter Hutterer
d1f274c781 quirks: add a more generic match for the 5288 Synaptics clickpad
This is a clickpad announcing BTN_RIGHT in different machines, see
issue #674, #689, #629 and MR !701. There are at least 4 machines that
ship with this device that we had to quirk independently, possibly
others so disabling BTN_RIGHT on all of them makes sense.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-11-10 22:19:48 +00:00
Gary Wolfe
607abecfbd quirks: Dell 15R touchpad settings for firmware v3
Trackpad sensitivity adjustment only needed for v3 for Dell Inspiron 15R N5110.
Fixes #565 and #676.

Signed-off-by: Gary Wolfe <avidgamefan@yahoo.com>
2021-11-09 05:29:06 +00:00
José Expósito
beea00bc7a gestures: rename event handlers
Follow the name convention used in evdev-wheel.c and rename the handle
event functions from "tp_gesture_[STATE]_handle_event" to
"tp_gesture_handle_event_on_state_[STATE]".

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-09 04:58:07 +00:00
José Expósito
d21f1ab7ab wheel: accumulate scroll when direction changes
Most mice with high-resolution support have a mechanism in place to
adjust the wheel to a detent. When scrolling, it is possible to stop
between two detents and this mechanism could generate a small amount of
scroll in the oposite direction.

Track the scroll direction in the wheel state machine and reset it when
the direction changes to avoid this issue.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-08 18:00:46 +01:00
José Expósito
b6a944bb80 wheel: ignore initial small scroll deltas
Mice with high-resolution support can generate deltas when the finger is
put on the wheel or when the user tries to click the wheel.

To avoid sending involuntary scroll events, add an extra state the the
wheel state machine to accumulate scroll deltas.
While the accumulated scroll is lower than a certain threshold, ignore
them until the threshold is reached.

Since no finish event is sent by the mouse, reset the state machine
after a period of scroll inactivity.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-08 18:00:46 +01:00
José Expósito
08245c778a wheel: handle with a state machine
In order to be able to add more complex rules in the future, transform
the current wheel handling code into a state machine.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-08 18:00:46 +01:00
José Expósito
5f0d191eba wheel: refactor wheel scroll flushing
Move the logic to flush wheel scroll to it's own funtion.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-08 18:00:46 +01:00
José Expósito
4e52f03580 wheel: centralize wheel handling
Move the logic to handle wheels to its own file.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-08 18:00:34 +01:00
José Expósito
5e44861e0e gestures: cancel hold gestures on thumb detection
Before hold gestures where implemented, when a thumb was detected it
was enough to reset the state machine.
However, now it is possible to detect a thumb while a hold gesture is
in course.

Cancel any ongoing gesture when a thumb is detected to avoid dropping
the gesture end event.

See #693

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-11-04 18:40:54 +01:00
José Expósito
be3c09bc15 doc/user: fix broken link to systemd 60-evdev.hwdb
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-10-30 12:10:10 +02:00