Compare commits

...

1906 commits
1.14.3 ... main

Author SHA1 Message Date
Peter Hutterer
ef9624a16b evdev: store the SYN_REPORT value in the frame
If the SYN_REPORT has a value of nonzero we need to keep that value in
the frame - our upper layers rely on this to detect repeat frames.

Closes #1261

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1449>
2026-03-19 00:09:30 +00:00
GKraats
dcbfbc4cf1 util: fix usec computation on 32 bits
Enforce the needed 64-bit computing on 32 bits.

Signed-off-by: GKraats <vd.kraats@hccnet.nl>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1446>
2026-03-18 00:25:48 +00:00
Peter Hutterer
ad857a51a4 tools/record: fix delta times not being relative
Missing last_time assignment caused the delta time between events to be
the total time.

Fixes: a202ed6115 ("Use a newtype usec_t for timestamps for better type-safety")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1448>
2026-03-17 05:05:14 +00:00
Peter Hutterer
a521d054d4 tools: fix leak of evdev_prev in libinput-record
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
Peter Hutterer
f86d5ab2ab test: add missing button state assertion for eraser button release
The second 'Expect button event' block in
tablet_eraser_button_different_buttons is missing the button state
assertion that the first block has. This event should be a
BUTTON_STATE_RELEASED (the eraser left proximity), but without the
check the test passes even if the state is wrong.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
Peter Hutterer
32fd9ec95f tools: Remove dead eraser_button_button initialization to BTN_STYLUS
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
Peter Hutterer
45150cc6ec tools: fix missing fd assignment in libinput-debug-tablet
The fd opened for the evdev device is never stored in ctx->fds[1].fd
so we never poll for it. Real impact was limited since we do poll for
the libinput fd and we process libevdev events whenever any of the fds
triggers.

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
Peter Hutterer
c8c1c07a2a tools: fix swapped fread arguments causing DMI modalias to always be "unknown"
fread(buf, sizeof(buf), 1, dmi) reads one block of 2048 bytes,
returning the number of complete blocks (0 or 1). Since DMI modalias
files are always shorter than 2048 bytes, fread returns 0 even when
data was successfully read into buf. The 'if (n > 0)' check then
always fails and the DMI string stays as "unknown".

Swap the size and nmemb arguments so fread returns the number of
bytes read instead.

Fixes: 0ecd08c134 ("tools: use __attribute__(cleanup)")

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
Peter Hutterer
b1f478b897 tools: fix pencil tablet tool type in libinput-record
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:45 +00:00
Peter Hutterer
333d7131ab tools: fix swapped strstartswith arguments in find_device()
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:45 +00:00
Peter Hutterer
cd9d6c66fd tablet: fix eraser button get_default_mode/get_default_button return values
Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:45 +00:00
Peter Hutterer
a0dc0997f5 meson.build: explicitly convert a boolean to string
Fixes:
  DEPRECATION: Variable substitution with boolean value 'MESON_ENABLED_DEBUG_GUI' is deprecated.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1445>
2026-03-13 12:15:21 +10:00
Peter Hutterer
c6813dc7d8 tools: add --compress-motion-events to the man page and zsh completion
Fixes: dc249b0ffe ("tools/debug-events: add ability to compress motion events")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1443>
2026-03-11 14:22:40 +10:00
Ilya Kamenko
8dd25ece10 Fold hold-to-scroll into existing scroll button lock mode
Instead of adding a new ENABLED_HOLD enum value, modify the existing
ENABLED lock mode so that hold+scroll+release doesn't engage the lock.

Add a 500ms grace period: if the button was held and used to scroll for
longer than 500ms, releasing the button does not engage the lock
(temporary scroll). If released within 500ms (e.g. shaky hands
triggering accidental motion), the lock still engages as before.

This fixes the unintuitive behavior where the lock engages even after
actively scrolling, without requiring new API surface.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1259

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1435>
2026-03-10 23:12:25 +00:00
Mingcong Bai
43547b461b quirks: add Goodix pressure pad quirk for 27C6:01E7
This touchpad is found on the newly released Lenovo ThinkBook G8+ IPH.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1442>
2026-03-10 11:37:34 +08:00
David Santamaría Rogado
2ddc734114 test: set ID_INTEGRATION into test devices
Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1429>
2026-03-10 02:27:36 +00:00
David Santamaría Rogado
819e943ab0 evdev: use udev's ID_INTEGRATION
Now we have in udev the ID_INTEGRATION propery that tells us if a device
is internal or external, use it while still allow hwdb and quirks to
override it.

In the future is possible that we could remove quirks for keyboards
integration and hwdb for touchpads and joysticks integration.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1429>
2026-03-10 02:27:36 +00:00
David Santamaría Rogado
1c82aa1659 quirks: add some more goodix haptic touchpads
Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1440>
2026-03-09 09:48:05 +01:00
David Santamaría Rogado
526130fe8d quirks: hp omnibook ultra flip 14 touch pressure
Add pressure attributes to make libinput measure touchpad-pressure
behave right.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1430>
2026-03-09 01:34:07 +00:00
David Santamaría Rogado
b95840d36e quirks: hp omnibook ultra flip 14 improve rule set
Some initial units had 14t-fh000 instead 14-fh0xxx in their product name
but they are exactly the same model.

We could match both in product version SBKPF or in board product name
8CDE. Match board as seems the way hp-wmi kernel module uses to match.

While at it rewrite the entire huge comment to a little less huge
comment but with more really interesting info.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1430>
2026-03-09 01:34:07 +00:00
Peter Hutterer
7726350420 tablet: allow for the eraser button to be any button
The previous restriction was BTN_STYLUS* or any button the pen
advertises. This is too restrictive - it works well enough for any pen
with less than 3 buttons (BTN_STYLUS3 is always available on those) but
otherwise it cannot work. A 3-button pen may not advertise any other
buttons, leaving us with the eraser button being a duplicate button. And
events cannot be distinquished between eraser button or real button.

Open up the configuration to effectively any BTN_ event code.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1436>
2026-03-09 01:14:21 +00:00
Peter Hutterer
cdcb827365 Fix the evdev_usage_is_button check for the BTN_STYLUS group
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1436>
2026-03-09 01:14:21 +00:00
Peter Hutterer
0a3ecbea24 tablet: fix missing linebreak after an error message
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1436>
2026-03-09 01:14:21 +00:00
BBaoVanC
db62bf7ab1 quirks/apple: Add AttrSizeHint to Magic Trackpad USB-C
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1437>
2026-03-04 04:53:28 +00:00
David Santamaría Rogado
9eae99d4fe quirks: microsoft surface keyboard event BTN_0
Apply AttrEventCode=-BTN_0 to all surface keyboards.

Fixes: #1251.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1431>
2026-02-22 08:40:11 +00:00
David Santamaría Rogado
a86b8a0008 doc: list-quirks should be quirks list
while at it replace also a code comment in the same line.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1432>
2026-02-20 19:56:46 +01:00
Sicelo A. Mhlongo
3428edf1ea doc/user: document keypad slide switch support
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1428>
2026-02-17 12:03:56 +02:00
Peter Hutterer
659967488e libinput 1.31.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2026-02-13 09:25:46 +10:00
Lorenzo Ianotto
b9fc550f28 Set ModelTabletModeNoSuspend only for Thinkpad S1 Yoga and X1 Yoga 1st gen
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1425>
2026-02-09 02:42:33 +00:00
Richie Roy Jayme
df8f5a3627 quirks: add quirk support for Goodix touchpad
This commit adds a specific vendor HWID for Goodix Haptic Touchpad to
improve detection and handling.

Signed-off-by: Richie Roy Jayme <rjayme.jp@gmail.com>
Signed-off-by: Richie Roy Jayme <rjayme2@lenovo.com>
Reviewed-by: Vishnu Sankar <vishnuocv@gmail.com>
Reviewed-by: Vishnu Sankar <vsankar@lenovo.com>
Reported-by: Ameer Ivan Julkarnain <ajulkarnain1@lenovo.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1426>
2026-02-07 08:27:58 +00:00
Peter Hutterer
e0ba559117 libinput 1.30.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1424>
2026-02-04 12:41:58 +10:00
Peter Hutterer
e78f4f689d util: add guards for the etrace/trace defines
This file is really useful on its own for other projects if
auto-included via export CFLAGS="$CFLAGS -include /path/to/file.h"
However, that causes compiler warnings, let's add indef checks for this
as a quick workaround.

Since these three come as a set and are only used for debugging, we can
ifndef them all in one go rather than individually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1423>
2026-02-04 11:18:54 +10:00
Peter Hutterer
ad89a83ae6 tablet: ignore the tablet tool name if it's a generic tool
libwacom has generic pens that are used for devices that don't have tool
ids. Let's ignore the names for those pens since they're just made up
names anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1422>
2026-02-03 23:27:14 +00:00
Peter Hutterer
6d514ee6fa touchpad: add get_default_timeout for dwt and dwtp
I doubt this is really needed but our convention for all config options
is set/get/get_default so let's stick with that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1421>
2026-02-03 13:01:59 +10:00
David Santamaría Rogado
6f79797308 test: recover external usb keyboard touchpad combo
This recovers the testing that a USB keyboard plus touchpad combo both
set as external, only its own keyboard should affect to DWT that was
removed when Acer Hawaii combo was set as internal.

This is uncommon as usb touchpads nowadays are set as internal, but,
perhaps someone that adds a quirk for a really external combo also adds
in udev's hwdb the external integration for the touchpad, or perhaps we
should set the integration to external when AttrTPKComboLayout=below is
used for the touchpad.

The issue is if the touchpad is leave as internal every keyboard affect
DWT, not only the one that belongs to its combo.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1415>
2026-02-02 09:52:08 +00:00
Michał Chojnowski
b58d5a165b tablet: fix handling of AttrPressureRange quirk
tablet_get_quirked_pressure_thresholds() is wrong:
the pressure thresholds for tip press and tip release are swapped around.
This seems to be a regression introduced in commit 4bc27543e9.

This prevents AttrPressureRange from working as intended for tablets,
and causes weird things to happen if it's set.
(For example, when pressure is in the range between
the intended release threshold and the intended press threshold,
the "pressed" status flip-flops between 0 and 1 every frame).

Fix that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1420>
2026-02-02 08:41:24 +01:00
Peter Hutterer
fe1d44637f touchpad: add support for fast swipe when 3fg drag is enabled
This adds a movement threshold (5mm) and a timeout (80ms) to the 3fg
drag gesture. On 3fg down with 3fg drag enabled we immediately send a
GESTURE_SWIPE event. After the timeout expires we check the movement of
the fingers - if it is below the threshold cancel the swipe and hold a
button down (i.e. a 3fg drag). Otherwise, continue with this being a
swipe.

This allows for swipe gestures to be used while 3fg drag is enabled.

Above applies the same way for 4fg with 4fg drag enabled.
Thresholds selected using the "yeah, that seems about alright" method,
intentionally quite low because we assume that users that enable 3fg
drag prefer 3fg dragging over swipe.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1410>
2026-02-02 06:44:48 +00:00
Peter Hutterer
5b7b8f1bb2 gestures: remove two empty helper functions
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1410>
2026-02-02 06:44:48 +00:00
Peter Hutterer
33b1d87c08 touchpad: don't disable on external mice until we see an event
Instead of disabling the touchpad as soon as a mouse is seen by
libinput, disable it as soon as a mouse sends an actual event. This
works around the current issues with many devices (touchpads and
keyboards alike) announcing a HID Mouse Application Collection which
gets its own event node in the kernel. That event node usually just sits
there and does nothing but its mere presence disabled the touchpad.

Let's change this and instead only disable once we see an event.

Closes: #1104
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1414>
2026-01-28 00:43:37 +00:00
Peter Hutterer
89351c715a test: parametrize the external mouse test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1414>
2026-01-28 00:43:37 +00:00
Peter Hutterer
e161abdc19 evdev: rename evdev_paired_keyboard to evdev_paired_device
We'll be using this struct for other devices than keyboards.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1414>
2026-01-28 00:43:36 +00:00
David Santamaría Rogado
47482bcd8b quirks: add more specific matches to actual quirks
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1418>
2026-01-27 00:43:51 +00:00
David Santamaría Rogado
307d2509a9 quirks: merge ibm with lenovo
ScrollPoint mouses as well IBM USB Travel Keyboard with Ultra Nav Mouse
are owned by Lenovo.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1419>
2026-01-27 00:19:16 +00:00
Peter Hutterer
86f19a0978 lua: install a timeout hook before any pcalls to prevent infinite loops
If a lua pcall takes longer than one second, kill the plugin.

How often to call the timeout handler is a trade-off but we err on the
side of "possibly too high" since the overwhelmingly vast majority of
plugins will never trigger it anyway.

Gemini suggests that Lua 5.4 can do ~500k ops per second for string
concat (the slowest listed), Claude suggests 1 to 10 million ops per
second. The test in this patch on my 4y old cheap desktop runs the
timeout hook roughly every 37ms. Any normal plugin will be well and
truly done with its work by then.

Closes: #1245
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1416>
2026-01-27 00:02:15 +00:00
Helga K
cc1499fbb3 quirks: Add quirk for Gigabyte Aorus 15BKF keyboard
This keyboard sits on the USB bus, so it's considered an external
keyboard by default. This commit changes that to internal
so that DWT detection on the laptop touchpad works.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1411>
2026-01-22 15:59:42 +04:00
Jens Peters
8854066e93 plugin: add an example for controlling a mouse with a tablet
This plugin controls a mouse/pointer from a tablet device. This
effectively hides stylus interactions and sends pointer events
instead. In other words: mouse emulation for tablets, implemented
by (remote) controlling a mouse device. This allows using a
tablet stylus as a mouse replacement without tablet limitations
from compositors or clients. Note that axis usually needed for
drawing (like pressure, tilt or distance) are no longer emitted
when this plugin is active and a mouse is connected. When no
mouse is connected, this plugin doesn't change tablet events,
thus the stylus works like a normal stylus.

Follow up from https://gitlab.freedesktop.org/libinput/libinput/-/issues/1195

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1412>
2026-01-21 08:44:13 +00:00
Peter Hutterer
074a6f57b8 test: fix some comments for accuracy
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 14:59:02 +10:00
Peter Hutterer
9f096b0403 test: move two helper functions into the only caller
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 14:59:02 +10:00
Peter Hutterer
328b9a8a32 test: fix the gesture hold cancel test
This didn't actually check for the cancellation of the gesture, so let's
add that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 14:59:02 +10:00
Peter Hutterer
7ff2326efb test: change the gesture state color to normal yellow
The current color is unreadable on my screens and since no-one else
really looks at this much, let's change it for my benefit.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 14:59:02 +10:00
Peter Hutterer
6bca272629 test: parametrize a gesture test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 14:59:02 +10:00
Peter Hutterer
00e568f43a test: correct a copy/pasted comment
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 13:14:24 +10:00
Peter Hutterer
13405e4b8c test: add missing BTN_TOOL_QUINTTAP to the acer hawaii test device
This recording comes from
https://bugs.freedesktop.org/show_bug.cgi?id=99140 and it's set there so
this si presumably a copy/paste issue.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 11:49:58 +10:00
Peter Hutterer
bee28a7e53 test: remove a leftover etrace()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1413>
2026-01-20 11:49:58 +10:00
Peter Hutterer
dee2d38476 Add libinput_tablet_tool_get_name() for the tool's specific name
If the tool has a name let's provide that to the caller. We have it
easily accessible so let's export it to make everyone's life easier. The
name is provided by libwacom, there is no need for us
to even copy that value since we don't need it ourselves.

Note that at this point effectively only (some) Wacom devices have
meaningful names. Virtually all non-wacom devices will use a generic
tool and even the built-in Wacoms will largely just say "AES Pen".

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1399>
2026-01-14 16:44:01 +10:00
Peter Hutterer
7d19cb5f40 CI: rebuild to pick up newer libwacom on Fedora 43
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1399>
2026-01-14 09:27:28 +10:00
Peter Hutterer
21ac8568d5 CI: temporarily drop FreeBSD
14.2 is 404 so we cannot rebuild any images and,
14.3 has a bug that blocks it from building images:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292375

So let's disable BSD until the bug is fixed.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1409>
2026-01-13 22:42:07 +00:00
Peter Hutterer
6b4d1905b6 plugin: always disable wheel debouncing on request
The WHEEL_STATE_NONE check was effectively always false:
- if we didn't receive any event yet, wheel_maybe_disable() wasn't
  called in any code path
- if we did receive a scroll event, the wheel state was either
  WHEEL_STATE_SCROLLING or WHEEL_STATE_ACCUMULATING_SCROLL

Fix this two-pronged: remove the check for WHEEL_STATE_NONE but also
immediately call disable when we disable the feature. We don't carry
enough state in this plugin to really worry about the device being in
a fully neutral state (and realistically the vast majority of use-cases
will likely disable wheel debouncing on new device anyway).

Closes #1241

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1408>
2026-01-13 21:52:52 +00:00
Peter Hutterer
005a3e5622 test: remove a leftover etrace()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1408>
2026-01-13 21:52:52 +00:00
David Santamaría Rogado
2772863af0 quirks: separate logitech quirks
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1407>
2026-01-13 01:50:51 +00:00
David Santamaría Rogado
47312e99d8 quirks: wipe HP Elite x2 G3 keyboard and touchpad
Actually not needed using internal approach.

Keyboard is ps2 wired in pogo pins and touchpad is usb, both internal by
default so dwt is in effect.

If tablet side buttons are also within ps2, they are not going to be
disabled as chassis is detachable.

Tablet mode switch untouched as is unclear if actual kernels play nice
with it.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1406>
2026-01-13 01:53:28 +01:00
David Santamaría Rogado
24ac440ecc quirks: add edit warning where missing
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1405>
2026-01-13 01:00:19 +01:00
David Santamaría Rogado
0110512b3e quirks: huawei better use pn instead pvr
Huawei MateBook X 2020 used M1010 product version but is used within
different Matebook X over the years.

Use EUL-WX9 product name instead.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1403>
2026-01-12 03:49:00 +01:00
David Santamaría Rogado
605abf2f37 quirks: normalize dmi matches
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1403>
2026-01-12 03:49:00 +01:00
David Santamaría Rogado
9a036bec30 test: set usb touchpad as internal
Actually all usb touchpads are internal by default, reflect this in the
acer touchpad definition.

This causes that not only the acer keyboard in its group activates DWT
but all the intenal keyboards.

Remove asserting that other keyboards doesn't affect DWT as that is the
intended behaviour.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1400>
2026-01-10 23:33:41 +01:00
Peter Hutterer
731d4452c3 meson: revamp the debug build detection for the builddir lookup
Ifdef out any special behavior we want so we no longer leak this via
strings in the resulting binary. Ideally we want the compile to fail for
anything missed rather than surprising behavior when we try to access
files in the build directory.

Closes: #1230
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1396>
2026-01-10 10:39:21 +00:00
David Santamaría Rogado
48e367e841 quirks: missing matches
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1402>
2026-01-10 10:23:19 +00:00
David Santamaría Rogado
1e9b81f75d quirks: refactor pixart touchpads
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1401>
2026-01-09 18:46:40 +01:00
David Santamaría Rogado
02b495e790 quirks: internal integration for lenovo detachable
These are quirks needed for Lenovo detachable devices by setting the
keyboard as internal to enable DWT and act as if it's a laptop.

Here we try to cover all the ideapad ones.

Also remove a quirk in Chicony that sets the touchpad below to enable
DWT, prefer to set the keyboard as internal as touchpad position is
intended for external ones like the input device we also move to the
bottom in Lenovo to have all pure input device quirks in one place.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1389>
2026-01-09 02:44:11 +00:00
Peter Hutterer
822a6d9365 tools: make the touchpad-pressure thresholds interactive
Easier to play around with than having to re-start with different
commandline arguments all the time.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1394>
2026-01-09 02:21:13 +00:00
Peter Hutterer
49624ace16 tools: use box-drawing characters for the table in touchpad-pressure
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1394>
2026-01-09 02:21:13 +00:00
Peter Hutterer
82cbbdab78 test: add (a broken) test for a second range config
This tests for a known bug in the implementation rather than the ideal case
how it should work.

The config is applied to the tool and on prox out to the current tablet
but then the tool goes in prox on a new tablet and the configuration
doesn't get applied there. In the test we work around this by injecting
an extra proximity event to get the range applied.

This needs some rework in the evdev-tablet code but it's questionable
whether it makes a difference given the small number of users with
multiple tablets and pressure ranges set.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1397>
2026-01-09 02:01:14 +00:00
Peter Hutterer
47c7bd934a test: fix the multiple-tablet-pressure-range test
The previous test was incomplete, add support for setting pressure
ranges and generally expand and tighten up the test case so it tests
more specficially for the expected events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1397>
2026-01-09 02:01:14 +00:00
Peter Hutterer
ef1ee837e4 test: allow overriding any axis value
Previously test devices had to set LITEST_AUTO_ASSIGN to be able
to override an axis-specific value. But this prevented us from
easily overriding other axis values (e.g. tablet tool ids) that usually
have the same value.

LITEST_AUTO_ASSIGN should indicate a value that must always be
auto-assigned, that makes a lot more sense.

This does mean we need to handle ABS_MT_TRACKING_ID -1 to avoid that
getting overwritten by auto_assign_tablet_value() but oh well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1398>
2026-01-09 01:47:13 +00:00
Peter Hutterer
c8e0312195 test: don't assign -1/-1 to x/y on proximity out
This only worked because any all our test devices declare a fixed 0
value for x/y in the proximity out event frame. Since 0 !=
LITEST_AUTO_ASSIGN we never got to the litest_scale() for x/y which
would abort because of the -1 value.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1398>
2026-01-09 01:47:13 +00:00
Peter Hutterer
c9e175a507 test: correct overriding ABS_MISC in litest event frames
This still requires LITEST_AUTO_ASSIGN for that value in the test
devices (which no device currently sets) but meanwhile: not scaling
ABS_MISC into a magic range is the correct thing to do.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1398>
2026-01-09 01:47:12 +00:00
David Santamaría Rogado
d5110e1e68 quirks: acer add detachable keyboards
Cover Acer detachable keyboards used in Switch tablet devices to set
them internal and allow DWT.

Move one of them from chicony using the below method.

While at it change the match for internal keyboard in Acer Spin 5 to
rely of bus and type and add ':' before svn dmi match.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1392>
2026-01-06 22:41:37 +00:00
David Santamaría Rogado
130f95fd43 quirks: rework minisforum keyboard and add one
Use ids for Minisforum V3 and remove dmi match.

Also add Minisforum V3 SE one.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1395>
2026-01-06 13:58:57 +01:00
David Santamaría Rogado
b60416083e quirks: rework tablet mode using chassis type
Don't disable inputs for detachable and tablet devices, they are
physically unplugged from their input devices but tend to have buttons
as internal keyboard in the tablet part that must work always. We know
what kind of device is using the Chassis Type DMI value.

Also remove specific device quirks now covered by the chassis type.

Finally refactor some Lenovo devices using this quirk and redefine Dell
2-in-1 with this quirk using chassis type.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1390>
2026-01-05 04:44:41 +00:00
Peter Hutterer
58228f12f0 tools: fix the man page for the libinput-test command
The way we run this, the feature is appended to the libinput-test
command so this resulted in trying to execute libinput
libinput-test-libinput-test-suite.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1384>
2026-01-05 01:53:41 +00:00
Peter Hutterer
b48ce4c5be test: fix --help output for --filter-deviceless
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1384>
2026-01-05 01:53:41 +00:00
Peter Hutterer
6c2b9dcbde meson.build: add a summary for the test options
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1384>
2026-01-05 01:53:41 +00:00
Peter Hutterer
1d4ce84746 test: only use the quirks srcdir if we have a builddir
Same approach as we already do for other constants though note the
builddir_lookup() hack only works for release builds.

Closes #1230

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1384>
2026-01-05 01:53:41 +00:00
David Santamaría Rogado
08a8e0cc38 quirks: add missing match in synaptic touchpad
Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1391>
2026-01-02 06:07:28 +01:00
David Santamaría Rogado
83966ee306 quirks: remove now not needed entries
The recently added ITE usb keyboard and pressure touchpad entries makes
them unnecessary.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1383>
2025-12-23 21:06:27 +01:00
David Santamaría Rogado
56eec4afca quirks: add another lenovo haptic touchpad quirk
Used at least in another more Lenovo model that the one in the comment
where is actually.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1383>
2025-12-23 20:03:05 +01:00
David Santamaría Rogado
a525b30326 quirks: add Lenovo touchpad quirk in a generic way
Matching in vendor and product covers many models as possible.

01E8 product is always haptic.

01E0 can be or not haptic, leave it outside this and mantain it per
system model. When the kernel detects haptic touchpads the ones that
cannot be differenciated won't need to have quirk neither.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1383>
2025-12-23 18:27:53 +01:00
David Santamaría Rogado
8901ddf354 quirks: define generic quirks for ITE
Actual quirk in ITE vendor changed for a more generic one.
This is a step prior to cleanup other quirks.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1383>
2025-12-23 15:22:30 +01:00
David Santamaría Rogado
3cac03c8b2 quirks: Remove Vaio quirks file
The only rule is already defined for the touchpad in it's vendor file.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1386>
2025-12-22 23:35:05 +00:00
David Santamaría Rogado
3a54526d03 quirks: Move Synaptics touchpad to Hanticks
Synaptics 0911:5288 Touchpad really is a Hantick one, move it.

Also change it to rely on bus and ids because name can vary.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1381>
2025-12-22 22:20:18 +00:00
David Santamaría Rogado
23cd0408cc quirks: HP 14-fh0xxx just match internal touchpad
Apply ModelTabletModeNoSuspend just for internal touchpad no matter what
model is.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1388>
2025-12-22 00:01:34 +01:00
Peter Hutterer
0412fb3d44 pad: fix missing newline for mode group error messages
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1380>
2025-12-17 14:37:59 +10:00
David Santamaría Rogado
a376fe366c quirks: HP 14-fh0xxx rely on bus, ids and type
Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1378>
2025-12-16 21:52:31 +01:00
David Santamaría Rogado
9a07784451 quirks: Sort HP entries alphabetically
Also remove generic HP Haptics Touchpad CFD2 moved to Synaptics.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1378>
2025-12-16 21:51:53 +01:00
David Santamaría Rogado
3cf723451f quirks: Add generic Synaptics quirk found in HP ones
This quirk is a generic one for all the HP laptops with haptic touchpad
so makes more sense here because we are applying it dmi independent
being more difficult to track this change if the touchpad became used in
other vendors.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1378>
2025-12-16 16:35:22 +01:00
Peter Hutterer
2d3e47290c quirks: add a quirk for the RazerBlade182025 keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1379>
2025-12-16 16:54:18 +10:00
Peter Hutterer
5bd7f93c16 doc/user: add a graph of how different contexts work
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1376>
2025-12-12 04:29:13 +00:00
Peter Hutterer
a202ed6115 Use a newtype usec_t for timestamps for better type-safety
This avoids mixing up milliseconds and usec, both by failing if
we're providing just a number somewhere we expect usecs and also
by making the API blindingly obvious that we're in usecs now.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1373>
2025-12-12 04:15:15 +00:00
Peter Hutterer
c0c809aaa1 util: fix documentation issues for newtypes
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1373>
2025-12-12 04:15:15 +00:00
Peter Hutterer
e8dfc3bfd6 util: make the newtype comparision functions return bool
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1373>
2025-12-12 04:15:15 +00:00
Sicelo A. Mhlongo
b3f7b4b1ea evdev: add support for SW_KEYPAD_SLIDE
A few devices have a keyboard/keypad which can be slid under the device,
leaving the device with only touch-based interaction. The corresponding kernel
event is reported as SW_KEYPAD_SLIDE [0]. Implement support in libinput.

Since the position of the switch varies across devices, it cannot always be
certain whether the keypad is usable when the switch is in the set position.
Therefore, do not automatically disable the keyboard.

[0] e68d80b13b/include/linux/linux/input-event-codes.h (L885)

Closes: #1069
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1242>
2025-12-11 13:28:41 +02:00
Peter Hutterer
0285001272 touchpad: make the dwt/dwtp timeout inclusive min/max
This makes it easier in callers that don't really differ between
inclusive and exclusive and makes the visualization in UIs a bit
nicer to look at too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1377>
2025-12-10 03:07:36 +00:00
Peter Hutterer
bde6d07d57 quirks: replace ModelPressurepad with setting INPUT_PROP_PRESSUREPAD
This is the more generic approach and doesn't require us to have any
specific implementation in libinput itself.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
1b4dbb9087 doc/user: minor update to the forcepad/pressurepad documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
d5d38b2ed1 doc/user: fix two typos in ref anchors
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
38b5c2e0cc touchpad: add configurable timeouts to disable-while-trackpointing
Same motivation as in commit
"touchpad: add configurable timeouts to disable-while-typing"

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1372>
2025-12-02 09:24:15 +10:00
Peter Hutterer
20851b5020 touchpad: add configurable timeouts to disable-while-typing
Touchpads that don't give us useful palm detection data are getting more
common (see e.g. our ABS_MT_TOOL_TYPE quirks). On those touchpads we can
only rely on dwt and palm edge detection which means those two must be
more spot on than ever before.

DWT in particular is more prone to user-specific requirements, the
current timeouts have been insufficient for a number of users. So let's
make them more configurable.

Currently limited to >100ms and <5 seconds to avoid DWT being used in
the xkcd workflow style.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1372>
2025-12-02 09:24:15 +10:00
Peter Hutterer
2003ab3aef test: rename a dwt test for better clarity
This is the "short-timeout after a single key press" dwt test so let's
rename it that way

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1372>
2025-12-02 09:20:08 +10:00
Peter Hutterer
4bb6a31894 doc: fix a few miss-hyphenated disable-while-typing comments
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1372>
2025-12-02 09:20:08 +10:00
Peter Hutterer
db6a04665c touchpad: use INPUT_PROP_PRESSUREPAD as signal it's a pressurepad
Because, well, it says so on the box now. No more quirks, hopefully!

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1359>
2025-12-01 21:39:11 +00:00
Peter Hutterer
7621edab05 include: sync headers with kernel 6.18
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1359>
2025-12-01 21:39:11 +00:00
Peter Hutterer
39aea2a8d6 test: silence a valgrind warning
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
2025-11-27 09:32:13 +10:00
Peter Hutterer
7e8298e9ec tablet: when destroying a tablet, unlink the tablet tools
If a caller holds a ref to a tablet tool when the device is
destroyed, the tool didn't get removed from the tablet->tool_list.

Later on tool unref the list_remove() would try to reset the pointers
but the list head was long since freed, causing an invalid write.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
2025-11-27 09:26:54 +10:00
Peter Hutterer
49d9528bdf tablet: after three valid prox out events, unload the forced prox plugin
Once we receive three valid proximity out events for the pen, unload the
plugin that generates forced proximity in events for tablets that
don't send BTN_TOOL_PEN.

Closes #1222

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
2025-11-26 10:55:03 +10:00
Peter Hutterer
1e8901d009 tablet: only apply eraser button settings if we have a device
If the device is unplugged, our tool's last_device is NULL. If a caller
then tries to the toggle the eraser button setting libinput would crash.
Fix this by simply skipping the configuration until the tool goes back
into proximity over some other device (if any).

Closes #1223

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
2025-11-26 10:54:47 +10:00
Peter Hutterer
a6ad084280 tablet: return the wanted eraser button mode/button from the config
This matches our behavior for other settings - always return the
user-configured setting from the configuration API, not the current
setting (which may be delayed until the device is in a netural state).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1370>
2025-11-26 10:32:18 +10:00
Peter Hutterer
11b97edcdc libinput 1.30.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-11-25 13:40:43 +10:00
Peter Hutterer
c2f9ffe17e doc/user: drop references to the touchpad-edge-detector
We've had libinput measure touchpad-size for 5 years now, let's refer
only to that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1368>
2025-11-24 14:29:56 +10:00
Peter Hutterer
21e3a76bf5 libinput 1.29.902 2025-11-18 12:29:32 +10:00
Peter Hutterer
9461d1a9a1 Revert "lua: drop compatibility to 5.1 to allow for luajit"
While luajit seems to be the most popular (and fastest) lua
implementation for higher-level implementations, at the system level
it is relatively unused. Lua 5.4 on the other hand is used by other
system-level components like wireplumber and RPM. In the latter case
this means that lua is already available on every rpm-based distro
without further dependencies.

The performance of 5.4 seems to be acceptable and while luajit may be
faster the extra dependency requires more maintenance. Let's only expose
ourselves to that if absolutely needed.

This is not a strict revert because the code has changed a bit since
with several bugfixes deployed on top.

This reverts commit 2723cadaeb.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1366>
2025-11-18 01:46:53 +00:00
Peter Hutterer
a595f0bd48 lua: export _VERSION so plugins can check the lua version
Since we only support one version this is not very informative but let's
include this now in case we ever need it in the future.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1365>
2025-11-17 16:48:35 +10:00
David Senoner
32ed3060f9 meson.build: use absolute path for callouts in udev rules
Udev rules can be put in many different directories to be found by udev
(see link #1). The callouts can be put only in one specific directory
if you want them to be found by using a relative path (only in
UDEV_LIBEXECDIR, see link #2). By passing the absolute path to the rule
you can make sure the callout will always be found.

Link 1: https://man7.org/linux/man-pages/man7/udev.7.html
Link 2: https://github.com/systemd/systemd/blob/main/src/udev/udev-spawn.c#L289

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1364>
2025-11-12 07:49:18 +01:00
Yinon Burgansky
a12dc6eba3 filter: differentiate scroll wheel from button scrolling to fix wheel speed
Commit 94b7836456 ("filter: support accelerating high-resolution
scroll wheel events") introduced a regression where high-res scroll
wheel events were incorrectly normalized by DPI. Mice with non-default
DPI (e.g., Logitech G502 at 2400 DPI) had their scroll wheel speed
reduced by the DPI ratio (1000/2400), resulting in 2-3x slower
scrolling.

The "noop" filter functions were actually performing DPI normalization
or applying a constant acceleration factor, which is appropriate for
button scrolling but incorrect for scroll wheels that have their own
units.

Add a filter_scroll_type enum (CONTINOUS, WHEEL, FINGER to match the
public events) passed through the filter_scroll interface. Update all
filter implementations to skip acceleration and normalization for wheel
events while maintaining existing behavior for button scrolling and
touchpad scrolling.

The custom acceleration profile continues to accelerate high-res wheel
events as designed.

Fixes: 94b7836456 ("filter: support accelerating high-resolution scroll wheel events")

Closes: #1212

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1363>
2025-11-11 14:43:41 +10:00
Marien Zwart
f6caae2289 quirks: add quirk for MX Master 4
The scrollwheels are similar to the MX Master 3, and need the same
quirks: the horizontal wheel events are inverted (it scrolls "naturally"
by default while the horizontal scrollwheel direction is "traditional"),
and middle-clicking without scrolling is very difficult with high-res
scroll events (from the hid_logitech_hidpp kernel module) enabled.

This adds the device ID seen through Bluetooth, which seems to be the
only one we can add a quirk for:

- When connected using the Bolt receiver, there is no separate device ID
  for the mouse (just the same 046d:c548 ID for the receiver already
  documented as supporting multiple mice).

- When connected through USB, the mouse charges but does not provide HID
  events through USB (it can be used while charging but only by using a
  separate Bluetooth or Bolt connection for HID).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1362>
2025-11-09 00:09:47 +00:00
Jan Hendrik Farr
20a3131947 quirks: add quirk for Google Chromebook Rull
Signed-off-by: Jan Hendrik Farr <kernel@jfarr.cc>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1360>
2025-11-08 23:53:49 +00:00
Marien Zwart
822e571272 doc: fix gitlab remote url
SSH to gitlab.freedesktop.org times out.
ssh.gitlab.freedesktop.org (copied from the Gitlab UI) works..

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1361>
2025-11-08 15:02:59 +11:00
Peter Hutterer
9c78f989fb CI: bump to Fedora 43 and Ubuntu 25.10
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1355>
2025-11-07 15:13:08 +00:00
Peter Hutterer
9b37ffd340 meson.build: fix indentation for the python files
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1357>
2025-11-06 23:46:42 +00:00
Peter Hutterer
b9a04e4d57 meson.build: export the plugin dir via pkgconfig
This is for the system-wide plugindir only - the only path where we'd
expect other packages to put plugins.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1357>
2025-11-06 23:46:42 +00:00
Peter Hutterer
4fd5fe9d30 Fix clang-tidy false positives
Array out of bounds complaints but it's a false positive where
clang-tidy makes up some event flow that cannot happen.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1358>
2025-11-06 23:31:27 +00:00
Peter Hutterer
941aa9f997 plugins: add an example for using a wheel to trigger button scrolling
See https://gitlab.freedesktop.org/libinput/libinput/-/issues/1206

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1356>
2025-11-06 23:18:43 +00:00
Peter Hutterer
b870abd2f3 libinput 1.29.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-11-04 11:58:29 +10:00
Peter Hutterer
ad6f580b6d lua: add select to the list of allowed functions
This function is safe (and was already documented) so let's make sure
it's available.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:15 +00:00
Peter Hutterer
4ffd8ab544 lua: fix the event type/code loops - EV_MAX/ABS_MAX is inclusive
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:15 +00:00
Peter Hutterer
eac44529d8 lua: return an empty table as device info after device removal
As the documentation already promises.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:14 +00:00
Peter Hutterer
4fe3225050 lua: remove the unpack global function
Looks like 5.1 and later has unpack as table.unpack().

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:14 +00:00
Peter Hutterer
45878c3aac lua: fix superfluous comma
Not sure how this compiled but whoah, definitely not supposed to be
there.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:14 +00:00
Peter Hutterer
f0d8002255 plugins: fix some minor issues with the example plugins
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:13 +00:00
Peter Hutterer
037c07d76f doc/user: fix a few issues with the Lua API documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:13 +00:00
Peter Hutterer
1dcf630584 plugins: add an example plugin on how to reconfigure the Copilot key
As Microsoft has decreed, that key sends LEFTMETA + LEFTSHIFT + F23
(usually across multiple frames) and the then the same in reverse when
released.

xkeyboard-config 2.44 maps this sequence by default to XF86Assistant but
for the use-cases where this does not work reshuffling the whole event
sequence is the best approach and that can easily be done with a plugin.

Note that this is the minimum effort plugin - it works for one
keyboard at at time (duplicate the plugin if two keyboards are needed,
or remove the vid/pid check) and it does *not* intercept the meta/shift
key presses and delay them, it simply releases them on F23 and then
replays the new sequence. Good enough for an example plugin.

Example sequence produces shift + a on press and releases a + shift on
release. Holding the key will thus produce AAAAAAAAA which is an
excellent summary of how this key was designed.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1352>
2025-11-03 03:57:00 +00:00
Peter Hutterer
eb01a4e73f plugins: add meson option to autoload plugins
Add an option to enable autoloading plugins from the default paths.
This makes testing and adoption for new users easier as they can (if
necessary) rebuild libinput with that option enabled instead of having
to wait for the compositor stack to update.

Autoloading will only use the default paths (/etc and /usr/lib) and will
only happen if the client does not modify those paths since that implies
the client wants to load plugins themselves. A client that adds a plugin
path but doesn't load the plugins is considered buggy anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1347>
2025-10-31 05:25:29 +00:00
Peter Hutterer
f27fbdfa53 meson.build: change set10 to set
Follow-up to cfec80582e ("meson.build: change from config.set10() and #if to config.set() and #ifdef")
which was parallel to 9e37bc0cfa and the latter didn't get updated.

Fixes: 9e37bc0cfa ("plugins: add support for lua plugins to change evdev event streams")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1347>
2025-10-31 05:25:29 +00:00
Jan Hendrik Farr
07659db3d9 quirks: add quirk for Google Chromebook Roric
Signed-off-by: Jan Hendrik Farr <kernel@jfarr.cc>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1353>
2025-10-30 13:40:59 +01:00
Peter Hutterer
f18bf988f7 lua: drop the log global in favor of libinput:log_*
The existence of the log global was in part due to early (pre-merge)
versions of the Lua plugins supporting multiple libinput plugin objects
per file. This is no longer the case and integrating the log functions
into the (single) libinput object makes the code more obvious (we're
calling libinput:log_debug() now, so it's obviously a libinput log
function) and we no longer mix dot with colon notations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1350>
2025-10-30 13:12:50 +10:00
Peter Hutterer
6b9dbc2a25 lua: remove the inject_frame API
Injecting frame was the first implementation of adding event frames but
it has since effectively been replaced by append/prepend_frame which are
more predictable and easier to support.

In the Lua API injecting frames was only possible within the timer and
the only real use-case for this is to inject events that are then also
seen by other plugins. But that can be achieved by simply ordering the
plugin before the other plugins and using the append/prepend approach.

Until we have a real use-case for injecting events let's remove the API
so we don't lock ourselves into an API that may not do what it needs to
but needs to be supported for a long time.

Closes: #1210
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1351>
2025-10-30 02:08:13 +00:00
Peter Hutterer
2784973b4d doc/user: update the lua plugin documentation
Some clarifications, some fixes, some reshuffling, overall somewhat
better.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1349>
2025-10-30 01:46:33 +00:00
Peter Hutterer
22dda5b154 doc: some updates to the plugin system docs
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1349>
2025-10-30 01:46:33 +00:00
Peter Hutterer
07a9161ef2 tools: add support for NO_COLOR/FORCE_COLOR
Environment variables to control whether the output should not have
color or must have color, regardless of the tty-ness of the output
stream.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1348>
2025-10-27 12:35:44 +10:00
Peter Hutterer
141f571aae tools: don't set the tool pressure range if we're using the default
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1340>
2025-10-24 01:55:25 +00:00
Peter Hutterer
48a3391f33 tablet: don't consider a 0.0-1.0 pressure range as configured range
A caller is likely to unconditionally call
libinput_tablet_tool_config_pressure_range_set() with whatever
values it has in its config storage. Those values will be 0 and 1 by
default, we should not take this as a sign that the tool has a pressure
range.

Setting a pressure range resets the automatic offset handling which we
definitely don't want to do for the default range.

Fixes: #1177
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1340>
2025-10-24 01:55:25 +00:00
Peter Hutterer
bda0c7478e tablet: when configuring a user-defined pressure range, zero the offset
When a user configures a pressure range, the tool would get locked into
the current offset even if that offset was still pending. For example, a
sequence of

- tool in-prox with pressure 50%
- libinput_tablet_tool_config_pressure_range_set(tool, 0.0, 0.9)
- tool out-of-prox, tool-in-prox
- libinput applies the tool config, tool now has a configured range,
  has_offset = true
- tool out-of-prox, tool-in-prox
- update_pressure_range() sees has_offset = true, scales the last offset
  (50%) to the actual offset.

Fix this by resetting the detected offset to zero when we shortcut the
heuristics. A user-defined pressure range should include the tool's
pressure offset anyway, the user knows this much better than our
heuristics.

Closes: 1177
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1340>
2025-10-24 01:55:25 +00:00
Peter Hutterer
66f2d121ee tablet: log the pressure offset's percentage once we detected it
Saying the offset is e.g. 15% is more informative to the user than a
vauge "we detected something".

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1340>
2025-10-24 01:55:25 +00:00
Peter Hutterer
60c5fdbc2f doc: fix wrong reference to the plugin system
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1345>
2025-10-24 01:34:52 +00:00
Yinon Burgansky
cc7dfccd22 filter: avoid division-by-zero when delta_time is zero in custom filter
delta_time can be zero when:
- the fallback acceleration function is used for multiple movement types
  (for example, pointer motion and wheel scrolling simultaneously)
- two different methods produce the same movement at the same time
  (for example, button-scrolling and wheel-scrolling)

Reusing the last delta_time is a graceful fallback even if there are
duplicate events or event-ordering bugs.

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1336>
2025-10-24 01:18:40 +00:00
Yinon Burgansky
94b7836456 filter: support accelerating high-resolution scroll wheel events
Dispatch high-resolution scroll wheel events through filter_dispatch_scroll
so they can be accelerated using the custom acceleration profile.

Low-resolution scroll wheel events are not accelerated to avoid zero
delta-time in the filter.

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1316>
2025-10-24 01:05:54 +00:00
Zephyr Lykos
2d4482e03d meson.build: remove useless meson version checks
meson version requirement is bumped to 0.64.0 since
9e37bc0cfa ("plugins: add support for lua plugins to change evdev event streams")

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1344>
2025-10-24 00:21:12 +00:00
Zephyr Lykos
607852e66d meson.build: mark executables with install_tag
install_tag is available since meson 0.60.0:
https://mesonbuild.com/Reference-manual_functions.html#executable_install_tag

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1344>
2025-10-24 00:21:12 +00:00
wangyafei
a60976c1d4 quirks: add quirks for Dell laptop with Sensel Touchpad.
This touchpad is a pressure pad and needs the pressure
handling disable.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1342>
2025-10-24 00:01:00 +00:00
José Expósito
aac0d3c2f8 quirks: Avoid accidental scroll for Logitech MX Master 2S
Similar to the MX Master 3, this mouse can send scroll events when the
wheel is pressed.

Add the "ModelScrollOnMiddleClick" quirk to avoid it.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1181
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1343>
2025-10-23 21:51:36 +00:00
José Expósito
327db95a7c doc/user: Document ModelScrollOnMiddleClick quirk
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1343>
2025-10-23 21:51:35 +00:00
José Expósito
4a705ba8d7 quirks: Rename QUIRK_MODEL_LOGITECH_MX_MASTER_3
The Logitech MX Master 2S also triggers accidental scroll events when
the mouse wheel is pressed [1].

Rename the "ModelLogitechMXMaster3" quirk to "ModelScrollOnMiddleClick"
to make it more generic.

[1] https://gitlab.freedesktop.org/libinput/libinput/-/issues/1181

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1343>
2025-10-23 21:51:35 +00:00
Peter Hutterer
d6e1f93812 plugins: update plugins for the current API
A few changes to the Lua API didn't get reflected in the example
plugins, let's update them.

Also included here is naming of all arguments, instead of _ use the
argument name even where unused. These are examples so being expressive
is more important than making any lua static checkers happy.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1339>
2025-10-23 13:28:16 +00:00
Peter Hutterer
dd3f931481 plugins: rename the flags to libinput_plugin_system_flags
"libinput_plugins_flags" is bound to be annoying to approximately
everyone who'll ever have to use them so let's rename this while we
still can. Renamed to libinput_plugin_system_flags to leave the
namespace open for a possible future libinput_plugin_flags that works
on individual plugins.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1337>
2025-10-23 13:13:01 +00:00
Peter Hutterer
d1720d351d meson.build: bump to 1.29.900
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1338>
2025-10-23 00:06:09 +00:00
Marge Yang
fcb5dfe515 quirks: add Dell laptop touchpad quirks
This touchpad is a pressure pad.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1335>
2025-10-21 17:25:13 +08:00
Peter Hutterer
43c7644f01 quirks: add a quirk for the RazerBlade142025 keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1334>
2025-10-21 04:56:12 +00:00
Peter Hutterer
3307341ebf CI: drop the ci-fairy check-mr job
The only thing this checked was the checkbox for allowing maintainers to
edit the MR. Changed permissions checks now fail this job but luckily
the setting it checked has been the default for years anyway so we can
drop it.

https://gitlab.freedesktop.org/freedesktop/ci-templates/-/issues/81

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1332>
2025-10-20 12:35:51 +10:00
Peter Hutterer
4b1bae3f8c tools/replay: rmdir, not unlink for directories
And if the directory happens to be nonempty, well, maybe anyother
libinput reply is running so let's ignore that.

Fixes: cdfe34f62a ("replay: use the runtime quirks for our replay quirks")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1330>
2025-10-20 02:01:23 +00:00
Peter Hutterer
f9977dba9c tools/replay: set the multiprocessing start method to fork
Python 3.14 has changed from fork to forkserver[1] which causes
libinput replay to fail with the following error when starting the
subprocesses:
   ValueError: ctypes objects containing pointers cannot be pickled

This is caused by the libevdev device being passed to the sub process.
A more proper fix may be to only initialize the device in the subprocess
and then signal the process to start replaying. But meanwhile, switching
back to fork will do.

[1] https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

Closes #1204

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1330>
2025-10-20 02:01:23 +00:00
Marge Yang
3725bb0b93 quirks: add Dell laptop touchpad quirks
This touchpad is a pressure pad.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1329>
2025-10-16 06:13:34 +00:00
Cyrus Lien
d19f95ec21 quirks: add quirks for Dell Pro Rugged tablets for volume keys.
Close #1205

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1331>
2025-10-16 13:42:37 +08:00
Peter Hutterer
533d5f6ee1 lua: ignore unsupported event codes in modified frames
If a plugin adds events to an event frame that are not supported by the
target device we may eventually dereference a null pointer (for ABS_*
events) or, possibly, use an OOB index access (for buttons or keys).
Let's filter out any events that the device doesn't support immediately.

Fixes #1202

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1324>
2025-10-14 06:08:37 +00:00
Peter Hutterer
3250686e70 lua: add missing lua_pop for the evdev frame
Where a plugin returns a table to be processed we never popped that
table from the stack. Eventually this would lead to the plugin failing
as the stack size is exceeded.

Fixes #1195

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1323>
2025-10-14 05:53:06 +00:00
Sertonix
aa7d58005e Fix format strings on 32-bit with 64-bit time_t
This fixes a segfault when running the test suite on ppc musl

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1318>
2025-10-14 05:40:19 +00:00
José Expósito
5df3eb8527 quirks: add Dell 14 Premium touchpad quirks
This touchpad is a pressure pad.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1185
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1320>
2025-10-13 06:53:31 +00:00
José Expósito
185e1bd824 quirks: add Dell 16 Premium touchpad quirks
This touchpad is a pressure pad.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1198
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1320>
2025-10-13 06:53:31 +00:00
Daniel Brackenbury
195c39b21a quirks: revert Nulea USB quirk due to ID conflict
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1325>
2025-10-13 06:35:42 +00:00
Peter Hutterer
6dcb47185e triage-policies: add a bugbot hook for re-closing a bug
Having the bugbot comment on re-closing the same bug is friendlier than
just closing it, even if we explained it before already.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1321>
2025-10-13 06:21:26 +00:00
Daniel Brackenbury
e07e138809 quirks: add vendor quirks for Nulea M501 thumb trackball
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1322>
2025-10-09 18:39:49 -04:00
José Expósito
a4ea1e2d97 libinput: Add libinput_event_gesture forward declaration
Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1189
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1319>
2025-10-07 00:31:38 +00:00
Dan Forest
772c1f5ebb quirks: add quirk for Asus ROG Flow Z13 2025 (GZ302EA) keyboard
Keyboard must be detected as internal in order for "disable touchpad while typing" to work as expected.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1317>
2025-10-03 15:04:37 +00:00
Mingcong Bai
95281de7e4 quirks: lower AttrTrackpointMultiplier for Lenovo ThinkPad E16 Gen 3
Lower TrackPoint multiplier for Lenovo ThinkPad E16 Gen 3 to match closer
to Windows defaults. The default multiplier was way too quick.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1315>
2025-09-06 17:17:34 +08:00
José Expósito
32a9863507 quirks: Add quirks for the GPD MicroPC 2 touchpad
This laptop's touchpad has physical left, middle and right button, but
advertises itself as a clickpad.

Drop the incorrectly set INPUT_PROP_BUTTONPAD property.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1182

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1314>
2025-09-04 09:57:26 +02:00
José Expósito
a0a6ff2777 plugin/wheel: Use libinput_device_is_virtual()
Use this function instead of evdev_device_is_virtual().

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1313>
2025-09-02 10:59:31 +02:00
Peter Hutterer
60bcbb6c88 quirks: change VM devices to AttrIsVirtual
These devices had the debouncing disabled via a model quirk but
really they are virtual devices and should have all hw-specific
processing disabled - on the assumption that this will be handled
in the host. See also e.g. commit 5d23794d53 ("tablet: disable
smoothing for uinput devices").

Closes #1175

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1308>
2025-09-02 07:44:11 +00:00
David Santamaría Rogado
4f6c741570 quirks: HP OmniBook Ultra Flip Laptop 14-fh0xxx
HP OmniBook Ultra Flip Laptop 14-fh0xxx manages itself keyboard and
touchpad deactivation when HP's custom Intel ISH firmware is installed
in the system. Without the custom firmware tablet-mode switch isn't
exposed so there is no way we don't need this.
More detailed information in the file comment.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1311>
2025-09-02 07:23:22 +00:00
José Expósito
69ed729e80 quirks: don't disable the keyboard on the Dell Latitude 7285
Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1180
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1312>
2025-09-02 09:05:30 +02:00
Peter Hutterer
f3f8e8ef6c plugin: ensure prox out for a forced proximity tool if the tool changes
A device may send axis events while the tool is out of proximity,
causing our plugin to force a proximity in for the pen. If the tool then
sends a proximity event for a different tool we ended up with two tools
in proximity.

The sequence in #1171 shows this:

  - evdev:
    - [  1, 499608,   3,  27,       0] # EV_ABS / ABS_TILT_Y                0 (+30)
    - [  1, 499608,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +0ms
  - evdev:
    - [  2, 199637,   1, 321,       1] # EV_KEY / BTN_TOOL_RUBBER           1
    - [  2, 199637,   4,   4,      30] # EV_MSC / MSC_SCAN                 30 (obfuscated)
    - [  2, 199637,   1, 330,       1] # EV_KEY / BTN_TOUCH                 1
    - [  2, 199637,   3,   0,     910] # EV_ABS / ABS_X                   910 (+246)
    - [  2, 199637,   3,   1,    8736] # EV_ABS / ABS_Y                  8736 (-105)
    - [  2, 199637,   3,  27,     -25] # EV_ABS / ABS_TILT_Y              -25 (-25)
    - [  2, 199637,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +700ms

Fix this by remembering that we forced the tool out of proximity so if
we see tool events for another tool we force the pen out of proximity
again.

This will have some interplay with the other tablet plugins but
hopefully none that affect real-world devices, e.g. forcing a proximity
out means the proximity out timer plugin gets disabled. Since devices
behave in unexpected manners anyway let's see if it affects a real-world
device.

Closes #1171

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1306>
2025-08-31 00:18:59 +00:00
Peter Hutterer
ce1112c263 plugin: remove the proximity timer callback after prox out events
One of the code paths was addressed in b2cd9c69a0 but this path was
missing.

Fixes: b2cd9c69a0 ("plugin: remove the event frame callbacks when disabling a plugin")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1306>
2025-08-31 00:18:59 +00:00
Peter Hutterer
428a3299a8 plugin: don't initialize the debounce plugin on a virtual device
Effectively the same motivation as commit 5d23794d53 ("tablet: disable
smoothing for uinput devices") - virtual devices should not need
debouncing and if they do let's do the debouncing on the other end that
creates those devices.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1307>
2025-08-28 01:56:12 +00:00
Peter Hutterer
bdb51593fe quirks: add quirk for the RazerBlade162025 keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1305>
2025-08-26 20:51:55 +00:00
Alexander Bruy
d9c9e0ff25 add quirk for TongFang GX4 (X4SP4NAL) touchpad
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1302>
2025-08-20 08:07:36 +00:00
Peter Hutterer
4d317eae17 plugin: reset the filtered frame after sending it with buttons
Our filtered frame (frame without any button events) that gets passed
down to here may include relative motion or other events. Once we use
that frame to prepend the button event we need to reset it so we don't
cause duplicate motion and/or events with zero delta timestamps.

With the the previous code we got two identical frames:

  42: event25: plugin button-debounce        - 0.360 EV_MSC           MSC_SCAN               30
  ... event25: plugin button-debounce        - 0.360 EV_KEY           BTN_RIGHT               1
  ... event25: plugin button-debounce        - 0.360 EV_REL           REL_X                  -7
  ... event25: plugin button-debounce        - 0.360 EV_REL           REL_Y                  -7
  ... event25: plugin button-debounce        - 0.360 ----------------- EV_SYN ----------------- +8ms
  ... Plugin:button-debounce - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_OTHERBUTTON → DEBOUNCE_STATE_IS_UP
  ... Plugin:button-debounce - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_PRESS → DEBOUNCE_STATE_IS_DOWN_WAITING
  ... event25: plugin evdev                  - 0.360 EV_MSC           MSC_SCAN               30
  ... event25: plugin evdev                  - 0.360 EV_REL           REL_X                  -7
  ... event25: plugin evdev                  - 0.360 EV_REL           REL_Y                  -7
  ... event25: plugin evdev                  - 0.360 EV_KEY           BTN_RIGHT               1
  ... event25: plugin evdev                  - 0.360 ----------------- EV_SYN ----------------- +0ms
  ... Queuing  event25  POINTER_MOTION               +0.000s	-7.00/ -7.00 ( -7.00/ -7.00)
  ... event25 - middlebutton state: MIDDLEBUTTON_IDLE → MIDDLEBUTTON_EVENT_R_DOWN → MIDDLEBUTTON_RIGHT_DOWN, rc 1
  ... event25: plugin evdev                  - 0.360 EV_MSC           MSC_SCAN               30
  ... event25: plugin evdev                  - 0.360 EV_REL           REL_X                  -7
  ... event25: plugin evdev                  - 0.360 EV_REL           REL_Y                  -7
  ... event25: plugin evdev                  - 0.360 EV_KEY           BTN_RIGHT               1
  ... event25: plugin evdev                  - 0.360 ----------------- EV_SYN ----------------- +0ms
  ... Queuing  event25  POINTER_MOTION               +0.000s	 -nan/  -nan ( -7.00/ -7.00)
 event25  POINTER_MOTION               +0.360s	-7.00/ -7.00 ( -7.00/ -7.00)
 event25  POINTER_MOTION            2  +0.360s	 -nan/  -nan ( -7.00/ -7.00)

The 0ms delta caused a -nan in the custom pointer accel but even without
that bug the pointer would've jumped more than it should.

Closes #1172

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1301>
2025-08-20 07:49:01 +00:00
Peter Hutterer
2f2bd357bc plugin: don't register the mouse-wheel plugin for passthrough devices
If a device is immediately set to PASSTHROUGH let's skip registering
this plugin for this device. We're not doing anything with the events
anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
b2cd9c69a0 plugin: remove the event frame callbacks when disabling a plugin
In all cases we remove the device's handling from the plugin so let's
remove the event frame callback for this device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
3ff1a2e24d plugin: when disabling wheel-debouncing set to the correct enum value
This isn't a boolean. Let's change the first enum value to something
truthy so any use as boolean is more likely to trigger test failures.

Fixes: 18992b2ec0 ("plugin: allow disabling the wheel debouncing feature")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1300>
2025-08-19 15:22:49 +10:00
Peter Hutterer
e45cd2bc13 util: print nonchanged axis with a space instead of a *
When printing tablet events always print a '*' or ' ' suffix to ensure
the alignment of the next field matches. We're using a tab to align
after each field so if the string length doesn't match, our events may
print at different tab stops.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1299>
2025-08-18 23:11:03 +00:00
Peter Hutterer
537552480d plugin: expand the plugin name prefix to 22 chars
That's the longest name we have for our internal plugins so let's make
sure those align nicely for easier debugging.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1299>
2025-08-18 23:11:03 +00:00
Peter Hutterer
5abe051a9c doc/user: fixes and a TOC for the Configuration Options page
A typo fix, more links and a local TOC since we now have quite a few
options.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1296>
2025-08-12 15:20:12 +00:00
Peter Hutterer
9b58177a7e doc/user: add eraser buttons to the "Configuration Options" page
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1296>
2025-08-12 15:20:12 +00:00
Peter Hutterer
cdfe34f62a replay: use the runtime quirks for our replay quirks
Closes #1166

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1297>
2025-08-12 07:58:07 +00:00
Peter Hutterer
ce87da63ba quirks: add XDG_RUNTIME_DIR/libinput to the quirks directories
This allows tools like libinput-replay and the test suite to install
temporary quirks without having to mess with actual system-installed
files or directories.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1297>
2025-08-12 07:58:07 +00:00
Peter Hutterer
4e002383cf clang-tidy: fix WarningAsErrors option to actually work
Not a boolean, despite what one would immediately assume.

Closes #1168

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1298>
2025-08-11 15:27:35 +10:00
Peter Hutterer
17617a75c4 pad: add some extra asserts to shut up clang-tidy
For some reason clang-tidy believes that in the second iteration group
is set to NULL and causes a NULL-pointer dereference.

../src/evdev-tablet-pad.c:305:2: error: Access to field 'next' results in a dereference of a null pointer [clang-analyzer-core.NullDereference,-warnings-as-errors]
  305 |         list_for_each(group, &pad->modes.mode_group_list, link) {
      |         ^
../src/util-list.h:265:13: note: expanded from macro 'list_for_each'
  265 |              pos = list_first_entry_by_type(&pos->member, __typeof__(*pos), member))
      |                    ^
../src/util-list.h:202:2: note: expanded from macro 'list_first_entry_by_type'
  202 |         container_of((head)->next, container_type, member)
      |         ^

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1298>
2025-08-11 15:27:31 +10:00
Peter Hutterer
48a26f91c3 CI: change the wayland-web job to use rules
"only: ..." is deprecated and we should be using rules

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1294>
2025-08-08 09:18:22 +00:00
Peter Hutterer
c0519c3b5e Correct the @since tags for the new plugin functions
Fixes: d557a649fd ("Add a public plugin system to libinput")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1295>
2025-08-08 05:06:04 +00:00
Nat Karmios
960df4d8b8 quirks: Ignore BTN_0 for Microsoft Surface Keyboard
Signed-off-by: Nat Karmios <nat@karmios.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1293>
2025-08-08 00:39:06 +01:00
Peter Hutterer
347ff90871 lua: implement support for disabling of features
Because our lua hooks don't expose the device-added callback we need to
cache any calls to disable a feature and then apply it quietly when the
device is actually added. Any other call can go straight through.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
5b2a723a02 touchpad: allow disabling palm detection altogether
Also a long-requested configuration option but it's difficult to expose
- depending on the touchpad we utilize different palm detection methods
and in theory may add to those at any time as we see fit.

Disabling it completely via a configuration option is only going to get
us more bug reports because *some* palm detection is likely desired on
most setups. So let's allow disabling it in a plugin and thus leave any
further palm detection code up to the plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
afd3be9a99 touchpad: allow disabling the touchpad hysteresis
Over the years we had a few devices that required some special
hysteresis handling - all of it very customized to the device and not
upstreamable (or even implementable by upstream without the device).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
2bb9c66cd7 touchpad: allow disabling the touchpad jumping cursor detection
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
18992b2ec0 plugin: allow disabling the wheel debouncing feature
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
cf52552eef plugin: allow disabling the button debouncing feature
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:21:59 +10:00
Peter Hutterer
7ac051ab41 plugin: add hooks to disable internal features
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:21:36 +10:00
Peter Hutterer
4f0b82800a plugins: remove two unused cleanup functions
Let's make clang tidy happy so at least one of us is.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:55 +00:00
Peter Hutterer
aa9d5bf630 util: silence two clang-tidy false positives
Both about the same complaint, somehow it is of the impression that
masks->mask can be an uninitialized value. The only place where we
allocate those is in _infmask_ensure_size() and they're set to zero
there.

libinput/src/util-bits.h:166:22: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
  166 |         return !!(mask.mask & bit(bit));
      |                             ^
libinput/src/util-bits.h:444:2: note: Calling 'infmask_set_bit'
  444 |         infmask_set_bit(&m, mask);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
libinput/src/util-bits.h:394:15: note: Calling 'infmask_bit_is_set'
  394 |         bool isset = infmask_bit_is_set(mask, bit);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libinput/src/util-bits.h:382:13: note: Field 'mask' is non-null
  382 |         if (!mask->mask || bit / bitmask_size() >= mask->nmasks)
      |                    ^
libinput/src/util-bits.h:382:6: note: Left side of '||' is false
  382 |         if (!mask->mask || bit / bitmask_size() >= mask->nmasks)
      |             ^
libinput/src/util-bits.h:382:2: note: Taking false branch
  382 |         if (!mask->mask || bit / bitmask_size() >= mask->nmasks)
      |         ^
libinput/src/util-bits.h:385:9: note: Uninitialized value stored to 'mask.mask'
  385 |         return bitmask_bit_is_set(mask->mask[bit / bitmask_size()], // NOLINT(core.UndefinedBinaryOperatorResult)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  386 |                                   bit % bitmask_size());
      |                                   ~~~~~~~~~~~~~~~~~~~~~
libinput/src/util-bits.h:385:9: note: Calling 'bitmask_bit_is_set'
  385 |         return bitmask_bit_is_set(mask->mask[bit / bitmask_size()], // NOLINT(core.UndefinedBinaryOperatorResult)
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  386 |                                   bit % bitmask_size());
      |                                   ~~~~~~~~~~~~~~~~~~~~~
libinput/src/util-bits.h:166:22: note: The left operand of '&' is a garbage value
  166 |         return !!(mask.mask & bit(bit));
      |                   ~~~~~~~~~ ^

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:55 +00:00
Peter Hutterer
b831068fbb util: annotate that our mask cannot be NULL
Poor clang-tidy thinks that there's a code-path here that lets us
return with a NULL mask.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:55 +00:00
Peter Hutterer
a0d286741c touchpad: fix a clang-tidy warning
../src/evdev-mt-touchpad-buttons.c:1233:16: warning: Value stored to 'button' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
 1233 |         evdev_usage_t button = evdev_usage_from_uint32_t(0);
      |                       ^~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:54 +00:00
Peter Hutterer
5495511485 tools: move a clang-tidy silence back to where it needs to be
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:54 +00:00
Peter Hutterer
4ef50ee946 test: fix two clang-tidy dead store complaints
udev_device isn't used but we assign it for being auto-freed.

And color is overwritten immediately but it's better to have a known
good value for it anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:54 +00:00
Peter Hutterer
a102269364 util: mark the various bitmask functions as nonnull
Might as well get a bit of compiler help here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1292>
2025-08-06 07:34:54 +00:00
Peter Hutterer
2562c24f95 pad: don't assert when unable to find the mode group, just discard
Instead of a hard assert if we fail to find the mode group for the given
ring/dial/strip let's just log an error and discard the event.

I'm not sure this assert can be triggered in the current code base but
if it can an error message is going to be more useful to the user than
an assert.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1291>
2025-08-04 12:53:10 +10:00
Adam Sampson
47d4c563f4 evdev: remove duplicate sizeof
This looks like a copy-and-paste error. In practice it was harmless on
64-bit systems because evdev_event happens to be 64 bits long, but on
32-bit systems it would allocate too little memory.

Found by GCC 15 with _FORTIFY_SOURCE=3 on ia32.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1288>
2025-08-01 22:34:07 +00:00
Adam Sampson
931dad76a9 test: correct value type in atou64_test
This needs to be an unsigned 64-bit value, given the constants that are
stored in this field below; unsigned long is 32 bits on some platforms
(e.g. ia32).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1288>
2025-08-01 22:34:07 +00:00
Matt Turner
7f3aa8058a test: Accept mkdir_p("/proc/foo") might return EACCES
... as it does under Gentoo's sandbox.

Fixes: 6770131e ("util: fix a memleak in mkdir_p")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1289>
2025-08-01 11:11:31 -04:00
Peter Hutterer
c1d8d92b57 Drop evdev_frame_new_on_stack()
Was unused anwyay but also cannot work, returning an address to a frame
allocated on the stack is not a great idea...

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:49:00 +10:00
Peter Hutterer
2723cadaeb lua: drop compatibility to 5.1 to allow for luajit
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:49:00 +10:00
Peter Hutterer
9e37bc0cfa plugins: add support for lua plugins to change evdev event streams
This patch adds support for Lua scripts to modify evdev devices and
event frames before libinput sees those events.

Plugins in Lua are sandboxed and restricted in what they can do: no IO,
no network, not much of anything else.

A plugin is notified about a new device before libinput handles it and
it can thus modify that device (changes are passed through to our libevdev
context). A plugin can then also connect an evdev frame handler which
gives it access to the evdev frames before libinput processes them. The
example plugin included shows how to swap left/right mouse buttons:

    libinput:register({1})

    function frame(device, frame)
        for _, v in ipairs(frame.events) do
            if v.usage == evdev.BTN_RIGHT then
                v.usage = evdev.BTN_LEFT
            elseif v.usage == evdev.BTN_LEFT then
                v.usage = evdev.BTN_RIGHT
            end
        end
        return frame
    end

    function device_new(plugin, device)
        local usages = device:usages()
        if usages[evdev.BTN_LEFT] and usages[evdev.BTN_RIGHT] then
            device:connect("evdev-frame", frame)
        end
    end

    libinput:connect("new-evdev-device", device_new)

A few other example plugins are included in this patch

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:04:09 +10:00
Peter Hutterer
0c65b1069b test: allow creating a context with a custom plugindir
For runtime creation of plugins for testing

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 15:38:39 +10:00
Peter Hutterer
d557a649fd Add a public plugin system to libinput
This patch adds a new API for enabling public "plugins" in libinput, in
addition to the exisitng internal ones. The API is currently limited to
specifying which paths should be loaded and whether to load them.
Public plugins are static, they are loaded before the context is initialized
and do not update after that.

If plugins are to be loaded, libinput will then run through those paths,
look up files and pass them to (future) plugins to load the actual
files.

Our debugging tools have an --enable-plugins and
--disable-plugins option that load from the default data paths
(/etc/libinput/plugins and /usr/lib{64}/libinput/plugins) and from
the $builddir/plugins directory.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 15:38:39 +10:00
Peter Hutterer
d1dbbb7328 plugin: register plugins for the plugin-specific usages
The debounce, wheel/wheel-low-res, double-tool and eraser-button plugins can limit
themselves to a specific usage.

The mtdev plugin needs to pass each each event to mtdev and the proximity
timer plugin needs to get each event's timestamp so they cannot be
restricted.

The forced-tool could be restricted but effectively any event on the
devices it works on will have one of those usages set so there's no
point.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
Peter Hutterer
3a86b6ea58 plugin: add evdev usage masks for plugins
This adds the ability for a plugin to announce the evdev usages it may
possibly care about. Only event frames that contain one or more of those
usages will be passed to the plugin. Ideally this is an optimization
over calling every plugin for every frame but that largely also depends
on what exactly the plugin does with each frame.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
Peter Hutterer
f04b276ac1 util: add a helper struct for an evdev mask
Allows to keep track of a set of evdev masks, or at least the subset we
care about.

The EV_KEY range is split into two masks to save some memory. The future
use of this is for the plugins to use those masks and some of those will
set BTN_TOOL_PEN and friends. This would immediately create an 81 byte
mask of zeroes just to keep that one bit.

Splitting it into a key/btn mask with the latter starting at BTN_MISC
means we duplicate the infmask struct (2x16 bytes) but instead only use
8 bytes for the mask itself to keep the BTN_TOOL_PEN bits.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
Peter Hutterer
d45f4493f1 util: add an infmask_t type for an infinitely-sized bitmask
Using the bitmask-size underneath but this mask can grow to any number
of bits requested. Notably, the sized of the mask is the nearest 4-byte
multiple for the highest bit ever set in the mask.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
Peter Hutterer
4c4d5f33ee util: add bitmask_size() to return the size of a bitmask
This way we can theoretically change the bitmask to use a longer type in
the future.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1271>
2025-08-01 14:29:44 +10:00
Peter Hutterer
8336721dc0 test: fix the keycode obfuscation test
An earlier version of 73103a5c38 only obfuscated the plugin key codes,
not the "Queuing ..." message libinput itself uses. The test didn't get
updated when the queuing message was updated to obfuscate.

Fixes: 73103a5c38 ("plugin: always obfuscate keycodes")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:57 +00:00
Peter Hutterer
6dfd72dc03 test: add litest_assert_strv_no_substring
To verify a strv does *not* include a given substring

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:57 +00:00
Peter Hutterer
ce85ee7d35 test: switch another test to use logcapture
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:57 +00:00
Peter Hutterer
d9a4667a14 test: track bug messages separately in log captures
Notably, this also tracks kernel bugs now as opposed to just other bugs.
It is up to tests checking for the expected message.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:57 +00:00
Peter Hutterer
465fce9128 test: don't run the check for lowres events if we don't have hires events
This test explicitly checks for devices only sending REL_WHEEL but *not*
REL_WHEEL_HI_RES. But that check only needs to run if the device has
the HI_RES axis.

The test device with REL_WHEEL_HI_RES disabled via quirk needs to be
special-cased since we cannot detect this in the test suite otherwise.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:57 +00:00
Peter Hutterer
68dbb98f04 clang-format: add litest_with_logcapture to foreach macros
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1284>
2025-08-01 04:02:56 +00:00
Peter Hutterer
a22883f7e2 CI: don't run the wayland-web job for marge
marge doesn't have sufficient permissions to trigger the pipeline, so
all we get is every trigger job failing. Let's disable this until it can
be figured out properly.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1287>
2025-08-01 03:46:22 +00:00
Peter Hutterer
7d59252643 quirks: minor cleanup to use attribute(cleanup)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1285>
2025-08-01 02:19:15 +00:00
Peter Hutterer
59f0d8f647 tools/replay: improve the verbose output a bit
Make sure our SYN_REPORT line is indented correctly for multi-device
replay and match the output a bit closer to the one from libinput
record.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1286>
2025-08-01 11:24:06 +10:00
Peter Hutterer
936cee2242 libinput 1.29.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-31 15:26:54 +10:00
Peter Hutterer
3ca34aa88a evdev: move the SYN_REPORT 1 filtering to the touchpad backend
In commit 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")
all frames with a SYN_REPORT 1 were discarded on the assumption of those
being key repeat frames. Unfortunately the kernel uses the same sequence
to simply mark *any* injected/emulated event, regardless of the cause. Key repeat
events are merely the most numerous ones but as shown in commit
7140f13d82 ("evdev: track KEY_SYSRQ frames and pass them even as repeat frames")
Alt+PrintScreen is also an emulated event.

Issue #1165 details another case: keyboards with n-key rollover can
exceed the kernel-internal event buffer, typically 8 events for devices
without EV_REL/EV_ABS. Those events will be broken up by the kernel into
multiple frames - once nevents == buffer_size the current state is
flushed as SYN_REPORT 1 frame. Then, if any more events are pending
those are flushed as SYN_REPORT 0 frame. In the case of exactly 8
events, the second frame is never present, so we cannot easily detect if
another one is coming.

Issue #1145 only affects us in the touchpad code, the rest of the
backends seem to (so far) be fine. So let's move the discarding of
SYN_REPORT 1 to the touchpad backend and leave the rest of the code
as-is.

This effectively
Reverts: 7140f13d82 ("evdev: track KEY_SYSRQ frames and pass them even as repeat frames")
Reverts: 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")

Closes #1165

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1282>
2025-07-31 00:50:30 +00:00
Peter Hutterer
96d1954dce tools: add missing AttrIsVirtual handling for listing quirks
If a device has AttrIsVirtual set in the quirks we'd abort() when trying
to list those quirks.

Fixes: efb4b6a3be ("evdev: detect virtual devices")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1281>
2025-07-30 05:43:03 +00:00
Peter Hutterer
b8651d798c tools: add a debug-tablet-pad tool
A simple tool to check the evdev and libinput events from a tablet pad.
This is near-identical to the existing debug-tablet tool but adjusted
for tablet pad events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
74705ee94c util: add a clamp macro
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
e8d24f818b util: add two macros for clearing a line
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:33 +00:00
Peter Hutterer
4a67ddc111 utils: allow strv_join on a null string
NULL in means NULL out, as the docs says, no need for an assert here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
2025-07-28 23:40:32 +00:00
Peter Hutterer
cfec80582e meson.build: change from config.set10() and #if to config.set() and #ifdef
config.set10 is much more convenient and nicer to read but can provide
false positive if the value is 0 and #ifdef is used instead of #if. So
let's switch everything to use #ifdef instead, that way we cannot get
false positives if the value is unset.

Closes #1162

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1277>
2025-07-28 12:04:09 +10:00
Peter Hutterer
36b2afae82 plugin: ignore high-resolution wheel events from disabled wheels
Make sure we drop any potential high-resolution wheel events from a
device that isn't supposed to have them.

Where the device's axes were disabled due to a quirk, re-enabling the
axes means the device's events won't be filtered anymore. Our wheel
emulation plugin thus emulates high-resolution wheel events in addition
to the hardware events.

Fix this by simply filtering out any high-resolution wheel events on any
device that uses this plugin.

Closes #1160

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1279>
2025-07-24 09:13:12 +10:00
Peter Hutterer
6aefc2f166 libinput 1.28.903
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-21 13:34:46 +10:00
Peter Hutterer
4326413238 libinput: obfuscate the keycodes in the "Queuing ..." debug log
These messages are behind the 'internal-event-debugging' meson options
but let's be extra safe. It's rarely if ever required to see the actual
keycode anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:43 +10:00
Peter Hutterer
73103a5c38 plugin: always obfuscate keycodes
Same approach as chosen in libinput-record, this leaves the F1-F10 out
but otherwise prints every other "normal" key (including modifiers) as
KEY_A.

In the future we may need some more specific approach but for now this
will do. For the use-cases where we do need some specific approach,
libinput record and libinput debug-events will still show the full
keycode on request anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:43 +10:00
Peter Hutterer
abd5989ee8 plugin: prevent potential keycode leakage to the logs
Mixup of #if vs #ifdef caused this condition to always be treated as
true, resulting in leakage of key codes to the logs if the libinput log
level was set to debug.

Fixes: 7137eb9702 ("plugin: add ability to queue more events in the evdev_frame callback")

Closes #1163

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 13:02:20 +10:00
Peter Hutterer
7a22eb8d08 plugin/evdev: drop the duplicate event frame printing
The plugin system prints all events before they're passed to the plugin
anyway and the special evdev plugin does not do anything but pass it on.
We can thus assume that the events passed to libinput are the same as
the ones passed to this plugin.

Let's do that and adjust the print format to be closer to what
evdev_log_debug() would print.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 11:53:57 +10:00
Peter Hutterer
80b45ff28e test: a skipped test does not count as failure
There's a blurry line between NOT_APPLICABLE and SKIP but the latter
has a stronger "should run but can't right now". But where it happens
the skip shouldn't count as a failure.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 11:53:57 +10:00
Peter Hutterer
35838e9b2c test: fix litest_assert_str_not_in
Looks like an inadvertent paste or possibly a search regex gone wrong.
And the strstr condition was wrong too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1276>
2025-07-21 10:12:29 +10:00
Peter Hutterer
013ed167a4 libinput 1.28.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-17 11:29:06 +10:00
Peter Hutterer
eed4f84508 test: add a typical PS/2 wheel mouse
Notably without a high-resoulution wheel to ensure we run the tests on
those devices too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1275>
2025-07-17 00:36:52 +00:00
Peter Hutterer
18b34d0bc0 test: split some tablet tests into new groups
Our CI pipeline fails 9 times out of 10 on the valgrind tests. The tests
seem to finish in either 35 min or exceed the 60 min timeout limit, with
nothing in between. To avoid this let's split into more groups so we can
a) run those more in parallel and b) are less likely to hit the
timeout when run slowly.

Analysis of recent logs shows the eraser button tests to be the worst
offender, taking 752s (due to the combinatorial explosion) alone. The
various tip and proximity tests together also take some time so let's
group those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1274>
2025-07-17 00:16:02 +00:00
Peter Hutterer
c24ad64d18 meson.build: drop the timeouts to fit into the CI's 60 min limit
The vm tests had a 20 min timeout and a multiplier of 100. Our CI will
kill us (without logs) after 60 minutes.

Let's drop this to ~18min and a multiplier of 3 which gives us a few
minutes for setup before the CI terminates us. Ideally this means
we get some meson logs on timeout failures.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1274>
2025-07-17 00:16:02 +00:00
Peter Hutterer
7140f13d82 evdev: track KEY_SYSRQ frames and pass them even as repeat frames
Alt+Printscreen aka KEY_LEFTALT + KEY_SYSRQ is emulated by the kernel
and always posted with SYN_REPORT 1, see
drivers/tty/sysrq.c:sysrq_reinject_alt_sysrq()

The actual sequence when pressing Alt + Printscreen is to release Alt
first, then press it again:
- evdev:
    - [ 10, 674010,   1,  56,       0] # EV_KEY / KEY_LEFTALT               0
    - [ 10, 674010,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +2861ms
  - evdev:
    - [ 10, 674030,   1,  56,       1] # EV_KEY / KEY_LEFTALT               1
    - [ 10, 674030,   1,  99,       1] # EV_KEY / KEY_SYSRQ                 1
    - [ 10, 674030,   0,   0,       1] # ------------ SYN_REPORT (1) ---------- +0ms
  - evdev:
    - [ 10, 674031,   1,  99,       0] # EV_KEY / KEY_SYSRQ                 0
    - [ 10, 674031,   1,  56,       0] # EV_KEY / KEY_LEFTALT               0
    - [ 10, 674031,   0,   0,       1] # ------------ SYN_REPORT (1) ---------- +0ms

Handle that special case so we get our printscreen key to work as
expected anymore.

Fixes: 9a9466b6a9 ("evdev: discard any frame with EV_SYN SYN_REPORT 1")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1273>
2025-07-16 09:36:10 +10:00
Peter Hutterer
ccc798808a ci: don't paper over pre-commit failures
The ruff-format check only checks, it doesn't modify the files so our
CI doesn't catch formatting errors.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:26:59 +10:00
Peter Hutterer
79ea713aa3 tools: fix ruff format for libinput-replay
Fixes: 89c2f29d2c ("tools/libinput-replay: Warn if writing to local-overrides fails")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:26:59 +10:00
Peter Hutterer
7e98f2f2d2 pre-commit: update the name for the ruff check
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1272>
2025-07-15 16:24:27 +10:00
Peter Hutterer
778caa41af Add evdev_usage_name as helper for debugging
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1270>
2025-07-15 01:14:37 +00:00
Peter Hutterer
f98db521ee plugin: remove a leftover function
This one is no longer called, so no need to keep it around.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1269>
2025-07-15 10:51:42 +10:00
Peter Hutterer
0b07e77c3e plugin: remove a confusing FIXME
This is a leftover from the Lua plugin branch where the question of
whether to have public plugins before or after internal plugins is a
valid one. We don't have public plugins here, so let's remove this
fixme.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1269>
2025-07-15 10:51:42 +10:00
Peter Hutterer
c7ec39f51e test: tighten a helper function
Make sure we can pass only the right axis in

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
09acce4ce8 test: make the wheel tests stricter and always expect hires events
This would've caught #1156

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
c75d158bc0 test: swap a condition for easier readability
We have an else, so let's not do an `if not foo` condition.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
8fcacca7da util: print legacy axis events for debugging
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
Peter Hutterer
1dec6f98b0 plugins: add a plugin to emulate high-resolution wheel events
Fixes a regression causing missing scroll events on devices where the
kernel only sets REL_WHEEL/REL_HWHEEL but not the corresponding
hires events. On those devices we would get the legacy axis events but
no longer the new ones.

The mouse wheel plugin will correctly emulate missing hires events
but it doesn't attach to devices where the hires bit is never set.

This plugin can be very simple - since we know we enabled the code on
this device we don't need to keep any extra state around. If our frame
handler is called for this device we want to add the hi-res events.

Theoretically this breaks if the device has only one hi-res axis enabled
but not the other one (i.e. REL_WHEEL_HI_RES but only REL_HWHEEL) but
that's too theoretical to worry about.

Closes #1156

Fixes: 31854a829a ("plugin: only register the wheel plugin on devices that have a wheel")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1268>
2025-07-14 11:14:15 +10:00
gudvinr
975ce6dbf5 plugin/wheel: reduce ACC_V120_THRESHOLD
For mice with multipliers 30/120 and 40/120 nothing would change
as both will still cross threshold only after 2nd event.

But for MX Master 3 (and maybe others) that makes scroll beginning
a bit responsive, without jumping straight to 64/120 or 72/120.

Now events being emitted at 16+16+16 or 24+24 without significant
side-effects ("twitching" when resting finger on the wheel,
sudden scroll events when pressing middle button, etc). See !1262 for
some background.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1267>
2025-07-12 10:28:17 +03:00
Peter Hutterer
7716954365 libinput 1.28.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-07-10 11:51:28 +10:00
Peter Hutterer
6cdf46f857 plugins: restore the wheel plugin specifically for the MX Master 3
The MX Master 3 is difficult, its wheel events are all over the place
and heuristics are tricky to determine. The previous plugin behavior
was seemingly sufficient for the MX Master but not for other devices.

Restore the old behavior if the quirk is set for a device by adding a
fourth state ALWAYS_ACCUMULATE. In this state the min movement is never
updated from the original threshold, causing any wheel motion to
accumulate.

Ref: ca6b82841c ("plugin/wheel: tighten the wheel debouncing code")
Ref: bb05e0d1b5 ("plugin/wheel: don't accumulate for low HID resolution multipliers")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:24 +00:00
Peter Hutterer
f8c582db51 quirks: sort the quirk enum alphabetically
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:24 +00:00
Peter Hutterer
32c5fde0a8 Make the model quirk check available on the libinput device
Moves things one level higher to be able to use it from a plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1262>
2025-07-10 01:33:23 +00:00
Peter Hutterer
14a83ef18b test: fix a race condition during a switch test
Depending on the speed of the runner there may be a hold gesture being
triggered - let's ignore that one.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1265>
2025-07-10 00:36:23 +00:00
José Expósito
89c2f29d2c tools/libinput-replay: Warn if writing to local-overrides fails
Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1153
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1264>
2025-07-09 21:34:54 +00:00
Peter Hutterer
48d6e959ff test: add a test device for a pressureless tablet
See https://gitlab.freedesktop.org/libinput/libinput/-/issues/1152

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
2025-07-09 21:21:32 +00:00
Peter Hutterer
b0b3022c83 test: sort the litest tablet device list alphabetically again
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
2025-07-09 21:21:32 +00:00
Peter Hutterer
0cbe4976ed test: fix failing tablet tests for pressure-less tablets
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
2025-07-09 21:21:32 +00:00
Peter Hutterer
25614f005a test: add missing tip events in the tablet calibration test
We expect tip events because of the pressure values but for non-pressure
tablet we need to explicitly set tip down.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
2025-07-09 21:21:32 +00:00
Peter Hutterer
d9e2360d62 tablet: fix segfault on pressure-less tablets
Check whether a tablet has a pressure axis before unconditionally
dereferencing it.

Fixes: e9f3fc080c ("tablet: revamp the tablet pressure range handling")

Closes #1152

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
2025-07-09 21:21:31 +00:00
Peter Hutterer
bb05e0d1b5 plugin/wheel: don't accumulate for low HID resolution multipliers
Accumulating (and partially discarding) scroll wheel events serves to
debounce a scroll wheel and provide for more fluid scrolling where
scroll wheels can send events going in the wrong direction.

This is unlikely to happen on devices with low resolution multipliers
(i.e. where some significant physical movement by the wheel is required
to trigger events) so let's make it contingent on devices more likely to
have flaky wheels.

The magic threshold picked is 30 (HID resolution multiplier of 4) as a
guess. The resolution multiplier isn't accessible in userspace so we
have to heuristically get to it - typical interaction with a mouse will
have that value set within the first two, three scroll wheel events
though.

Closes #1150

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1261>
2025-07-09 01:46:41 +00:00
Peter Hutterer
ca6b82841c plugin/wheel: tighten the wheel debouncing code
The previous approach had a fixed threshold of 60 (half a detent)
below which scroll events were ignored. Reduce this threshold to have a
threshold of one device-specific delta. That threshold adjusts over time
to the device's individual minimum delta so after a few scroll event it
should settle on the lowest value possible.

The result is that fine-grained scrolling is possible on those devices
and only the very first scroll event is held back/swallowed, two events
in the same direction release scrolling.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1258>
2025-07-09 01:29:57 +00:00
Peter Hutterer
b347cc8691 pre-commit: bump to latest ruff-format
And update our python files according to latest ruff format output.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1259>
2025-07-09 00:13:00 +00:00
Peter Hutterer
e5e41ce7f5 CI: drop the separate python-format job
This is handled as part of the pre-commit hooks now which will also
ensure that we have the same version of ruff everywhere.

Fixes: a61c876412 ("pre-commit: drop black, use ruff-format instead")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1259>
2025-07-09 00:13:00 +00:00
Peter Hutterer
075a6dfaef plugin/wheel: ratelimit the 'missing hires' warning to once a day
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
9b7f933797 plugin/wheel: don't cancel the timer before re-setting it
Not needed and it saves us a bit of busywork.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
892e5d35c7 plugin: use evdev_frame_append_one() for simpler code
Instead of creating a struct and passing it in as array let's use the
helper function.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
a635176632 test: parametrize a test instead of in-test looping
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1260>
2025-07-08 04:02:50 +00:00
Peter Hutterer
9a9466b6a9 evdev: discard any frame with EV_SYN SYN_REPORT 1
When the kernel inserts a repeat frame it does that with EV_KEY code
value of 2 and the frame itself is a SYN_REPORT with value 1. Nothing in
libinput wants those repeat values, so let's discard them here before
anything tries to process them.

This inserted frame causes bugs on touchpads with EV_REP (rare enough)
because while the key event itself is dropped, the timestamp of the
frame still causes the next real frame's delta time to shorten,
resulting in wrong acceleration values.

Closes #1149

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
06d8750504 test: write pad events with a SYN_REPORT 0
The previous loop wrote whatever ring/strip value into the SYN_REPORT
event, causing frames with e.g. EV_SYN SYN_REPORT 7.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
dc48d28d74 test: de-duplicate some pad event handling with a helper
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1255>
2025-07-02 23:32:32 +00:00
Peter Hutterer
ce23e644aa test: keep waiting for a udev device on EAGAIN
This shouldn't happen because we turn off O_NONBLOCK on the udev
monitor's fd but sometimes this call fails with EAGAIN. If that happens,
keep busy-looping until we get some other error or success.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
6104fe44f1 test: if we fail to receive our udev device, abort with a useful error
This frequently fails when the runners are busy, so let's at least print
the errno to have *some* idea of what is failing.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
7135c2fc0c CI: retry valgrind jobs on failure
90% of failed valgrind jobs are caused by a race condition when a runner
is too slow. Instead of waiting for someone to click the retry button
let's just retry immediately again.

This could be fine-tuned to check for valgrind errors vs test suite
errors but for now this should do.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1257>
2025-07-02 12:46:50 +00:00
Peter Hutterer
27f4b0ae74 Move mtdev into a plugin
mtdev is used only for MT Protocol A device of which there are quite
few. But that protocol is also a perfect example for event frames in ->
different event frame out so let's move this into the plugin pipeline.

Because the plugin doesn't really have full access to the device's
internals we set up mtdev base on the libevdev information rather than
just handing it the fd and letting it extract the right info.

A minor functionality change: previously mtdev-backed devices returned
zero on libinput_device_touch_get_touch_count(). Now it is hardcoded to
10 - the number of callers that care about this is likely near zero.

Because it's now neatly factored out into a plugin we can also make
mtdev no longer a strict requirement.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
a86a9aedd6 Switch our internal dispatch interface to take an evdev frame
No functional changes, all the actual interfaces now simply loop through
the frame instead of expecting the dispatcher to do so.

The mtdev code changed slightly since we can shortcut in the non-mtdev
case.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
8141159beb Add evdev_frame_append_one()
This is the most common usage, let's add a helper.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1245>
2025-07-02 06:53:05 +00:00
Peter Hutterer
af6f53d55c git: add git-blame-ignore-revs to ignore the clang-format commits
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1256>
2025-07-02 12:43:13 +10:00
Peter Hutterer
31854a829a plugin: only register the wheel plugin on devices that have a wheel
Touchpad devices are pointers too in libinput but they don't usually
have wheels. Let's check for REL_WHEEL in device_new *and* then again
for the actual pointer capability in device_added.

Fixes: d1800a76fe ("evdev: Handle scroll wheel with a plugin")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
d458b86240 test: correct two capability checks
We have one test device that only has a horizontal scroll wheel but not
a vertical one, causing these tests to run unexpectedly.

One test needs both enabled (not strictly so but let's not bother) and
the other one only needs the vertical wheel.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
e77239f0c7 test: update a test for current kernels
This device was added before high-res scroll events existing in the
kernel and it's used in a test to verify that a device that has
ABS_MT_POSITION_X but not _Y doesn't get automatically ignored.

Said test (device_quirks_no_abs_mt_y) uses a wheel event to verify that
we do get events from this device.

Since then we've long had kernels that support hi-res scrolling and the
kernel takes care of those events for us. So let's update the device
description and the events we send to include the high-resolution
events. That doesn't change the validity of the test but stops it from
becoming a false positive.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1251>
2025-07-01 09:20:57 +00:00
Peter Hutterer
17731d415d Add a clang-format file for consistent code formatting
This *mostly* resembles our current coding style, at least to the extent
possible with clang-format.

There are a few oddities but they're not worth fighting over (for now)
and the most egregious violations have been addressed by shuffling
things around or just disabling clang-format in the previous commits.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:42:44 +10:00
Peter Hutterer
2a1095924b Run clang-format over the code
This uses the .clang-format file in the follow-up commit, but committed
prior to that to ease review of said file and various integrations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:42:44 +10:00
Peter Hutterer
490084569d test: add missing libevdev and util-mem includes
This only worked because of the include order.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:39:46 +10:00
Peter Hutterer
ed29a4f200 test: disable clang-format in test collections
It's too much effort fighting clang-format for these snippets which
all don't really do much anyway but are important to be read easily.

Let's categorically disable all formatting in the test collections and
move on.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
aebf3cd491 Add trailing commas to prevent clang-format oddities
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
784312a494 test: add clang-format directives to prevent formatting
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
4295c9bc1f test: switch more tests to litest_with_parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
45ab542cc3 test: move a comment to avoid confusing clang-format
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:36:14 +10:00
Peter Hutterer
c83bd808ae test: add missing NULL for a test device's udev properties
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:23:04 +10:00
Peter Hutterer
d6f081730a test: replace some litest_test_param_fetch with getters
The _fetch() api isn't very friendly to clang-format so let's use the
one that results in better formatting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1246>
2025-07-01 16:23:04 +10:00
Peter Hutterer
3df080513a test: fix automatic -j0 in debugger
If we're running in a debugger we want -j0 set by default so we don't
have to follow forks. This was traditionally JOBS_SINGLE but with
the drop of the check framework it's now -j0.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1253>
2025-06-30 05:58:46 +00:00
Wren Turkal
60abf15755 Fix some inconsistent whitespace.
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1254>
2025-06-29 17:00:15 -07:00
Kacper Piwiński
812bcd68f7 util: use already computed strlen v2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 17:38:48 +00:00
Kacper Piwiński
8ab0e53812 util: don't call function in macro argument v2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 07:32:25 +00:00
Kacper Piwiński
8c15a01d16 util: don't call function in macro argument
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 07:21:27 +00:00
Kacper Piwiński
0c2fd88580 util: use already computed strlen
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 06:51:51 +00:00
Kacper Piwiński
cc3f0c783a util: change n type to size_t in strneq
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1252>
2025-06-29 06:38:52 +00:00
Peter Hutterer
2b22a0b4ba meson.build: require libevdev 1.10
Released in 2020, that's plenty old enough now to get rid of an ifdef.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
2e0c3c4af4 test: only check error messages for bugs
The use of the bug log handler should be replaced with the captured logs
now but meanwhile: don't abort if we're running in --verbose mode and
something prints a debug message before our expected bug error message.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
d9a949657e touchpad: rename a function for consistency
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
fc70dc90f0 test: replace two goto outs with _unref_
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
dc8f7c3671 util: allow strv_from_string() with NULL nelems
The caller may not care about the number of elements, let them be
careless.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1250>
2025-06-27 08:21:13 +00:00
Peter Hutterer
9a8254fbb6 doc/user: update architecture docs with the plugin pipeline
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1248>
2025-06-27 04:11:40 +00:00
José Expósito
d1800a76fe evdev: Handle scroll wheel with a plugin
Transform the code present in evdev-wheel.c into a internal plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
ee35e04207 wheel: Remove unnecessary pending event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
5bc683c8dd wheel: Drop high-resolution wheel emulation workaround
Remove the workaround used to emulate high-resolution wheel scroll
events on kernels < 5.0 (~6 years old kernels).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1235>
2025-06-25 00:43:29 +00:00
José Expósito
ed3cb9cc48 fallback: Remove fallback_init_debounce() declaration
A leftover from commit 2c6fa261a3 ("evdev: replace the debounce
handler with a plugin")

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1247>
2025-06-24 10:12:12 +02:00
Peter Hutterer
e99f0c995e evdev: rename evdev_device_dispatch_one to evdev_device_dispatch_frame
Because it now takes a frame as argument, no longer a single event.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
f003dbb6cb plugins: fix the timer name for the tablet proximity timer
Since every device has one of those, let's name it after the device's
system.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
d2316d7e93 plugins: fix some indentation in the eraser button plugin
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1244>
2025-06-24 03:14:16 +00:00
Peter Hutterer
65e7cd5953 tools: handle an empty quirks list in the libinput recording
Fixes: 548279abee ("tools: store virtual property in recordings")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1243>
2025-06-24 02:57:31 +00:00
Peter Hutterer
a2694738cb tools: per-slot-delta initialize the pressure thresholds to zero
Python is unhappy about comparing None to > 0

Fixes: 9c042e9620 ("tools: add pressure threshold support to analyze per-slot-delta")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1243>
2025-06-24 02:57:31 +00:00
Peter Hutterer
2c6fa261a3 evdev: replace the debounce handler with a plugin
Same functionality but run as a plugin on the evdev stream instead.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Peter Hutterer
7d8fac2868 quirks: add a helper function for returning quirks for a device
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Peter Hutterer
6f403a0cc9 evdev: replace get_key_type with evdev_usage_is_button/key
Makes this easier to use from other areas and we never cared about the
key type NONE anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1230>
2025-06-24 12:01:51 +10:00
Borui Wang
9b28e7fd35 quirks: disable BTN_RIGHT on MS Surface Pro Flex Keyboard
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1236>
2025-06-23 23:21:12 +00:00
Peter Hutterer
b61a896407 util: fix the ANSI escape codes for bright colors, add some more
The previous incarnations of BRIGHT_FOO were actually bold foo. Change
the colors over to use the actual bright colors and make bold a separate
set of defines.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:57 +00:00
Peter Hutterer
0678ef2b98 util: add white to the ansi color escape codes
Can't be used because it's near invisible on white backgrounds
but have it for completeness.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:57 +00:00
Peter Hutterer
28a681932c wheel: match the state debug prefix with our other debug logs
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1240>
2025-06-23 12:52:56 +00:00
José Expósito
3a3e292d43 wheel: Rename scroll timeout callback function
The function name doesn't represent what the function really does.

Rename it and be consistent with the naming of other related functions
like wheel_set_scroll_timer() or wheel_cancel_scroll_timer().

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
2461cdf497 wheel: Use libinput_device_has_capability()
Use this helper instead of checking manually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
35598db1ce wheel: Remove unused argument from fallback_wheel_process_relative()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:24 +00:00
José Expósito
973d5ea587 wheel: Remove unused argument from fallback_rotate_wheel()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1241>
2025-06-23 02:18:23 +00:00
cptpcrd
84085edc04 pad: honor send-events mode
The custom implementation of the send-events mode for tablet pads does
not actually suspend and resume the device, so events continue to be
sent despite the device being theoretically disabled. Fix this by
removing the custom send-events implementation in favor of
evdev_dispatch's implementation.

Also add a simple test to ensure the send-events mode works.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1238>
2025-06-23 01:58:29 +00:00
Peter Hutterer
fca5154d1d touchpad: fix a debug message "released" -> "is no longer palm"
The touch itself remains down and is now considered a finger again, so
let's make this message less ambiguous.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1239>
2025-06-23 10:40:37 +10:00
Peter Hutterer
29bb231114 plugin: require plugins to enable the frame callback for a device
The vast majority of plugins are only interested in a single or a few
devices. Require that they enable the frame callback for those devices
and don't notify them for any other frames.

Give each plugin a unique index and use that for a bitmask to check if
the plugin wants events for a particular device. If not, skip it.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
2025-06-20 09:06:45 +00:00
Peter Hutterer
b31326dd02 plugin: log a debug message when a plugin terminates the event frame list
Our last plugin is our own evdev handling code so if the event queue
is empty before then that means a plugin has discarded the frame(s).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
2025-06-20 09:06:45 +00:00
Peter Hutterer
a6f7f55178 plugin: only load the plugin system once
This got lost during one of the many rebases, see
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217#note_2961314

It is required even without public-facing plugins so we don't end up
with duplicated plugins for every device added with
libinput_path_add_device().

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
2025-06-20 09:06:45 +00:00
Peter Hutterer
b3cbc6053f test: handle plugin bugs and log messages in the test suite
For the bug log handler check we need to print our message to search for
the "plugin bug:" prefix. And since we have that message printed now
anyway we might as well add it to the abort message.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1229>
2025-06-20 09:06:44 +00:00
Peter Hutterer
8f132481b3 zsh: add shell completion for the eraser button
Plus a note in tools/shared.h so we don't keep forgetting about this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1234>
2025-06-20 10:01:20 +10:00
Peter Hutterer
4336c0456f zsh: fix shell completion for set-area
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1234>
2025-06-20 10:01:20 +10:00
Jan Engelhardt
d67d45a8fd Teach meson about pkgconfig Requires.private
Fixes: ed87c6dbb0 ("Add libudev and -lm to Requires.private")
added Requires.private, 4f4bfae2a1 ("Add meson.build file")
forgot to transplant the logic to meson.build.

Fixes: 4f4bfae2a1 ("Add meson.build file")

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1232>
2025-06-19 13:05:26 +00:00
Peter Hutterer
b1bc500e0d Remove unused pc.in files
These have not been used since the switch to meson.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1232>
2025-06-19 13:05:26 +00:00
Peter Hutterer
f6c4a361c0 tools: disable GTK's deprecated warnings
I'd be surprised if those get removed before the whole X11 support is
removed - and in that case we can remove the x11 support as well.
So let's disable the warnings and deal with it when it truly breaks -
there are no replacements for what we want to do here after all.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1233>
2025-06-19 14:50:25 +10:00
Peter Hutterer
56f0524115 tablet: always allow BTN_STYLUS* for eraser button configuration
If the button we want to map to isn't enabled by the kernel allow
setting the button nonetheless. On some tablets we only get the
actual number of button codes (e.g. BTN_STYLUS only on an Inspiroy 2S)
so not being able to map the eraser button to some other button makes
this whole feature a bit pointless.

Special-case BTN_STYLUS* because these are the ones we'll always allow.

This fixes an issue with the eraser button defaulting to BTN_STYLUS2
on some devices but it couldn't actually be set to that value by the
caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1231>
2025-06-19 01:51:52 +00:00
Peter Hutterer
34da27650d tablet: take an uint32_t for the eraser button
For consistency with other set_button configuration options.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1231>
2025-06-19 01:51:52 +00:00
Peter Hutterer
9c042e9620 tools: add pressure threshold support to analyze per-slot-delta
Color touches above the minimum threshold and above the down threshold
so it's easier to analyze a recording. Sometimes touches move
unexpectedly but if it's low-enough pressure this may not affect
libinput.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1225>
2025-06-19 00:00:48 +00:00
Peter Hutterer
c48aff86d7 tablet: implement eraser button disabling
This adds a new (internal) plugin that is responsible for eraser button
disabling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
42c0bff29b plugin: add internal api to notify plugins of tool configuration
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
4ef14e14e4 Add an API for configurable eraser button behavior
This adds the public API to configure an eraser button on a tablet tool
to emulate a normal button. In DEFAULT mode the eraser button will
simply do whatever it does by default (i.e. toggle to eraser).
In BUTTON mode the eraser button will be converted to a regular tool
button event, with libinput handling the underlying proximity event
madness.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
2d23d7f4aa tablet: implement the tablet proximity timer as plugin
Together with the "forced-tool" quirk (that enforces BTN_TOOL_PEN to be
set even if the tablet doesn't) since those two go hand-in-hand.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
e5e28ea7e6 tablet: implement the tablet double tool quirk as plugin
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
e7ebb1bca6 tablet: keep a ref to the last tablet in proximity for each tool
99.9% of the time the next tablet will be the same tablet it was used on
last. Having a ref means we can modify tablet settings while the tool is
out of proximity.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
28e50024ab tablet: move the libwacom stylus query out into the caller
Better re-usability of the WacomStylus struct in subsequent patches.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
8974a15178 util: add a bitmask_t type for bit masks
Previously we used uint32_t for bitmasks but having a custom type means
we're less likely to confuse an int value with a mask type.

Two types of API here, the u32 api for passing in masks and a bit API
for passing in single bits.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
905b4c6a4c evdev: implement our evdev device dispatch as plugin
This makes event handling easier where plugins queue other event frames
per frame. Our initialization guarantees that our evdev code is alway
the last plugin in the series so in the no-plugin case we just pass on
to that.

The effective event flow is now:
    evdev.c -> plugin1 -> plugin2 -> evdev-plugin.c -> evdev.c
except that no plugins exist yet.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:54 +00:00
Peter Hutterer
83222a0798 plugins: Add the ability for a plugin to inject evdev frames
This adds a callback for plugins (and lua plugins) to inject an evdev
frame into the event stream. Unlike the prepend/append functions
this one injects the event at the bottom of the plugin stack as if
the device had sent the frame right then and there.

There's a drawback though: the event frame isn't marked as synthetic
so it cannot be identified without having a guard in the plugin so
the same frame is not reprocessed.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:54 +00:00
Peter Hutterer
5698e3c12f plugin: wrap timers for use by plugins
Wrapping timers means plugins we can set up the event queue for a plugin
when the timer triggers, allowing plugins to queue events during the
timer func.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:54 +00:00
Peter Hutterer
e69c0b9bfb plugin: allow a prefix during event frame printing
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:54 +00:00
Peter Hutterer
7137eb9702 plugin: add ability to queue more events in the evdev_frame callback
This adds a event queue pointer to each plugin that is set when the
plugin's evdev_frame() callback is invoked. If the plugin calls
libinput_plugin_queue_event_frame() during the callback the given
event frame is appended to an event frame list (starting with the
current frame). Once the callback completes, that frame list is
passed to the next plugin and each frame is replayed on the next plugin.

In the case of multiple plugins queueing events this effectively builds
a tree of frames which each level of the tree representing one plugin.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:53 +00:00
Peter Hutterer
38d92a96b9 evdev: don't notify plugins about devices we will never add
We require ID_INPUT on any device we want to handle so let's filter any
device that is missing that property before we notify the plugins.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:53 +00:00
Peter Hutterer
3958ba44c2 Add an internal plugin system to libinput
This adds the scaffolding for an internal plugin architecture. No such
plugin currently exists and any plugin implemented against this
architecture merely is plugin-like in the event flow, not actually
external to libinput.

The goal of this architecture is to have more segmented processing
of the event stream from devices to modify that stream before libinput
ever sees it. Right now libinput looks at e.g. a tablet packet and then
determines whether the tool was correctly in proximity, etc.
With this architecture we can have a plugin that modifies the event
stream that the tool is *always* correctly in proximity and the tablet
backend itself merely needs to handle the correct case.

The event flow will thus logically change from:
   evdev device -> backend dispatch
to
   evdev device -> plugin1 -> plugin2 -> backend dispatch

The plugin API is more expansive than we will use immediately, it is the
result of several different implementation branches that all require
different functionality.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1217>
2025-06-18 06:18:53 +00:00
Peter Hutterer
7e6a9f322f test: restore prefix search in the format
Otherwise we get false positives for "pressure:" since that may also
show up in the "Queuing ... " message for tablet events.

Fixes: 9f6b294e36 ("test: print the log message to a buffer, then print the whole lot")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1228>
2025-06-18 05:32:39 +00:00
Peter Hutterer
7516dddeb3 util: fix a memleak for the dwtp string
Was assigned to dwt and any device with both dwt and dwtp would leak
that string.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1227>
2025-06-18 12:22:21 +10:00
Peter Hutterer
471912aacf test: add litest_assert_strv_substring
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1226>
2025-06-17 13:50:58 +10:00
Peter Hutterer
a0a2416d11 test: add logcapturing to litest
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1226>
2025-06-17 13:50:58 +10:00
Peter Hutterer
2dcfda2ebc util: add ANSI escape codes for rgb and background rgb
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1226>
2025-06-17 13:50:58 +10:00
Peter Hutterer
1850ea18f4 util: add safe_atou64 for 64-bit values
Copy/paste from safe_atou

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1226>
2025-06-17 13:50:58 +10:00
Peter Hutterer
9f6b294e36 test: print the log message to a buffer, then print the whole lot
This reduces the number of actual printf calls to one and makes it
easier to search for a string in the message for highlighting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1226>
2025-06-17 13:50:57 +10:00
Peter Hutterer
76f88deb24 touchpad: remove a workaround for an old libevdev bug
Require libevdev 1.9, released in 2020.

Reverts commit 1e1b9c0e60 ("touchpad: never reduce the slot count to 0")

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1224>
2025-06-16 17:11:14 +10:00
Peter Hutterer
d67474645c doc/user: device quirk matches have to be 0x prefixed
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1223>
2025-06-16 06:39:25 +00:00
Sebastian Lövdahl
17a7ed54d7 Fix typos in index.rst
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1222>
2025-06-13 17:28:05 +00:00
Peter Hutterer
ef15d7ed08 test: fix the valgrind/debugger check
First condition was always false since we never run gdb and valgrind at
the same time.

Fixes: bd7b91065b ("evdev: warn if our event processing lags by 10ms or more")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1221>
2025-06-13 09:39:11 +10:00
Peter Hutterer
24c84a65b4 test: insert libinput_dispatch() on the secondary context to avoid timeouts
In these tests we have a secondary context but didn't call
libinput_dispatch() regularly so we're guaranteed to hit timeout errors
on the secondary context for any event sequence longer than e.g. our
hold gesture timeout.

litest_touch_move_to() waits 10ms between movements and calls
libinput_dispatch() but obviously not for the secondary context so we
need to do this manually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1221>
2025-06-13 09:39:11 +10:00
Peter Hutterer
5d23794d53 tablet: disable smoothing for uinput devices
When a tablet was created via uinput we trust that the
tablet's events are preprocessed to the point where we
no longer need to apply smoothing to the axes.

Closes #1120

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1219>
2025-06-12 09:49:15 +00:00
José Expósito
3b52569864 quirks: add Contour Design RollerMouse USB Receiver
The Contour RollerMouse have a button for "double click" which emulates
a double click.

The two clicks are so close together that libinput triggers the
debouncing functionality.

Adds the ModelBouncingKeys quirk for the USB receiver.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1138
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1220>
2025-06-12 08:58:05 +00:00
Peter Hutterer
c4d0d2c09d Switch some uint32_t usage loops to use evdev_usage_next
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
1c5715fedf Use a newtype for the keycode, button code and pad button
This provides both some type-safety but also better readability of what
the integer we're passing around is supposed to be. In particular the
pad buttons are numeric buttons while the normal buttons are evdev
codes.

Future extension of this could be to also check for (or against) the
valid BTN_* ranges for a button code or keycode.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
c821bbd8e4 Drop struct input-event from dispatch->interface->process
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
28ee82b6f1 Switch the tablet pad backend to use struct evdev_event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
4eb8ccb10d Switch the totem backend to struct evdev_event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
56bad53f29 Switch the tablet backend to use struct evdev_event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
4be243d0e7 Switch the fallback and touchpad backends to use struct evdev_event
These two use enough shared functions that they cannot be switched
separatly.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
41e988c99e Introduce our own evdev_event struct
In addition to the evdev_frame this struct is what contains our actual
events instead of a struct input_event. The goal of this is twofold:
slightly better memory usage per frame since we can skip the timestamp
and refer to the evdev frame's timestamp only. This also improves
handling a frame since we no longer need to care about updating
all events when the timestamp changes during appending events.

Secondly it merges the evdev type + code into a single "usage"
(term obviously and shamelessly stolen from HID). Those usages
are the same as the code names but with an extra EVDEV_ prepended,
i.e.  EV_SYN / SYN_REPORT becomes EVDEV_SYN_REPORT.

And they are wrapped in a newtype so passing it around provides
some typesafety.

This only switches one part of the processing over, the dispatch
interfaces still use a struct input_event

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
540605f8e4 evdev: use frame-based dispatching of events
Accumulate evdev events until we get a SYN_REPORT, then dispatch all
of those as a single event frame. This currently has little functional
change because we then just loop through the events anyway so it's just
an extra layer of indirection.

The size of the frame is hardcoded because we should never get anywhere
near than 64 events within any one evdev frame anyway (even 5 fingers
down with 10 properties for each touch point only get up to ~60 events
within one frame (5 * 10 + ~10 for the single-touch bits).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Peter Hutterer
9f00f77bc4 Add an evdev_frame wrapper struct
The kernel only ever gives us a frame of events in one go (it flushes on
SYN_REPORT). We then need to look at that frame as a single state change
(keyboards excepted for historical reasons) so let's push this into a
proper struct we can pass around.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1215>
2025-06-12 18:20:40 +10:00
Ryan Hendrickson
548279abee tools: store virtual property in recordings
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1213>
2025-06-08 23:55:10 +00:00
Ryan Hendrickson
8a95c0e3c8 wheel: add and use ignore_small_hi_res_movements
ignore_small_hi_res_movements is set to true if the underlying device is
not virtual.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1213>
2025-06-08 23:55:10 +00:00
Ryan Hendrickson
efb4b6a3be evdev: detect virtual devices
The quirk AttrIsVirtual takes precedence, if present. If not, use the
syspath of the event device to detect if it is virtual, as long as we
aren't running the test suite. (Test suite devices are all virtual, but
we should test them as if they aren't.)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1213>
2025-06-08 23:55:10 +00:00
Peter Hutterer
49eb6cb8ab Move the log #defines and declarations to a separate header
Makes them easier to re-use as API

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1216>
2025-06-06 13:11:34 +10:00
Peter Hutterer
d9d4d92ff0 Move libinput_now() to our timer.c helper functions
This is just general cleanup so libinput_now() is easier to use without
needing to include libinput-private.h (which itself opens up most of
libinput's internals).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1216>
2025-06-06 13:11:32 +10:00
Peter Hutterer
5774463dde tablet: shut up deprecated declarations warnings
No need to see those every time, #1137 now tracks this

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1214>
2025-06-06 11:00:04 +10:00
Peter Hutterer
46950de903 util: return early when listing files from a NULL directory list
For consistency with "no matching file found" return a single-null-entry
array.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1212>
2025-06-05 00:49:57 +00:00
Peter Hutterer
d5761547da test: add litest_log_group() for easier test log grouping
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1210>
2025-06-04 04:07:26 +00:00
Peter Hutterer
669bc620aa test: add helpers for private data handling in tests
Our litest context needs the libinput user_data but it does provide
a `private` pointer for our test data - let's reduce the boilerplate
to access that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1211>
2025-06-03 09:32:42 +00:00
Peter Hutterer
ec9c39da18 util: add a number of list helpers
The list_debug function is ifdef'd out, it'll be useful to debug
whenever we have some list corruption.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1209>
2025-06-03 09:10:15 +00:00
Peter Hutterer
57a0a219b0 evdev: Handle MSC_SERIAL better in the event log print
Print it as hex and align it better in the output

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1208>
2025-06-03 08:55:24 +00:00
Yang Kun
8fe6cc9396 quirks: modify touchpad quirk for ThinkBook G7+
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1206>
2025-06-01 19:02:38 +08:00
Peter Hutterer
ea50e1a92c test: add litest_assert_str_in/not_in() helpers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
14c4667980 test: add litest_assert_not_reached()
Simpler than a specific litest_abort_msg() everywhere

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
e91e1c3111 util: add a tmpdir helper
With the __attribute__(cleanup) helper this makes it simple
enough to provide a tempdir inside a function that is (recursively)
automatically deleted when the variable is deleted.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
91d4f9e58e util: add an rmdir_r helper function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
efea8463fe util: add a helper to find files in a set of directories
Returns a number of paths for files with a given suffix in a
priority-sorted list of directories.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
95a417cefa util: add a helper to find substrings in a strv
Returns true and optionally the first index of any string in strv that
contains the given substring.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
6f28664854 util: move zalloc to util-mem.h
zalloc pre-dates util-mem.h but let's move it there, it makes more sense
than including util-strings.h.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
15b4ea59e9 test: improve an error message for an unlikely error
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Peter Hutterer
d5cd398b77 test: improve an error message for unhandled parameter types
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1204>
2025-05-26 05:22:33 +00:00
Benjamin Tissoires
c4b8cb6423 CI: run marge-bot pipelines as priority:high
The workflows.rules is copied from mesa/mesa.

When marge is running the CI, we can assign it to a higher priority
queue, allowing non marge jobs to be run after.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1205>
2025-05-23 10:16:08 +02:00
Peter Hutterer
87e13ebb8b CI: bump to use Fedora 42
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1199>
2025-05-19 09:41:08 +10:00
Peter Hutterer
66d32803d3 meson.build: don't error on deprecated declarations with -Werror
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1203>
2025-05-16 20:45:49 +10:00
Peter Hutterer
f653ce0a22 Fix links to point to the current doc pages
The underscored page names date back to doxygen and have been obsolete
for many years now.

Closes #1123

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1202>
2025-05-16 05:45:51 +00:00
Benjamin Tissoires
7915921a3c CI: replace b2c with virtme-ng
vng is much faster than b2c for spinning up the jobs, so better use this
instead.

Bonus point: we don't need the start-in-systemd.sh stunt.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1125>
2025-05-14 18:22:32 +02:00
Peter Hutterer
0e67cdc4ed gestures: rewrite the gesture state transition debugging code
Fixes a spurious compiler error in release builds:

cc -Ilibinput-plugin-test-suite.p -I. -I.. -I../src -I../include -I/usr/include/libevdev-1.0 -I/usr/include/libwacom-1.0 -I/usr/include/gudev-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O3 -Wno-unused-parameter -Wmissing-prototypes -Wstrict-prototypes -Wundef -Wlogical-op -Wpointer-arith -Wuninitialized -Winit-self -Wstrict-prototypes -Wimplicit-fallthrough -Wredundant-decls -Wincompatible-pointer-types -Wformat=2 -Wno-missing-field-initializers -Wmissing-declarations -fvisibility=hidden -Werror -pthread -MD -MQ libinput-plugin-test-suite.p/src_evdev-mt-touchpad-gestures.c.o -MF libinput-plugin-test-suite.p/src_evdev-mt-touchpad-gestures.c.o.d -o libinput-plugin-test-suite.p/src_evdev-mt-touchpad-gestures.c.o -c ../src/evdev-mt-touchpad-gestures.c
../src/evdev-mt-touchpad-gestures.c: In function ‘tp_gesture_handle_state’:
../src/evdev-mt-touchpad-gestures.c:1814:69: error: ‘%s’ directive argument is null [-Werror=format-truncation=]
 1814 |                         int n = snprintf(&buf[slen], remaining, " → %s", gesture_state_to_str(*s));
      |                                                                     ^~

Apparently because gesture_state_to_str() may return null (this cannot
happen in our code) it fails with an error here. So let's rewrite it to
use our strv helpers.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1201>
2025-05-11 23:51:10 +00:00
Peter Hutterer
97a7ab7f9d CI: bump to Ubuntu 25.04
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1200>
2025-05-09 17:34:52 +10:00
Peter Hutterer
40bbf8cff6 CI: update to latest ci-templates
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1200>
2025-05-09 16:39:23 +10:00
Peter Hutterer
8177a685c2 meson.build: fix detection of C23 auto
Sadly, this detection was broken because in C everything defaults to
type int. Casting a const char* to int is permitted but generates a
warning which was promptly ignored by meson.

This result in HAVE_C23_AUTO being set on compilers that don't by
default have -Werror=implicit-int and "auto" ended up being just an
"int".

Change the detection to use gmtime() which returns a struct, and add a
basic test using one of our struct-returning utility functions, just to
be sure.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1198>
2025-05-08 23:06:58 +00:00
Peter Hutterer
04975b4618 Constify libinput_config_accel_set_points()
We copy the contents of the double array so let's constify this.

Fixes: 5324f425a1 ("Introduce custom acceleration profile")

Closes #1114

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1195>
2025-05-06 04:34:46 +00:00
K900
fc3868a4de quirks: add quirk for Asus ROG Flow Z13 2025 (GZ302EA) tablet
The volume buttons should not be disabled in tablet mode.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1196>
2025-05-04 12:28:34 +03:00
Peter Hutterer
d400b17bee util: add the macros required for magic vararg expansion
A set of macros that expand to different things depending on the
number of arguments passed into the macro. Can be used for anything
but in the test case we use it to differ between stringifying the single
argument or taking a custom string for that same argument.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1188>
2025-04-28 10:05:52 +10:00
Peter Hutterer
9d828ae069 CI: bump to Ubuntu 24.04
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1194>
2025-04-24 20:17:19 +10:00
Peter Hutterer
04a55d59d9 test: call rmdir for directories, not unlink
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1193>
2025-04-24 17:34:07 +10:00
Peter Hutterer
6563b66a92 utils: add strv_find()
Finds and optionally returns the index of a string in a strv

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1193>
2025-04-24 17:34:06 +10:00
Peter Hutterer
b481170918 evdev: use autofree for the sysname
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1193>
2025-04-24 15:31:19 +10:00
Peter Hutterer
43c4224e56 quirks: add quirk for the RazerBladeLate2020Base keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1191>
2025-04-17 09:56:19 +10:00
Peter Hutterer
479a3d024c test: improve debugging for one of the tablet tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1185>
2025-04-16 19:57:21 +10:00
Peter Hutterer
b2c42b60da test: rewrite the udev seat change test
The previous test was prone to a race condition if multiple tests were
run in parallel: since we're using a udev context here we would see any
device added through uinput. If the DEVICE_ADDED event was from a
device added by some other test we would later fail the test because
that other device still used the default seat.

Rewrite it to use a name comparison and in the process start using the
cleanup macros.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 19:15:56 +10:00
Peter Hutterer
2487273b5e test: use litest_dispatch() in litest_wait_for_events()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 19:15:29 +10:00
Peter Hutterer
5c1c14e567 test: parametrize some of the misc tests
This fixes an issue with the abs_device_missing_res tests where we only
tested for the X axis without a res.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
c9b92d9b6b test: use __attribute__(cleanup) in udev tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
a19671d0da Use _unref_ for the udev handling in path and udev seat implementations
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
d72df04e7d test: auto-unref the litest devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
cefab21e42 util: add an _unused_ macro and replace LIBINPUT_UNUSED
For annotating intentionally used variables it needs to be a bit
shorter, so let's replace the current one which was aimed at functions.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
6cbe4568de test: rename litest_delete_device to litest_device_destroy
To be closer to the common free/destroy/unref pattern

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
6f6bba9588 test: use __attribute__(cleanup) for the test libinput contexts
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
34b3881d24 test: remove an unused variable in the totem tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
923e8e43db test: use __attribute__(cleanup) in the switch tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
1ae9462366 test: use __attribute__(cleanup) in the path tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
74e6b97d1e test: use __attribute__(cleanup) in litest
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
df1c715cb0 test: use __attribute__(cleanup) in the litest-runner
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
fbc8eb8cb7 quirks: use __attribute__(cleanup)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
0ecd08c134 tools: use __attribute__(cleanup)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
d5e2bb1267 util: use cleanup in the event printing helpers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
bbbe757a26 Define a set of cleanup helpers
These are all data structs that are used in libinput and the tests,
let's declare them in a shared header so we can use them everywhere.

For udev and libevdev let's use an ifdef check for a known #define
so we don't have to add those deps everywhere.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
ae423bc3fe util: define a cleanup for stringbuf
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
829aec8055 util: add a list helper for handing a pointer to a list
Effectively a combination of list_append() and steal.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
76c87d2486 util: add various helper functions to use __attribute__(cleanup)
Taken from libei, with slight modifications. The general approach is:
basic data types use _autofoo_ to call the maching foo function on
cleanup. Struct types use _unref_, _destory_, _free_, whichever applies
to that struct.

Notably: attribute syntax depends on where it's declared [1] so in the
following examles only a, b, and d have the autofree attribute:
   _autofree_ char *a, *b;
   char *c, _autofree *d;

Simplest way to ensure it's all correct to keep the declarations one per
line.

[1] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1184>
2025-04-16 17:04:58 +10:00
Peter Hutterer
436eb42044 CI: check for empty lines between closing braces
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1190>
2025-04-16 11:44:09 +10:00
Peter Hutterer
546debe926 Remove empty lines between closing braces
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1190>
2025-04-16 11:44:09 +10:00
Peter Hutterer
265cacb246 test: properly batch litest events
If we push/pop event frames and combine various functions we might end
up sending the same value in the same frame multiple times. This
*should* be fine with libinput but is different to what the kernel does
in that case and harder to debug.

Let's batch any litest_event() until an EV_SYN arrives, then write them
all to libinput in one go.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1187>
2025-04-15 05:06:53 +00:00
Peter Hutterer
c96ed7f6b8 test: convert push/pop event frames to with_event_frame
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1187>
2025-04-15 05:06:53 +00:00
Peter Hutterer
550ffc1160 test: combine two REL_WHEEL_HI_RES events into one
This would be a kernel bug to send wheel events like this so let's not
test it this way.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1187>
2025-04-15 05:06:53 +00:00
Peter Hutterer
42c685dbb0 test: fix missing SYN_REPORT events between events
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1187>
2025-04-15 05:06:53 +00:00
Peter Hutterer
95406b2182 test: print the full test result in the list of failed tests
When running several tests simply having the list of failed test names
is not very convenient. The actual error may be thousands of lines north
and worse, meson only prints the last 100 lines of a test log by default.

So let's print the full test data including backtrace etc. at the end
instead.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1189>
2025-04-15 14:05:21 +10:00
Peter Hutterer
6720c6899f test: annotate/shorten a test case
This test has a tendency to fail during recent development, let's make
it easier to debug.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:43 +10:00
Peter Hutterer
610cad7e82 test: disable the proximity timer for the touch arbitration test
Depending on race conditions we may get a proximity out event while
testing the touch arbitration timeout.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:39 +10:00
Peter Hutterer
8770c74394 test: mark a checkpoint when asserting a tip or button event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:34 +10:00
Peter Hutterer
8c28783dd2 test: add litest_with_event_frame() to make things easier to visualize
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:27 +10:00
Peter Hutterer
c94276fd14 test: improve the direct tool switch test
Use better (newer) helpers and separate the pen/eraser for readability.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:18 +10:00
Peter Hutterer
d74b2adde5 test: indentation fixes
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:09:08 +10:00
Peter Hutterer
190b796794 test: modernize a test slightly
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:08:30 +10:00
Peter Hutterer
0e3bb4690a test: switch some xasprintf to strdup_printf()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:07:24 +10:00
Peter Hutterer
589850e8df test: correct the libevdev initialization in two tests
These are used to create a new struct libevdev so let's not wrongly
initialize them to an existing struct.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:07:24 +10:00
Peter Hutterer
c59453e4ab test: remove a race condition
If the host is a tad slow we need to wait for the events instead of
assuming they're already waiting for us.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1186>
2025-04-15 11:07:24 +10:00
Subhaditya Nath
2ebb6d4a75 zsh: add missing backslash
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1183>
2025-04-07 18:13:17 +00:00
Peter Hutterer
ecd4ea3053 util: add a wrapper for the C23 auto keyword
C23 auto is basically __auto_type so let's wrap it if our compiler
doesn't provide it (yet).

This lets us use `auto` as type specifier, e.g. compare
   enum libinput_config_status status = libinput_device_config_set(...)
   auto status = libinput_device_config_set(...)

Note that as of now meson will never detect this as it requires -std=c23
to be passed to the compiler. This flag is only supported by Clang 18
(released 2024) and we don't want to break things for older compilers
for what is a bit of a niche feature right now.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1181>
2025-04-07 09:00:42 +00:00
Peter Hutterer
bf67c056df CI: replace the scan-build job with a clang-tidy job
Drop the scanbuild wrappers, especially the junit conversion script
which's results haven't been looked at for ages.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1182>
2025-04-07 08:43:36 +00:00
Peter Hutterer
6876d71a4d Add a clang-tidy file
This gives us the ninja clang-tidy command. clang-tidy replaces
scan-build and is more featureful (and picky).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1182>
2025-04-07 08:43:36 +00:00
tokyo4j
cc0889bf2b gestures: fix acceleration in 3fg drag
Before this patch, tp_filter_motion() was called twice in pointer motion
handler during 3fg drag, causing the pointer speed to be much faster
than during 1fg motion when the acceleration profile is adaptive.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1180>
2025-04-05 12:16:25 +09:00
Peter Hutterer
e9f3fc080c tablet: revamp the tablet pressure range handling
Commit 48cd4c7287 ("tablet: track pressure ranges per tablet") added
tracking of pressure ranges per tablet by storing ranges for multiple
(up to 4) tablets in the tool. This doesn't scale well, had the
disadvantage of the range only being updated on out-of-proximity, and is
the wrong approach anyway.

Turns out we can update the pressure range on proximity in since we
haven't processed the pressure values yet at that stage. This gives us
better behavior when switching between tablet devices (including unplug)
as the pen will only lag behind once (when setting the range) instead
of once per new tablet.

However, since the offset (which is a tool issue) applies on top of the
pressure range (which is a tablet property) this requires that we now
track the offset as percent of the range.

So on proximity in we apply the new tablet range, then apply the e.g. 5%
pressure offset within this range.

This means we no longer have to track multiple tablets since it'll just
apply on the current tablet when in proximity.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1172>
2025-04-04 22:44:29 +00:00
Peter Hutterer
63a8ad2ead util: add some extra strv helpers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1178>
2025-04-04 22:19:47 +00:00
Peter Hutterer
5c751491fa Add a few missing includes for config.h
This caused the headers to not haved _GNU_SOURCE set which in turn
caused clang-tidy to complain because util-strings.h didn't have
strtod_l.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
df8726b405 udev: remove accidentally-checked in file
Accidentally added in e7a9c07ffe but never hooked up to meson so it
never got built. And if it did it'd have failed.

Fixes: e7a9c07ffe ("udev: parse the EVDEV_ABS properties for a potential fuzz setting")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
e316e7c4b0 tools: disable clang-tidy warning about using floats for loop counters
Really doesn't matter here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
6770131e94 util: fix a memleak in mkdir_p
In the error case path would leak.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
051ac26a20 util: shut up clang-tidy about our use of strcat
These are pre-counted strings, we're fine.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
0fc52abd79 util: change the builddir_lookup() to return a boolean
All but one callers of this function only care about yes/no, so let's
change it to only return the build dir in the one case it's needed.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
d8482a2540 util: use a late declaration to avoid one ifdef
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
a92d635af1 test: rename test-util-includes.c to .c.in
This way it doesn't get picked up by static analysis tools which are
then unhappy about the @FILE@ placeholder

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
097e947523 tools: add missing include
struct option is used in one of the static inlines here, so let's
include getopt.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
f123da174e Add a few 0 enum values to shut up clang-tidy
These are all internal API so having a NONE value means we can shut up
warnings about 0 not being an enum value without having those exposed in
our public API.

And they slightly improve readability in the callers anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1175>
2025-04-04 15:47:23 +00:00
Peter Hutterer
a55dd604e1 util: add a newtype macro
In a valiant approach to introduce some type-safety (after spending time
debugging a int vs double confusion) this adds a DECLARE_NEWTYPE()
macro that declares a named struct with a single typed value field.

This is basically the C version of Rusts "struct Foo(u32)" with
a few accessors auto-generated by the macro.

C is happy to silently convert between base types but it doesn't do
so for structs so this allows us to have some type safety
when we accidentally assign two incompatible fields to each other (e.g.
an axis value in device units vs a percentage value).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1171>
2025-04-04 11:05:20 +00:00
Peter Hutterer
000d9282cd test: split litest's main() into a separate file
Instead of having this ifdef'd out split the main and directly
associated functions out into a separate file.

That ifdef used to exist so we can use parts of litest in some other
files (the selftest and the utils test). Those tests care mostly
about the assertion helpers so long-term a split into
assert helpers and "rest of litest" would be better. For now, this will
do.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1174>
2025-04-04 06:28:07 +00:00
Peter Hutterer
bbd9df60de test: use the local variable for njobs, not the global one
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1174>
2025-04-04 06:28:07 +00:00
Peter Hutterer
5a652e5116 test: make the timeout functions auto-dispatching
The overwhelmingly vast majority of invocations want to have a dispatch
before/after, so let's automate that. In case NULL is passed, that
dispatch is skipped.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
734ffea934 test: use a single litest_timeout function only
This can be easily wrapped with a macro that passes in the millis to
time out for.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
b43abaeacb test: allow passing func/line up from litest_abort_msg()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
90dafb33b4 test: print drained events when draining typed events
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
b3471a960e test: add missing proximity timeouts to the tablet tests
A bunch of tests that left proximity but didn't wait for the proximity
timeout.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
7a9f4f1c38 test: switch to litest_dispatch()
litest_dispatch() was added in 86c47be816, the rectangle tests spawn
from the same time but didn't get updated before merging.

Fixes: 86c47be816 ("test: add litest_dispatch() for better test debugging")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
978871c450 test: abort litest_wait_for_events() if we don't get events after 2s
Previously we kept polling but this just delays what will almost
certainly be a failure anyway - none of our tests require even 2000ms
for an event to arrive.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
35b223aa8e test: fix wacom test devices to use pressure 0 on proximity out
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1169>
2025-04-04 05:13:00 +00:00
Peter Hutterer
d2969f5203 tools/record: correct the --help output for autorestart
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1173>
2025-04-04 04:47:36 +00:00
Peter Hutterer
8683457ee9 test: re-enable the selftests
An `#if 0` was accidentally checked in in 1e445f3f84, disabling all but
the newly added tests there.

Fixes: 1e445f3f84 ("test: implement support for parametrizing tests")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1177>
2025-04-04 12:09:49 +10:00
Peter Hutterer
0cc1e651d8 CI: disable docs on the arch build
Apparently python-recommonmark has moved to the AUR and it's not worth
the extra effort of figuring out how to install it.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1176>
2025-04-03 23:40:17 +00:00
Peter Hutterer
552728f957 CI: bump to FreeBSD 14.2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1176>
2025-04-03 23:40:17 +00:00
Araz Abdyev
9c6894c5c8 quirks: add touchpad quirk for ThinkBook 16 G7+ ASP
Signed-off-by: Araz Abdyev arazdatas@gmail.com
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1170>
2025-04-01 12:25:09 +00:00
Peter Hutterer
4f7b4ef0e4 libinput 1.28.1 2025-04-01 12:46:07 +10:00
Peter Hutterer
95fca82977 tools/debug-events: print pinch angle and rotation again
Fixes: 9907cf2eeb ("Move the event printing out into a utility")

Closes #1108

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1163>
2025-04-01 02:25:08 +00:00
Peter Hutterer
7d4e152aea tablet: delete the tablet's pressure range from the tool pressure ranges
Commit 48cd4c7287 ("tablet: track pressure ranges per tablet") added
up to 4 per-tablet pressure ranges that are stored in the tool on the
assumption that tools are never used across more than 4 tools.

However, if the tablet gets unplugged it will show up as new devices.
Fix this by removing the tool's reference to the previous tablet after
device removal.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1165>
2025-03-31 19:41:00 +10:00
Peter Hutterer
fc4e806e0b tablet: always initialize the pressure thresholds
When the tool is moved in proximity of a new tablet but the pressure
range hasn't changed since the last proximity, the new tablet was left
with a threshold range of 0:0.

For some reason this requires tightening up the check for the test too,
with our default episolon 0.091 fails the test of being > 0.9

Closes #1109

Fixes: 48cd4c7287 ("tablet: track pressure ranges per tablet")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1165>
2025-03-31 18:09:19 +10:00
Peter Hutterer
be679889e5 util: fix a memleak printing a tablet tip event
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1165>
2025-03-31 18:09:19 +10:00
Peter Hutterer
e77eb469e8 test: add no-tool testing to one of the tablet tests
Modifies an existing proximity test to also test for the case where a
tablet never sends BTN_TOOL_PEN so we have that case covered.

This is implicitly tested by the LITEST_UCLOGIC_TABLET test device but
making it explicit is a bit easier to debug.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1164>
2025-03-28 05:08:11 +00:00
Peter Hutterer
39fa451e7e pad: fix handling of direct mode switch buttons
A tablet with multiple mode toggle buttons had each mode toggle button
merely cycle to the next mode in the sequence, removing the whole point
of having multiple toggle buttons.

Fix this by defaulting each mode toggle button to "next". Once we
have initialized all buttons we can check if we have multiple buttons -
if so we number them sequentially so that the first button maps to mode
0, the second maps to mode 1, etc.

Closes #1082

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1132>
2025-03-27 04:57:33 +00:00
Peter Hutterer
9f98e6d573 tools/debug-events: print all available options
They're still without explanation but better than just printing
"[options]" without even pointing to the man page.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1162>
2025-03-26 11:26:25 +10:00
Peter Hutterer
79dc0261e2 tablet: fix an indentation issue
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1161>
2025-03-25 15:05:45 +10:00
Peter Hutterer
4d1b836e22 test: fix the tablet tool_ref test
This was working on an assumption that there is only one ref of the
tablet tool and if we call unref it will be removed. This assumption is
not something we can guarantee in the public API so we shouldn't test
for it.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1161>
2025-03-25 15:05:45 +10:00
Peter Hutterer
3f232131a1 util: provide better alignment for the function name/line no in trace
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1161>
2025-03-25 15:05:45 +10:00
Peter Hutterer
056bdb733a test: add a helper call to mark the end of boilerplate in a test
Some tests have pages of debug output to get the setup for the test
correctly, add a standard marker to differentiate this from the code
that matters.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1161>
2025-03-25 15:05:45 +10:00
Peter Hutterer
d344ae9ef6 libinput 1.28.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-03-24 13:54:25 +10:00
Peter Hutterer
0cfa2ee3f9 test: pass the func/lineno down to a few more functions
Most of them currently unused

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1159>
2025-03-14 10:18:24 +10:00
Peter Hutterer
bcb467da4c test: add extra highlighting for the backtrace
Pass through the function name where the condition failed so we can
highlight that line in the backtrace.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1159>
2025-03-14 09:52:30 +10:00
Peter Hutterer
8cd5cad1c1 meson: add option for internal event debugging
These have been behind #if 0 for ages but there are more to come, let's
make it possible to toggle those on/off with a meson option.

This is an option that must not be used in a release build, it will leak
key codes to the logs.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
9714253190 test: re-use the event printing in litest
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
6c3c2e99c0 libinput: use the shared event printing for debugging events
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
9907cf2eeb Move the event printing out into a utility
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
28e896916a tools/debug-events: separate event handling from event printing
Move the big switch statement into a helper function and reduce it to a
statement that only does that bits that weren't related to printing.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
1dd8a8965c tools/debug-events: make the print_ functions return the printed string
Two advantages here: fewer actual printf() calls making the output
slightly more coherent if there are other things writing to stdout but
also better re-usability since we can now move the print functions to
shared code.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
99ceda011c util: add strdup_printf helper functions
More straightforward than using xasprintf

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
3858a6c4f8 test: print events discarded while waiting for another event type
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1156>
2025-03-13 06:13:38 +00:00
Peter Hutterer
bfbecc5ef3 test: vary the colors in the test output a bit
Instead of everything bright red, let's vary the colors so it's easier
to spot the different assertions we add.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
aaad75ec19 test: mark _litest_checkpoint as printf function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
2ec9389a0d test: stringify the LITEST_ value as the device's name
This avoids inconsistencies between the LITEST_ enum value and the
shortname but also makes it easier to grep for any test cases that use
the same define. At the cost of the test names not looking very nice
anymore but oh well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
b0cfcfab34 test: standardize the wacom device names
Consistently use the pen/pad/finger suffix for the subdevices, both in
the device's name and the device type.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
7ae22591f3 test: add a note that the Huion PIDs are shared
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
99097c983d test: don't include an internal header in the totem tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1157>
2025-03-13 05:57:37 +00:00
Peter Hutterer
11aa71e78e tools/list-devices: print vid/pid as well
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1153>
2025-03-13 05:29:34 +00:00
Peter Hutterer
4ac52b4f1b tools: support sendevents mode in debug-events
Disabling sendevents was already supported via an fnmatch() and
--disable-sendevents but to test things like disabling on an external
mouse, let's expose this option too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1152>
2025-03-13 05:17:07 +00:00
Peter Hutterer
67428b64e0 doc: fix two duplicated references
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1155>
2025-03-12 11:43:25 +10:00
Peter Hutterer
dd78765674 pre-commit: add a hook for checking for duplicate empty lines
It's a bit annoying to only find those during a CI pipeline run, so
let's add a hook for it. Pre-commit doesn't seem to have something
useful for duplicate line detection so let's hack up a quick script
that can do this for us, together with the other whitespace checks in
the CI so we're consistent.

Excluded from the duplicate line checks are anything "Not C" and the
"include/" directory since we don't control those files.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1154>
2025-03-11 11:41:34 +00:00
Peter Hutterer
58315eb9d4 test: remove duplicate empty lines from the test/ directory
We've had a CI job for checking this since but it omitted the test
directory.

Fixes: bb6ff0ec00 ("gitlab CI: add a job to check for whitespace issues")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1154>
2025-03-11 11:41:34 +00:00
Zhou Qiankang
84e814561c quirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ IAH
* The ThinkBook 14 G7+ IAH also has the same issue as the ThinkBook 14 G7+ ASP.

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1151>
2025-03-09 15:46:34 +08:00
Thomas Newman
7030dc7c8d quirks: set pressure pad for ThinkPad X9 15 Gen 1 Forcepad
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1150>
2025-02-28 23:00:22 -05:00
Mingcong Bai
06d730e372 quirks: raise AttrTrackpointMultiplier for ThinkPad T470/T480/A485 to 0.75
As I tested my friend's ThinkPad A485, I found that the default multiplier
resulted in jumpy cursor and a slightly too quick acceleration curve. Upon
checking for Lenovo quirks, I found that since commits 383a60abea
("Better Thinkpad T480 trackpoint multiplier") and a1566e3492 ("quirks:
Thinkpad T470 trackpoint multiplier"), the TrackPoint multiplier for both
T470 and T480 (which shares the same keyboard FRUs with the A485) were set
to 0.4.

However, per my testing, by setting the multiplier to 0.4, the TrackPoint
speed became so painfully slow that it began to hurt my index finger...
I suspect the original commiters have set custom acceleration curves on
their own system, but I might be wrong.

Playing with the multiplier, I found 0.75 to be the most appropriate and,
interestingly, with anything >= 0.8, the TrackPoint began to become jumpy,
with the cursor appearing to have a very low poll rate on the screen (the
higher the multiplier, the worse it gets).

Since, as I mentioned above, the keyboard and TrackPoint parts are shared
between these three models, I'm assuming that this multiplier will work
well for them.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1149>
2025-02-27 22:47:14 +08:00
Peter Hutterer
48cd4c7287 tablet: track pressure ranges per tablet
Tablets may have different ABS_PRESSURE ranges with the oldest tablets
having 1k pressure range, then 2k, and the newer ones 8k.

If the same tool is used across two tablets with different ABS_PRESSURE
ranges, the first tablet in proximity calculated the range on where to
normalize to. As a result the other tablet either couldn't reach the
full pressure (2k pressure first, then 8k) or the full pressure range
was reached at a fraction of the full range (8k pressure first, then
2k).

Fix this by moving the threshold handling into a separate struct and
hardcoding up to 4 of those per tool. That is 2 more than the more
complicated setups I've heard of (and this only applies to tracking the
same stylus across those tablets anyway).

This duplicates the pressure offset heuristics but that's easier than
figuring out how to handle heuristics across potentially two tablets.

The range configuration is left as-is on the assumption that this one is
per tool, not per tablet.

Closes #1089

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1143>
2025-02-25 05:18:58 +00:00
Peter Hutterer
1de6ac8916 test: rename the 12WX test device short name and enum
Make this more specific, we have quite a few other cintiqs in here

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1143>
2025-02-25 05:18:53 +00:00
Peter Hutterer
f70f803365 quirks: add quirk for the RazerBlade182024 Keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1148>
2025-02-24 08:56:02 +00:00
satrmb
a71f560f3e test: fix off-by-ones in two ranges, prevent the same in remaining ranged tests
touchpad_move_after_touch contains support for up to 5 fingers but was only run
with 2..4 fingers.
touchpad_multitap and several others using the same parameter definition were
long ago tested with 3..7 taps. In 8f92b091 this was reduced to 3..4 for CI
performance, while the commit message indicates 3..5 were intended.

The common theme is that the upper bound of `struct range` is interpreted
as exclusive, while some uses assumed it would be inclusive.
There are relatively recent helper functions range_init_inclusive and
range_init_exclusive (since 817dc423) to avoid this trap. Use them on the
remaining two ranged tests.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1142>
2025-02-20 09:34:20 +01:00
satrmb
6f9a54c573 test: convert most ranged tests to parametrized ones
The two remaining ranged tests (abs_device_no_range, abs_mt_device_no_range)
are better served staying with ranges because parametrized tests need to
explicitly list all members of the range, which for these tests is not only
pretty big, but also contains abs axes reserved for future use. Those axes
have no names yet, making a future-proof conversion pretty much impossible.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1142>
2025-02-20 09:34:14 +01:00
satrmb
3a60c47e33 test: add optional value names to parametrized tests
Only implemented for i32 values so far, used for enums and enum-like constants,
replaces a runtime lookup from stringly-typed parameters.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1141>
2025-02-20 08:18:48 +01:00
Peter Hutterer
bf3a67de6c gestures: if 3fg drag fingers are in a nice position, start dragging
Similar to the condition just north of here, if we have 3 fingers in a
roughly linear line and 3fg dragging is enabled, assume we're actually
trying to drag. This reduces the minimum movement otherwise required
to detect the type of gesture.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
1d9e307e2b touchpad: implement support for three-finger drag
Exposed via new configuration option this enables 3 and 4 finger
dragging on touchpads. When enabled a 3/4 finger swipe
gesture is actually a button down + motion + button up sequence.

If tapping is disabled the drag starts immediately, if tapping is
enabled the drag starts after the tap timeout/motion so we can distinguish
between a tap and a drag.

When fingers are released:
- if two fingers remain -> keep dragging
- if one finger remains -> release drag, switch to pointer motion

When 3/4 fingers are set down immediately after releasing all fingers
the drag continues, similar to the tap drag lock feature. This drag lock
is not currently configurable.

This matches the macos behavior for the same feature.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
ae86d8b1b6 gestures: disambiguate between a tap timeout and a hold timeout
Where the tapping code calls into the timeout function make sure we have
a separate event for this. This way we know whether the current gesture
event is caused by the hold timeout or something else.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
659b49b3a3 gestures: localize a set of variables better
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
16a8c1d06c gestures: rename a helper function
has_started() is a bit misleading here, this merely decides whether we
should delay any finger changes or not.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
c73fc78407 touchpad: cancel any ongoing gesture if we're about to send a button
This shouldn't have any effect in the current setup as there is
"coincidentally" no overlap between the two state machines so this is
effectively a noop.

Nonetheless, if we're about to send a tap button event we cannot be in
any other gesture than tapping so all swipe/pinch/holds need to be
cancelled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
114af53824 test: fix the touchpad finger positions for a test
The 5th finger was placed in the same position as the 4th finger which
doesn't have an effect in libinput but it looks wrong.

And the first finger was put down at 40/30 but then moved from 70/30 to
the new position, causing pointer jumps on some touchpads.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1145>
2025-02-18 05:40:44 +00:00
Peter Hutterer
5ae31d7f46 test: fix litest_test_param_get_double
Overenthusiastic search/replace caused the name argument to be a const
double*.

Fixes: 5ed75e7e9f ("test: make litest_parameters fetching more type-safe")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1144>
2025-02-18 14:58:28 +10:00
Peter Hutterer
9d214e1c19 tools/list-devices: add missing config options to the output
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
d33c83b1b1 tools/list-devices: add helper to print aligned values
This makes it easier to re-align all columns.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
c8ee24ce17 tools/list-devices: reword the man page a bit
Hopefully a slightly better explanation that what we had before.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
dbe8f7fede tools/list-devices: allow listing some devices only
$ libinput list-devices /dev/input/envent0

Now does what one would expect.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
wangyafei
3cf6c91fff quirks: add quirks for Dell laptop with Goodix Touchpad.
This touchpad is a pressure pad and needs the pressure
handling disable.

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1130>
2025-02-13 02:18:02 +00:00
Peter Hutterer
5ed75e7e9f test: make litest_parameters fetching more type-safe
Require the type to be added in the litest_test_params_fetch() so we can
easily detect a mismatch. And add some type-safe getters that are much
easier to use for all the tests that only have a single parameter to
fetch anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1139>
2025-02-12 09:11:51 +00:00
Peter Hutterer
9ae15c6a45 pad: be more robust to kernel bugs of multiple EV_ABS
This is a workaround for a kernel bug with the Wacom Mobile Studio Pro
13: this device sends erroneous ABS_WHEEL events when pressing
buttons:

  - evdev:
    - [  0,      0,   1, 256,       1] # EV_KEY / BTN_0                     1
    - [  0,      0,   3,   8,      17] # EV_ABS / ABS_WHEEL                17 (+17)
    - [  0,      0,   3,   8,       0] # EV_ABS / ABS_WHEEL                 0 (-17)
    - [  0,      0,   3,  40,      15] # EV_ABS / ABS_MISC                 15 (+15)
    - [  0,      0,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +0ms

ABS_WHEEL to 17 then to 0 in the same frame. We should (and do) treat this
as a zero event and drop the 17 to the floor. Alas, we then generate a
ring event for the zero value despite our current value being zero
anyway. This again causes confusing behavior.

This is simple enough to work around, at least until the kernel is fixed
but also to prevent this happening in the future: warn if we get
multiple events and if so and the later event is zero, undo the axis
change state.

Closes: #1081
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1136>
2025-02-12 03:58:23 +00:00
Peter Hutterer
d9f121b4d1 test: add a litest_with_parameters helper macro
Magic for loop that takes care of the creation and unref for us,
hopefully improving readability a bit.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1138>
2025-02-12 11:41:56 +10:00
José Expósito
b566d64c17 quirks: Add Apple Magic Trackpad v2 USB-C (2024)
Add the missing USB-C vendor ID.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1080
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1134>
2025-02-04 14:36:01 +01:00
Peter Hutterer
184bcafe08 triage-policies: update to handle a few more things in MRs as well
Requesting libinput record, hid-recorder or punting to udev-hid-bpf
should be possible from MRs as well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1133>
2025-02-03 09:16:02 +10:00
José Expósito
3f4abaf77e quirks: Add Apple Magic Trackpad v2 2024
Add similar quirks to the previous generations.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1080
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1131>
2025-01-29 09:32:30 +01:00
José Expósito
e74d174744 quirks: Disable MT_TOOL_PALM for the Yoga Slim 7i Carbon
Lenovo Yoga Slim 7i Carbon sends bogus ABS_MT_TOOL_TYPE MT_TOOL_PALM
events. Disable them.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1077
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1128>
2025-01-21 10:16:47 +00:00
Marge Yang
af0e9a23c3 quirks: add quirk for Dell Haptics Touchpad.
This Touchpad is a pressure pad and needs the pressure
handling disable.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1127>
2025-01-21 07:26:41 +00:00
Peter Hutterer
fefeab4efe test: a boolean parameter is always true/false
Don't require the caller to provide the values, they're always the
same.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1123>
2025-01-20 12:08:46 +00:00
Peter Hutterer
86b9142a02 test: highlight the interesting part of the backtrace
This makes it easier to immediately see where things are breaking since
the full backtrace has >70% noise.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1124>
2025-01-20 11:30:01 +00:00
Peter Hutterer
6759a2f754 test: honor NO_COLOR and FORCE_COLOR for output colorization
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1124>
2025-01-20 11:30:01 +00:00
Peter Hutterer
74617de48d tools/record: record HID_BPF properties too
If this property is set we likely have a udev-hid-bpf property
loaded into the device. Knowing this is going to be important for
debugging why a device may or may not work so let's record this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Peter Hutterer
2c0c4a6516 Replace strneq() with hardcoded lengths with strstartswith()
Slightly less efficient but easier to read and it's not possible to
accidentally provide the wrong length. Plus it handles null pointers
correctly so get to skip the checks (which weren't needed for strneq()
either, but still).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Kirill Primak
00bc910df7 tablet: add missing event types in tool/pad event docs
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1126>
2025-01-20 10:08:36 +00:00
Peter Hutterer
1d8f2903ed tablet: always unset the various statuses if we're leaving proximity
The previous invocation was gated behind a TABLET_OUT_OF_AREA check
resulting in a nonresponsive tool when the tablet was moved out of
proximity outside the tablet area and the area was changed.

Move the actual status bit changes up into tablet_flush()
so we unconditionally set those.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
2f2612e8d7 test: use litest_checkpoint to annotate a test case
Had to debug something here and we might as well keep the printable
annotations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
55d47903b4 test: switch the tablet tests to parametrized tests
No functional change but the tests now include the parameters in
easy-to-read fashion which makes it easier to figure out which
combination is failing.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
c3bf478d41 util: add truefalse and yesno macros for easy string conversion
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
d52bb9ed4d tools/per-slot-delta: optionally show the distance to the original point
This makes it easier to quickly gather how far a touch has moved since
it started, compared to the initial starting position. This again makes
it easier to determine if a threshold required for e.g. scrolling has
been met.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5f8f715017 tools/per-slot-delta: refactor the printing of a slot
This makes it easier to optionally print extra components of that slot.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5df1d26aa2 tools/per-slot-delta: use a Point class for slot position/delta
Better abstraction, especially when we introduce more than just those
two.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
a7ff3e0508 tools/per-slot-delta: remove some duplication for axis handling
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
01f133fbc4 tools/per-slot-delta: use dataclasses and enums
Slight modernization of the code

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
530ca423a7 Improve the event queuing debugging a bit
Print a bit more information if this ifdef is disabled for
debugging, in this case for button events. That's all
I need for now, we can extend later.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1122>
2025-01-09 11:36:32 +10:00
Peter Hutterer
5388299117 test: slightly improve the failure message for litest_assert_not_null
Now prints
        FAILED: ev != NULL
which is less ambiguous/confusing than the previous
        FAILED: ev expected to be not NULL

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1122>
2025-01-09 11:36:26 +10:00
Peter Hutterer
d9de017d6c test: fix --filter-params handling
The previous implementation skipped parameters that were filtered, so
our test cases got called with parameters missing. Fix this by filtering
any test case that has a negative fnmatch on any parameter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1120>
2025-01-08 10:18:31 +00:00
Peter Hutterer
11dec0bd9b test: switch touchpad button tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 11:59:14 +10:00
Peter Hutterer
6ee8e8d9b6 test: change tap tests to use parameters
This also fixes the invocation of the
touchpad_3fg_tap_btntool_pointerjump which was written as ranged test
but never got invoked with a range (but _i defaults to zero).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 10:50:52 +10:00
Peter Hutterer
4bbad8adf0 test: change switch tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 10:48:32 +10:00
Peter Hutterer
812611ca2e test: switch touchpad tests to use parameters
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1119>
2025-01-08 09:21:01 +10:00
Peter Hutterer
44fecb9a98 doc/user: link to the explanation why we can't change the tap default
We don't have an API for "device really should have tapping enabled" so
right now the only indicator of whether that's the case is when the
device has tapping enabled by default. This kind of prevents us from
switching the default, so let's at least link to the comment explaining
this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1115>
2025-01-07 09:10:50 +00:00
Peter Hutterer
800eeaea7e test: change the x/y type from int to double in a helper
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
f168f7d83a test: fix a typo in a comment
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
45389468a7 evdev: print the EV_SYN with better alignment to other messages
This affects the debugging output only and it's invocation is if 0 by
default.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1117>
2025-01-07 13:04:30 +10:00
Peter Hutterer
1e445f3f84 test: implement support for parametrizing tests
litest supports ranged tests but they are not enough, doubly so with
tests where we want to parametrize across multiple options.

This patch adds support for just that, in clunky C style.
The typical invocation for a test is by giving the test parameter
a name, a number of values and then the values themselves:

	struct litest_parameters *params = litest_parameters_new("axis", 's', 2, "ABS_X", "ABS_Y",
	                                                         "enabled", 'b', '2', true, false,
	                                                         "number", 'u', '2', 10, 11,
	                                                         NULL);
	litest_add_parametrized(sometest, LITEST_ANY, LITEST_ANY, params);
	litest_parameters_unref(params);

Currently supported are u (uint32), i (int32), d (double), b (bool),
c (char) and s (string).

In the test itself, the `test_env->params` variable is available and
retrieval of the parameters works like this:

	const char *axis;
	uint32_t number;
	bool enabled;
	litest_test_param_fetch(test_env->params,
	                        "axis", &axis,
	                        "enabled", &enabled,
	                        "number", &number,
	                        NULL);

Note that since this is an effectively internal test-suite only
functionality we don't do type-checking here, it's assumed that if you
write the code to pass parameters into a test you remember the type
of said params when you write the test code.

Because we don't have hashmaps or anything useful other than lists the
implementation is a bit clunky: we copy the parameter into the test
during litest_add_*, permutate it for our test list which gives us yet
another linked list C struct, and finally copy the actual value into
the test and test environment as it's executed. Not pretty, but it
works.

A few tests are switched as simple demonstration. The name of the
test has the parameters with their names and values appended now, e.g.:
   "pointer:pointer_scroll_wheel_hires_send_only_lores:ms-surface-cover:axis:ABS_X"
   "pointer:pointer_motion_relative_min_decel:mouse-roccat:direction:NW"

Filtering by parameters can be done via globs of their string
representation:
   libinput-test-suite --filter-params="axis:ABS_*,enabled:true,number:10*"

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
f9f9bccba2 test: force an unnecessary abort after litest_abort_msg()
This is the easy way to get static analyzers to understand that calling
litest_abort_msg() always fails.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
7efec8f2e7 test: move a switch case up for better grouping
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
da296c9976 util: Add a multivalue special type
A stripped down version of e.g GVariant that's enough for the few
parameter types we need to support.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1109>
2025-01-07 02:02:37 +00:00
Peter Hutterer
5e5799a319 test: log litest_checkpoint to stderr
Otherwise the logs are detached from libinput's logs (which are printed
to stderr) which makes the checkpoint function mostly useless since it
doesn't actually group the messages as expected.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1116>
2025-01-07 11:40:00 +10:00
Peter Hutterer
9ac040f72a util: add etrace to trace to stderr
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1116>
2025-01-07 11:40:00 +10:00
Peter Hutterer
3aa004b964 libinput 1.27.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2025-01-06 15:04:14 +10:00
Peter Hutterer
e68d80b13b CI: bump to Fedora 41
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1111>
2024-12-23 07:17:31 +00:00
Peter Hutterer
b1f804c5f1 Fix two scan-build warnings that appear on F41
../../../src/util-files.h:61:3: warning: The 1st argument to 'close' is <= -2 but should be >= -1 [unix.StdCLibraryFunctions]
   61 |                 close(*fd);

 ../../../test/test-quirks.c:66:8: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker]
   66 |                 rc = fputs(file_content, fp);

The latter is bogus because we have a litest_assert for this but
somehow this is ignored, so... shrug.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1111>
2024-12-23 07:17:31 +00:00
Peter Hutterer
117d91b93f tools/libinput-replay: use list comprehension instead of append
And remove the unnecessary del processes, we're in a block so processes
ceases to exist there anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
Peter Hutterer
193aacf61a tools/libinput-replay: interrupt only the ongoing event sequence with ctrl+c
If libinput replay is currently replaying events, stop that sequence and
go back to the start if the user presses Ctrl+C. Only on the second
Ctrl+C do we fully exit.

This helps debugging long recordings where we don't want to keep
producing events after some initial event sequence.

Closes #1064

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
WeirdTreeThing
a03058db72 quirks: Add quirk for Google Chromebook Banshee
Signed-off-by: Brady Norander <bradyn127@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1108>
2024-12-20 16:41:16 -05:00
Peter Hutterer
0288781383 gestures: change the debug log messages for state debugging
Prefix the result of handle_event with "event" and the handle_state with
"state"

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1106>
2024-12-20 09:47:46 +00:00
Peter Hutterer
3563b6780f gestures: use a macro for debugging transition states
This avoids bugs where we forget to update a state but also provides
some bounds checking now to ensure our array is large enough to store
those transitions.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1106>
2024-12-20 09:47:46 +00:00
Peter Hutterer
2e9d8df74e tools/debug-gui: color the fingers with different colors
Follow-up to commit 713892c162 ("Number the fingers by slot in debug-gui")
this changes the colors slightly for each finger, making it easier to
track visually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1103>
2024-12-20 01:15:11 +00:00
Peter Hutterer
4131e4d2c0 quirks: the Wacom Bamboo 2FG 6x8 is a semi-mt touchpad
See #919

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1104>
2024-12-20 00:43:50 +00:00
Peter Hutterer
3b2ff75a0d triage-policies: fix the hwdb.d directory
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1100>
2024-12-19 07:27:23 +00:00
Peter Hutterer
632b6dad63 triage-policies: add an entry to punt to udev-hid-bpf
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1105>
2024-12-19 07:17:06 +00:00
Joshua Noeske
ce7b7c94e7 gestures: fix transformation of scroll to pinch
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1099>
2024-12-18 15:50:50 +01:00
Peter Hutterer
d63689003f tools: only warn once about our lack of support for multiple fingers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1096>
2024-12-18 08:49:34 +00:00
Peter Hutterer
eef0650759 touchpad: init the thumb size threshold to INT_MAX
For consistency with the pressure threshold, both are guarded behind
a use_size/use_pressure boolean anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1095>
2024-12-18 08:24:41 +00:00
Peter Hutterer
52679e1296 tools/libinput-replay: print a separator line for EV_SYN events
If running with --verbose having that line makes it a lot easier to
look at the event sequence.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1094>
2024-12-18 08:07:18 +00:00
Peter Hutterer
f44a181a8e triage-policies: default close after pointing the user to 60-evdev.hwdb
In line with our new process of closing bugs let's close after this
bugbot message too. If the hwdb doesn't fix it then the reporter can
always re-open.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1097>
2024-12-18 07:39:57 +00:00
Peter Hutterer
c6c0db1d8d triage-policies: add missing "actions" for the bugbot::evdev-hwdb
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1098>
2024-12-18 11:12:23 +10:00
Peter Hutterer
a5b94ed79c triage-policies: update the bugbot::close wording and link to the wiki
Now that we have a wiki page let's link to it, it has all the details
on how and why we (plan to) do this.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1093>
2024-12-16 07:20:55 +00:00
Salvo 'LtWorf' Tomaselli
2f9c173e72 Add examples with other thresholds to the documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1092>
2024-12-16 11:17:22 +10:00
Peter Hutterer
bdbaea6162 triage-policies: add missing actions line
Fixes: 85ec33f802 ("triage-policies: add a bugbot command for closing bugs")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1091>
2024-12-11 18:57:29 +10:00
Peter Hutterer
85ec33f802 triage-policies: add a bugbot command for closing bugs
We have labels like needinfo or triage needed but all these labels
require intervention from a privileged user - normal users cannot
set labels on a project.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1090>
2024-12-11 14:45:51 +10:00
Peter Hutterer
9988f4242e tools/measure-touchpad-pressure: require max > min for a range
Otherwise a resulting quirk will fail when parsed by libinput which
enforces this too.

Closes #1060

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1089>
2024-12-10 10:00:39 +00:00
Peter Hutterer
c3aa00ef90 gestures: don't handle SWIPE if we transitioned from SWIPE_START
If we get to SWIPE_START we send out the BEGIN event and transition to
state SWIPE. We must not process that state immediately to avoid sending
out a spurious UPDATE event when nothing has changed.

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

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

Closes #1053

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1088>
2024-12-10 06:15:21 +00:00
andeston
84225f28b6 pre-commit-hooks v5.0.0
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1086>
2024-12-04 02:02:12 -05:00
andeston
2fa31f68b3 ruff-pre-commit v0.8.1
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1086>
2024-12-04 02:02:12 -05:00
andeston
c65e0e2a06 Update b2c sha
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1086>
2024-12-04 02:02:12 -05:00
Peter Hutterer
3b85a4017d CI: update to latest ci-templates
This allows for gitlab private emails in commit messages.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1087>
2024-12-03 23:11:59 +00:00
Peter Hutterer
d773056d2e touchpad: remove assert that may trigger during a race condition
There appears to be a race condition where an ABS_MT_TRACKING_ID -1
event is on the wire but libevdev_fetch_slot_value() for that slot
already gives us -1 as well.

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

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

Closes #1050

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1081>
2024-12-01 22:44:50 +00:00
Mingcong Bai
5915ac45dd quirks: lower AttrTrackpointMultiplier for ThinkPad X200s/201s to 0.25
Follow commit 65b53f82ff ("quirks: lower AttrTrackpointMultiplier for
ThinkPad X200/201 to 0.25") and lower this multiplier for Lenovo ThinkPad
X200s/201s models, as I found the identical issue as the one previously
quirked for ThinkPad X200/201.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1084>
2024-12-01 22:58:01 +08:00
xzl
ab385a5d5f quirks: add pressure pad quirk for Lenovo ThinkBook 14 G6+ IMH
The ThinkBook 14 G6+ IMH also has the same issue as the ThinkBook 14 G7+ ASP.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1083>
2024-11-28 15:41:42 +08:00
Peter Hutterer
64d1f198fb libinput 1.27.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-11-19 13:41:39 +10:00
Mingcong Bai
65b53f82ff quirks: lower AttrTrackpointMultiplier for ThinkPad X200/201 to 0.25
Upstream commit 43cd2cbf83 ("data: add the dell trackpoint multipliers")
broke the default acceleration profile on Lenovo ThinkPad X200/201, where
the cursor speeds became so quick that it was practically impossible to
control. Merely dragging on the TrackPoint lightly would result in the
cursor flying from corner-to-corner.

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

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

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1080>
2024-11-14 22:02:54 +08:00
Mingcong Bai
97adececa0 quirks: add pressure pad quirk for Lenovo ThinkBook 14 G7+ ASP
Some Lenovo ThinkBook 14 G7+ ASP models ship with pressure pads (nominally
"Force Pad"). However, they do not appear to be declared as such by the
firmware.

Add a quirk to make them work.

Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1079>
2024-11-12 11:38:52 +08:00
Peter Hutterer
b2b0756e4e zsh: update completion to include latest debug-events options
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1077>
2024-11-06 06:38:44 +10:00
Peter Hutterer
6a88ffb5dd zsh: sort the debug-events argument (mostly) alphabetically
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1077>
2024-11-06 06:38:08 +10:00
Peter Hutterer
865b2e748f tablet: ignore movements started outside the configured area
If a tablet has an area configured and the pen goes into proximity
outside this area, ignore all events from this sequence. This truly
deactivates that area so it can even be used for e.g. placing a pen
there.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:10:48 +10:00
Peter Hutterer
0b28eeea5a tablet: implement support for area configuration for external tablets
For external tablets like the Intuos series we now expose the area
rectangle configuration and the (minimum) implementation required to
make this work.

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

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

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:10:48 +10:00
Peter Hutterer
cf5b7bee01 Add tablet area configuration
This adds the configuration option to define a rectangle that serves as
an input area on external tablets such as an Intuos.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:10:48 +10:00
Peter Hutterer
9735229dee tablet: use our absinfo_x/y struct instead of the libevdev one
device->abs.absinfo_x/y points to the x/y axis we want to use and
that axis is used in all the evdev helper function. For consistency
use that one here too.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:05:05 +10:00
Peter Hutterer
cfbdca5953 Move evdev_convert_to_mm to a more generic helper
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:05:05 +10:00
Peter Hutterer
df242c108d Move scale_axis to a utility header so we can re-use it better
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:05:05 +10:00
Peter Hutterer
49bbef6468 tools/debug-events: print bugs in bold red
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:05:05 +10:00
José Expósito
3f3071cb88 editorconfig: add settings for sym files
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1076>
2024-11-04 10:31:30 +00:00
Peter Hutterer
86915213c8 tools: sort the options in debug-events match page
We now have enough config options that having them unsorted makes it
hard to find the right option.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1075>
2024-11-04 15:48:49 +10:00
Peter Hutterer
d1e49c7b3d tablet: default to a built-in tablet
The vast majority of devices that libwacom doesn't know about are the
various built-in ones. Since the only effect in our code here is that we
enable the calibration matrix, let's default to built-in if we don't
know any better - better to have the matrix and not use it than to not
be able to calibrate a tablet.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>
2024-10-31 15:58:31 +10:00
Peter Hutterer
2ac4227843 test: fix two race conditions waiting for proximity events
This test does a prox in/out and immediately drains events.
Where we are slow enough we may drain only one (or none) of the
proximity events which causes a failure later in the test.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1074>
2024-10-31 15:58:31 +10:00
Peter Hutterer
2b2959fc8b tablet: centralize the libwacom handling
Instead of re-creating the the libwacom device from the database every
time we need it let's create it once during tablet|pad_init and pass it
down to the functions.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1073>
2024-10-31 13:38:28 +10:00
Peter Hutterer
d3bc0c79ff tablet: minor rework to remove one ifdef HAVE_LIBWACOM
Change to a boolean for more obvious return values and move the ifdef
into the function so we can skip the ifdef in the caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1073>
2024-10-31 13:38:28 +10:00
Peter Hutterer
384e946960 pad: support dial modeswitch buttons
This requires unreleased updates to libwacom [1], currently hiding
behind an ifdef so we don't require that particular version.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 11:04:45 +10:00
Peter Hutterer
90e9c9f832 pad: rework the tablet pad mode setup
This was historically based on the LEDs on the device: we'd loop through
the LEDs and assign them to pad mode groups, then figure out which
button is the mode toggle for that group and finally which buttons
are in the same position as that toggle button.

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

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

Closes #1045

[1] As per Windows default button behavior

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 11:04:45 +10:00
Peter Hutterer
7ae4fabb76 pad: don't clobber the errno if the pad led failed to initialize
pad_led_destroy() may call something that sets errno, so let's protect
against that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
181c667266 pad: remove an unused argument
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
c969b5f6e2 pad: rename an argument for more clarity
Yes, we're using the LED count here but what it is used for is the
number of modes.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
9ae514c7b4 test: mark the pad group tests as basically broken by expectation
Since our implementation uses the sysfs LED files and we don't have
those, all our test devices have the single fallback mode and no
more. Add a comment to all these tests to make that clear and enforce a
single mode only so it's more obvious.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
6c350ab269 test: fix 3 compiler warnings when building without libwacom
signed/unsigned and an unused variable.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
266ce4218b test: fix strip values being passed to ring functions
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
2024-10-31 10:28:08 +10:00
Peter Hutterer
74af5cfb9c CI: collect valgrind log files too
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
4a98e273a4 test: add --output-file to print test logs to a file
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
1f8a4df58c test: drop the --xml-prefix option
litest-runner outputs in YAML and no-one ever looks at the XML files
anyway. They are used to provide nice pipeline summaries but again,
no-one looks at those because they're not very useful.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
c6ba3e2eb8 CI: disable forking for valgrind tests
With the new test suite runner we get one fork per test which will
eventually slow down valgrind enough so our tests fail.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
a80678c241 test: add --filter-rangeval to only run tests with a range value
For ranged tests (e.g. gesture tests) it's convenient to be able to run
those with a value of N (e.g. 3 fingers) instead ov having to run all of
them all the time.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
3c2e92d169 test: add ability to collect test results from a nonforking test
Use longjmp to try to get out of a test error. This will only work for
errors triggered by our own test suite (i.e. not for SIGSEGV and
friends) but that's good enough for most things.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
c1f744a6e5 test: move the quirks setup into the global setup func
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
b21fd3cfe7 test: add runner support for a global setup/teardown func
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
1fd3cefc60 test: the created files list doesn't need to be a global
This list was used in the signal handler but that is no longer the case,
so let's localize this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
c68c0f593b test: move the rest of the custom initialization to litest_run
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
d4c6c47677 test: move tty disabling closer to the actual running of the tests
And move the litest-specific condition out into the caller so
disable_tty() only cares about the TTY, not any surrounding conditions.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
b81cc0ceb7 test: only force gdb to no-fork, valgrind can fork
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
16e5bdabac test: intercept and collect valgrind errors
This works because we always invoke with --exit-errorcode=3 from the
test suite. It won't work for manual invocations but oh well.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
27fa85a884 test: move litest_free_test_list to inside ifndef NO_MAIN
This is now only called from one spot, so let's move it so it is
ifdef'd out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
0cfde0f95f test: make the utils test a "pure" litest-runner test
Now that we have the runner let's use it directly for this set of simple
test.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
d84efcb4b6 test: add --exit-first to the litest test suite runner
Exits upon the first failed test.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
7b69fb2d63 test: remove now-unused check-double-macros.h
We no longer use those functions, so let's drop them.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
9928de7fa3 test: move the quirks context init into litest_run
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
41c08f0816 test: add litest-runner as test suite runner
This replaces check. The code is a copy of pwtest which I wrote years
ago for pipewire but adjusted for us here the last few days.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
d94407f810 test: fix utils test for types for litest assertions
check always typecasts to intmax_t so a lot of type mismatches were
hidden.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
5cbb37a3d2 test: convert utils test to litest_assert
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
6cac0d4d2f test: make the utils test another litest
This doesn't really gain us anything for now but it's prep work for
dropping check and the custom invocations of check.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
4fa5ea268e util: add a generic stringbuffer with a few helper functions
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
817dc42381 util: add the range handling as separate header file
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
d1575fbce5 test: move the deviceless check into ltest_add_tcase
This is out of place here, check this when we are about
to add the test, not later when the tests are about to be run.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
efd3dd4427 test: filter out duplicate name/device combos in --list
This doesn't have an effect yet because ranged tests are handled inside
check. But in the future these tests will be split up individually so
de-duplicating is useful here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
e3b5c0da5f test: make litest_backtrace() available from outside litest.c
Prep-work for adding a new runner

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
b67ab51f76 test: append, not insert the suites
list_append() came later than list_insert() and there's an argument to
be made that tests added later should be run first since they're less
likely to succeed. But it's a lot harder to read test logs when they are
in reverse order, and with the TEST_COLLECTION() macro the order of the
test suite is not obvious anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
f91f0a7ea5 util: add a bunch more time conversions
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
02f5faf6f6 util: move libinput_now() into a utility function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
d3922661ba util: add xclose(fd) to close-and-reset an fd
This prevents accidentally leaving the fd set after closing.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1067>
2024-10-30 23:20:42 +00:00
Peter Hutterer
a61c876412 pre-commit: drop black, use ruff-format instead
And switch to the current-ish version of the ruff pre-commit hook,
including updating the repo.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>
2024-10-29 13:48:31 +10:00
Peter Hutterer
15af1c0017 tools: change direct type check to isinstance
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>
2024-10-29 13:27:35 +10:00
Peter Hutterer
5e235a6546 util: make a float to int conversion explicit
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1071>
2024-10-29 10:18:54 +10:00
Peter Hutterer
e0f671126d util: add the backtrace printing function as separate util
Might as well make this easier to re-use since it doesn't do anything
specific to litest.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1066>
2024-10-23 10:08:12 +10:00
Peter Hutterer
4546480e13 pad: default a pad group to mode 0 if all LEDs are off
Since our API doesn't accomodate for "dunno" we need to pick a mode that
we are actually in. This happens on the Intuos Pro 2 (PTH-660) which has
all LEDs on brightness zero, resulting in a failure to set up the modes
and we're left without a mode button.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>
2024-10-22 18:14:15 +00:00
Peter Hutterer
04cff1c721 pad: move a function to save on an ifdef
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>
2024-10-22 18:14:15 +00:00
Peter Hutterer
0c782c4084 pad: don't print a clobbered errno
is_litest_device() may change errno since it calls into libudev.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1069>
2024-10-22 18:14:15 +00:00
Peter Hutterer
54f3733b76 tools: print full pad mode group info in libinput-list-devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>
2024-10-22 15:46:57 +10:00
Peter Hutterer
f5cc45e409 tools: add rel dial support to libinput-list-devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>
2024-10-22 11:54:45 +10:00
Peter Hutterer
b34010bf4e test: split the touchpad tests into a palm and a dwt test collection
dwt and palm tests have a lot of timeouts to wait for so let's split
those out.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
9e00d09b30 test: split the tablet left-handed tests out into a separate collection
These aren't complicated but there's a lot of them so let's run them
separately to make the overall tablet test shorter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
532932d8aa CI: move the "device" test suite to the "misc" set of suites
That one is still with the gestures but only takes 1-2 minutes, the
gestures takes 13 minutes. Let's move it to misc which currently has an
overall runtime of only 2 min anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
a67dbefc0f test: split out the touchpad tap tests into multiple collections
These take a long time and have a reasonable high chance of failure due
to the timing constraints. Let's split them up so they don't hog the
runners for that long and in case they fail, we only need to re-run a
short test.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
8cbf535ee5 meson: break out the test suites into manual list
If we start having multiple TEST_COLLECTION() in the same file we can
no longer use the file name - so a manually maintained list it is.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
3390f2e647 test: make the TEST_COLLECTION() macro re-usable in the same file
Concat the line number to the generated variable names, this way we can
have more than one TEST_COLLECTION() in the same file.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
0135b0b41c test: detach the suite handling from the file names
Instead of extracting the suite name from the test's file name use the
current suite that is being parsed. This way we pave the way for
multiple suites in the same file.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
dba296d290 test: match the tablet's pad test collection with the file name
This is currently a requirement, so let's match this before we run
into issues here re-structuring stuff.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1065>
2024-10-18 10:49:47 +10:00
Peter Hutterer
5f744c8928 tablet: fix a memory leak caused by an early return
Previously we'd return early, failing to libwacom_destroy() the device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1064>
2024-10-18 09:48:05 +10:00
Peter Hutterer
1c80605d56 CI: set the LITEST_JOBS in the template, not the script
Fixes: 70c57e9644 ("CI: drop the job count for the valgrind test suite to 2")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1063>
2024-10-17 15:14:02 +10:00
Peter Hutterer
fb4c5dd7c6 test: use a litest helper instead of return code comparison
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
d010c6a170 test: rename a variable to indicate suites, not tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
cd957b4e79 test: rename all_tests to all_test_suites
This is a a list of struct suite with the various tests inside that
suite.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
cb0575b473 test: check for verbosity immediately in main()
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:04 +10:00
Peter Hutterer
75ce537342 test: check for empty tests immediately, not later when we're running
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
6d26d83f00 test: init the global devices/test lists immediately
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
50f6e4f195 test: add restore_tty helper and use it
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
1a1a8f5378 test: init the device list via argument
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
f7cc8e05f7 test: add a helper for deleting a created file
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
57a3313d33 test: switch a bunch of tests from abort() to one with a message
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
ecb2664e05 test: fix litest_abort_msg() not starting a new line
Most callers of litest_abort_msg() don't add '\n' so the output was
mangled.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
d010c879ef doc: correct that the test suite is indeed run in the CI
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
Peter Hutterer
bd62da11e4 test: switch the tests to use enum comparisons
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
151c2feae6 test: add macros to compare enum values
This requires switching a lot of int_eq/int_ne over to enum_eq/enum_ne
because the compiler doesn't infer the right type from a harcoded enum
value - it just defaults to int.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
5f4f72dca4 test: switch a bunch of integer comparisons to right sizes
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
f89fd6d924 test: switch ck_assert over to litest_assert
This is the first step in switching away from the check framework.
Our litest macros already do almost exactly the same anyway so most of
this is a simple sed with a few compiler fixes where things mismatch
(nonnull -> notnull) and (_tol -> _epsilon).

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
0bc2bf60d2 test: add litest string comparison macros
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
9a5f888795 test: replace manual "almost equal" with the new double epsilon
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
237b15b401 test: fix some checks using ints to compare doubles
Theoretically we should be using ck_assert_double_eq here for
consistency but this patch  is part of a series eventually
replacing those calls, so let's jump to litest_assert_double
directly to avoid further rebase conflicts.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
825e521d9b test: fix a touch test comparing ints to doubles
We were checking doubles for integers but better to check that we're
close to the maximum range without actually being over.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
6e7dd8c111 test: add a macro to compare two doubles with a specific epsilon
Same as ck_assert_double_tol

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
84f96de974 test: initialize a variable to make scan-build happy
Assuming safe_atoi works as expected, `fuzz` cannot be
uninitialized by the time we get here. But let's init it anyway to make
scan-build happy.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
3ed70e864f test: add litest_assert_event_type_not_one_of
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
67061c1af0 test: replace ck_abort with litest_abort_msg()
Weirdly, that also required initializing two variables to NULL to stop a
compiler warning.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
99961d4bd1 test: fix missing END_TEST for strv_for_each_test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
88feb3f25c test: fix double parsing test
We should check that we actually have a double here...

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
8696e80136 test: fix a data type in the utils test
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
7316a627d6 test: add a missing va_end
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>
2024-10-15 12:44:27 +10:00
Peter Hutterer
aecfcf3d1b test: fix uinput creation for the slotted devices with too many slots
Kernel commit 206f533a0a7c
       "Input: uinput - reject requests with unreasonable number of slots"
limits the number of slots to 99 - let's manually adjust that so we can
keep creating uinput devices.

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1061>
2024-10-15 09:56:19 +10:00
Peter Hutterer
c123a76b0d test: make litest-test-suite --list YAML-compatible
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Peter Hutterer
5b5776b148 test: move the test devices into the test_device_section
Better naming this way

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Peter Hutterer
3577369805 test: switch unused argc/argv to the list of tests
This means we don't rely on the "all_tests" global here though it also
means we need to move the cleanup into the caller.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1060>
2024-10-14 08:56:07 +00:00
Muhammad Talal Anwar
b89b0ccafb quirks: add Logitech ERGO M575(S)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1058>
2024-10-07 21:06:05 +00:00
Peter Hutterer
2b77bdab5c gestures: change a boolean to an enum for more expressive code
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
0fd074c974 gestures: add debugging for state transitions
Our state machine allows falling through multiple transitions, so let's
make it possible to debug this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
68a2ff0d49 gestures: get rid of tp_gestures_start
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
89596e61f8 gestures: rename gesture_notify_hold to gesture_notify_hold_begin()
HOLD gestures only have begin/end so let's rename this so it's
immediately obvious which one we're sending.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
8899800de8 gestures: rename most events to FOO_START
These events aren't used to signal scroll/swipe/pinch/..., merely to
signal the start of that gesture. So let's rename it to make the code
clearer (e.g. why do we log a bug when for a FOO event when we're in
state FOO?).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
e88007d4ae gestures: push tp_gesture_start() for hold gestures into the state handling
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
fd0875029b gestures: push tp_gesture_end() into the actual state machine
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
c1690d408a gestures: log a bug if we're trying to reset an actual gesture
Now that end/cancel are separate states, we shouldn't get here.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
942fd0dc8f gestures: distinguish between a gesture reset and a gesture end/cancel
All current states treat them the same way but let's distinguish those
two so we can have different code depending on whether a gesture was
cancelled/reset or ended properly.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
96500d81fb gestures: replace switch-timeout based gesture_cancel calls with a state
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
6b5aeab51e gestures: rename tp_gesture_handle_state and tp_gesture_post_gesture
Confusingly, tp_gesture_handle_state() would do almost nothing with our
state machine and the various tp_gesture_handle_state_foo() were called
later from tp_gesture_post_gesture().

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
c9c128f2b1 gestures: make a error message more informative
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Peter Hutterer
1d4e2e2e2d gestures: log the finger count together with the gesture state
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1049>
2024-10-04 15:13:23 +10:00
Wentao Guan
4785a1cc09 quirks: add a quirk for the HONOR MagicBook Art 14 touchpad
The touchpad need ModelPressurePad=1 to enable moving cursor,
and need AttrEventCode=-BTN_RIGHT to use right key by touchpad
two-fingers press..

Closes: #1040
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1040
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1053>
2024-10-02 09:52:55 +00:00
WeirdTreeThing
9b4fefc972 quirks: Add quirk for Google Chromebook Cret
Signed-off-by: Brady Norander <bradyn127@protonmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1056>
2024-10-02 06:00:05 +00:00
Ajrat Makhmutov
c012e8a12a quirks: touchpad quirk for ICL Si1516/Si1512
Exactly the same quirk as for Graviton N15i-k2 and Graviton N15i.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1054>
2024-10-02 05:43:06 +00:00
Ajrat Makhmutov
601c1043b3 quirks: touchpad quirk for Graviton N15i
Exactly the same quirk as for Graviton N15i-K2.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1054>
2024-10-02 05:43:06 +00:00
Peter Hutterer
b43061694c CI: skip the valgrind tests for marge-bot
marge-bot rebases and edits the commit message but there's not way for
it to introduce a memleak that wasn't spotted in the user pipeline
first. Since those tests are very flaky, let's skip them when running
the marge-bot pipeline.

Closes #1042

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1057>
2024-09-30 17:30:53 +00:00
Peter Hutterer
54dccd66d1 Fix a few potential NULL dereferences
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>
2024-09-30 15:35:36 +00:00
Peter Hutterer
1790171c76 util: add a safe version of strlen
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>
2024-09-30 15:35:36 +00:00
Daniel Fuchs
da6059b2fe quirks: adjust pressure range for Google Krane, Wormdingler and Coachz
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1055>
2024-09-24 16:09:26 +00:00
Peter Hutterer
a4ff6d5d0b tools: add --set-calibration to the debug-events man page
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1051>
2024-09-20 21:06:15 +10:00
Peter Hutterer
e89bf25c10 test: fix macro grouping in the litest.h header
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19 23:43:53 +10:00
Peter Hutterer
25bdda0b8a test: use litest_assert_event_type instead of direct type check
This provides better debugging logs and is slightly less code in
the checks too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19 23:43:53 +10:00
Peter Hutterer
011c1474d3 test: use litest_wait_for_event instead of a NONE event check
Technically we're not really waiting here since we expect the
event to already be there but for these tests the distinction doesn't
matter.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19 23:41:24 +10:00
Peter Hutterer
24d9b46b43 test: fix use of wrong enum for setting clickfinger maps
Hidden by ck_asset_int_eq type-casing everything to intmax_t

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19 23:41:24 +10:00
Peter Hutterer
f8e44f1947 test: use litest_assert_empty_queue instead of a manual none check
This provides better debugging printfs and is the now-recommended way to
check this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1050>
2024-09-19 23:41:23 +10:00
Peter Hutterer
86c47be816 test: add litest_dispatch() for better test debugging
Wraps libinput_dispatch() with a location which will make things a bit
easier to track. Output (in --verbose) is something like:

  gestures_swipe_3fg_unaccel_fn():1346 - dispatching

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-19 15:21:04 +10:00
Peter Hutterer
27e3897420 test: abort on libinput bugs again
This was always intended but a bug prevented the actual abort.
strstr returns NULL when we cannot find the substring so we always
triggered the first noop condition on bugs.

Fixes: bd7b91065b ("evdev: warn if our event processing lags by 10ms or more")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-19 15:07:50 +10:00
Peter Hutterer
596d86ecc1 test: improve event debugging a bit
Add a litest_checkpoint macro and convert a few of the litest_assert
macros to make use of that - this gives us a printf of the call site in
case it fails.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-19 15:07:44 +10:00
Peter Hutterer
721426a1be test: highlight the gesture state machine log messages in yellow
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12 15:24:47 +10:00
Peter Hutterer
b1b3692e08 gestures: use a colon-suffixed debug prefix like the other state machines
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12 15:24:45 +10:00
Peter Hutterer
0ec0a4212a test: make litest_wait_for_event_of_type auto-terminating
Wrap this in a macro so we cannot forget to pass -1

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12 12:37:55 +10:00
Peter Hutterer
d0bec3843a test: make litest_drain_events_of_type auto-terminating
Wrap this in a macro so we cannot forget to pass -1

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1048>
2024-09-12 12:37:50 +10:00
Peter Hutterer
0014400253 triage-policies: add reminder for info in commit messages
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1043>
2024-09-12 01:56:48 +00:00
Peter Hutterer
7da1af60cf triage-policies: add a blurb for the help-needed label
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1043>
2024-09-12 01:56:48 +00:00
Peter Hutterer
33612fb37c tools/debug-events: move the event type str to a helper function
This isn't really necessary for the code as-is it makes debugging things
easier.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1044>
2024-09-12 00:59:13 +00:00
Peter Hutterer
e8495b8d36 gestures: cancel the hold before initializing the pinch
If we're in state HOLD we have an ongoing hold gesture - make sure we
cancel that one first before we initialize the pinch.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1046>
2024-09-11 09:38:29 +00:00
Peter Hutterer
efdd536120 triage-policies: point to the new hid-recorder written in rust
It provides a more useful and easier to read report output, so let's go
with that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1045>
2024-09-11 06:44:28 +00:00
Peter Hutterer
83be519fc2 CI: retry valgrind jobs if they fail
Our valgrind jobs are very timing-sensitive so it's very common that
they fail with an error when the reason is just valgrind being slower
and we miss a deadline somewhere.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1040>
2024-09-11 04:58:52 +00:00
Peter Hutterer
dc249b0ffe tools/debug-events: add ability to compress motion events
If --compress-motion-events is given (and stdout is a tty) reduce
the output printed to one line per repeated motion/axis/scroll sequence
(with a count). Example output:
 event6   POINTER_MOTION          108 +1.912s	 1.00/ -1.00 ( +1.00/ -1.00))
 event6   POINTER_BUTTON              +2.008s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_BUTTON              +2.074s	BTN_LEFT (272) released, seat count: 0
 event6   POINTER_MOTION           39 +5.249s	 0.00/  0.99 ( +0.00/ +1.00)
 event6   POINTER_BUTTON              +5.385s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_MOTION           66 +6.031s	-1.00/  0.00 ( -1.00/ +0.00)
 event6   POINTER_BUTTON              +6.401s	BTN_LEFT (272) released, seat count: 0

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

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

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>
2024-09-11 12:49:28 +10:00
Peter Hutterer
09fd1cdd98 tools/debug-events: ignore old-style pointer axis events completely
Since they're interleaved with the more modern finger/wheel/continuous
events they mess up our repeate count, preventing compression for those
events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>
2024-09-09 15:41:45 +10:00
Peter Hutterer
41b3f5cc29 doc/api: fix wrong references to the tap drag config
It's _tap_get_drag_, not _tap_drag_get_ (and same for set/get_default)

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1039>
2024-09-06 04:23:19 +00:00
Peter Hutterer
f159abdc57 quirks: allow for parsing multiple products
This allows for a slight optimization of the quirks parser: where
multiple devices from the same vendor require the same quirk, allow
for multiple product matches in the form:

MatchProduct=0x0001;0x0002;

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

Closes #879

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>
2024-09-05 13:54:07 +00:00
Peter Hutterer
ea7ad8d25c util: add a strv_for_each helper function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>
2024-09-05 13:54:07 +00:00
satrmb
910d59e836 touchpad: add sticky mode to drag-lock
Sticky mode removes the timeout from drag-lock, only a tap ends a drag.
Timeout mode remains available without changes.

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

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1037>
2024-09-05 00:47:47 +00:00
José Expósito
ee9043d6b4 CI: Run pre-commit hooks
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>
2024-09-03 09:51:41 +02:00
José Expósito
7d849623d5 Fix pre-commit errors
Some files had pre-commit style issues. Fix them.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>
2024-09-03 09:51:41 +02:00
Tim Hanson
60e569941c Update quirks for HP Dragonfly Chromebook
Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/1034
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1033>
2024-08-31 12:18:12 +02:00
Peter Hutterer
86095429cd quirks: add quirk for Razer Blade 142024 Keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1031>
2024-08-26 07:42:00 +00:00
Peter Hutterer
15697685c6 triage-policies: add an entry for pointing users to 60-evdev.hwdb
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1032>
2024-08-26 14:43:09 +10:00
Peter Hutterer
3402f38001 libinput 1.26.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-08-19 09:26:22 +10:00
Jason Gerecke
66106b9746 tablet: Remove unnecessary scale factor on REL_HWHEEL_HI_RES
The two high-res axes should already be scaled appropriately by the
kernel. This unnecessary scale factor causes 1 click of the dial to
produce an event delta of +-14400 rather than the expected +-120.

Fixes: beca998122 ("tablet: add API for relative dials")
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1029>
2024-07-29 22:46:57 +00:00
Jami Kettunen
2135b4a6af quirks: add quirk for Minisforum V3 touchpad dwt
Disable while typing didn't work since the detachable (USB)
keyboard/touchpad case weren't being considered as one unit; mark the
keyboard as internal to correct this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1028>
2024-07-20 20:43:43 +03:00
Peter Hutterer
6f19267c1e doc/user: fix a typo
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1027>
2024-07-19 10:07:49 +10:00
Jami Kettunen
c4f57bbc62 quirks: add quirk for the Minisforum V3 volume keys
They didn't work without the keyboard case also being attached to the
tablet PC.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1026>
2024-07-07 22:16:50 +03:00
Andre Kuehne
269875aa0e quirks: add quirk for the LG gram 14 2023 Touchpad
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1025>
2024-07-04 20:04:03 +02:00
José Expósito
c201be9b1b doc/user: document ModelTouchpadPhantomClicks quirk
Related https://gitlab.freedesktop.org/libinput/libinput/-/issues/1013

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1023>
2024-07-04 10:11:36 +00:00
Nicolas Fella
951ab12afe Fix typo in documentation comment
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1024>
2024-07-03 15:13:58 +02:00
Peter Hutterer
124431a5d3 libinput 1.26.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-06-27 12:48:55 +10:00
Peter Hutterer
6fee92c959 pad: switch the REL_WHEEL direction to match dials with scroll wheels
REL_WHEEL sends -1 for "down" and +1 for "up", so let's make sure we
keep that correct here too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1021>
2024-06-21 10:02:07 +10:00
Peter Hutterer
436bb5cc56 test: fix the pad dial test, values need to be equal, not >=
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1021>
2024-06-21 10:00:42 +10:00
Peter Hutterer
989140489b gitlab-triage: add a needinfo reminder blurb
Goes together with the recently added
be78ce12a3 ("gitlab-triage: add bugbot hook for closing stale needinfo bugs")
so we can ping people before closing the bug.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1020>
2024-06-20 07:31:17 +00:00
Peter Hutterer
1b7992c31a tools: add support for setting the calibration matrix
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1018>
2024-06-20 09:32:19 +10:00
Peter Hutterer
978676be1e tablet: allow calibration if libwacom says our tablet is a display tablet
Not all display tablets have INPUT_PROP_DIRECT SET (looking at you,
Huion Kamvas 12) so our calibration went nowhere. Let libwacom override
whatever the kernel says.

This also makes testing without matching hardware a bit easier now since
we only need to override the libwacom file, not the whole device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1019>
2024-06-19 12:37:44 +10:00
Peter Hutterer
41a4b128e9 tablet: rework a helper function to be more reusable
This allows us to look more things up from libwacom in one go.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1019>
2024-06-19 12:37:44 +10:00
Peter Hutterer
1f8b48dff5 quirks: add quirk for the RazerBlade142023 Keyboard
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1017>
2024-06-18 08:14:32 +00:00
Peter Hutterer
99647b71d3 tools: add libinput analyze buttons for button state analysis
This tool helps with tracking button states and time deltas
between button events. Example output for a mouse with LMR buttons
recorded (the mouse also has BTN_SIDE and BTN_EXTRA):

  Timestamp   │  Delta   │ L │ R │ M │ S │ E
     0.596112 │      0ms │ ┬ │   │   │   │
     0.689096 │     92ms │ ┴ │   │   │   │
     1.129056 │    439ms │ ┬ │   │   │   │
     1.308178 │    179ms │ ┴ │   │   │   │
     1.469149 │      0ms │ ┬ │   │   │   │
     1.598096 │    128ms │ ┴ │   │   │   │
     1.862125 │    264ms │ ┬ │   │   │   │
     2.084234 │    222ms │ │ │ ┬ │   │   │
     2.415224 │    330ms │ │ │ ┴ │   │   │
     2.831227 │    416ms │ │ │ ┬ │   │   │
     3.215067 │    383ms │ ┴ │ │ │   │   │
     3.525230 │    310ms │ ┬ │ │ │   │   │
     3.629006 │    103ms │ ┴ │ │ │   │   │
     3.813078 │    184ms │ ┬ │ │ │   │   │
     3.909170 │     96ms │ ┴ │ │ │   │   │
     4.093180 │    184ms │ ┬ │ │ │   │   │
     4.317036 │    223ms │ ┴ │ │ │   │   │
     4.507175 │    190ms │ ┬ │ │ │   │   │
     4.587105 │     79ms │ │ │ ┴ │   │   │
     4.779211 │    192ms │ ┴ │   │   │   │
     5.075239 │    296ms │   │   │ ┬ │   │
     5.259097 │    183ms │   │   │ ┴ │   │
     5.379082 │    119ms │   │   │ ┬ │   │
     5.483044 │    103ms │   │   │ ┴ │   │

The default behavior is to highlight time deltas below 25ms
in red. 25ms is our higher debounce timeout.

Note that the delta time is the one between button events, ignoring any
e.g. motion events in between.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1010>
2024-06-18 07:43:02 +00:00
Peter Hutterer
8326f71df5 touchpad: special-case shift as modifier for dwt
We ignore modifiers for disable-while-typing because we don't want to
disable the touchpad for things like shift-click or ctrl-click.

We also do remember the modifier state so that we don't disable the
touchpad for once-offs like ctrl+s.

Shift is however a special case - shift + something else is means the
user is typing and we should disable the touchpad for that.

Closes #1005

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1015>
2024-06-17 08:31:25 +00:00
Peter Hutterer
82322a4c57 doc/user: document the device quirk MatchFoo statements
Closes #1001

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1016>
2024-06-17 07:58:43 +00:00
Peter Hutterer
be78ce12a3 gitlab-triage: add bugbot hook for closing stale needinfo bugs
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1014>
2024-06-17 14:29:24 +10:00
Peter Hutterer
4333845e4c tools/debug-gui: draw the evdev x/y axis with the right color
We were drawing an arc but apparently in white which made it a tad hard
to see on a white background. Draw this with the same color as the
touchpoints so we can debug single-touch and tablet devices too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1011>
2024-06-13 05:45:19 +00:00
Peter Hutterer
78cb25c2f7 Whitespace fix
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1012>
2024-06-13 04:21:26 +00:00
Peter Hutterer
97284211d4 doc/api: link to a few tablet configuration settings
We have a rough grouping of config options per device type, let's add
the tablet ones there too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1012>
2024-06-13 04:21:26 +00:00
Peter Hutterer
4548a37511 tools: actually parse options in libinput-debug-tablets
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1009>
2024-06-10 15:09:19 +00:00
Peter Hutterer
1725b7d606 Add support for --set-pressure-range to the debugging tools
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1009>
2024-06-10 15:09:19 +00:00
Peter Hutterer
9267147ebd Fix @since tags for the pressure range configuration
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1008>
2024-06-07 10:49:13 +10:00
Peter Hutterer
98ba56fb31 libinput 1.26.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-06-06 14:09:40 +10:00
Peter Hutterer
a2f0cc35c5 quirks: add support for Uniq matching
Same as MatchName but matches on the UNIQ udev property instead. This
is needed for some Huion, Gaomon and other tablet devices that only
differentiate each other through the Uniq string which contains the
firmware version.

Closes #997

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1006>
2024-06-05 11:35:59 +00:00
Peter Hutterer
e72ee0b1c8 pre-commit: ignore subprojects for ruff and black
We don't have any subprojects yet but let's not fail badly for something
that's not our fault.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1005>
2024-06-05 10:38:08 +00:00
Peter Hutterer
fdb693a6ee tools/record: record the DRIVER property in the recording
So we know which kernel driver is handling the device. Quite useful,
sometimes, without having to ask for extra logs.

This of course requires that we ignore said property in libinput replay
since no uinput device will have that driver property set.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1007>
2024-06-04 16:54:28 +10:00
Peter Hutterer
f1792dec46 quirks: add a default resolution for Huion devices
The Inspiroy 2S H641P in default mode (without hid-uclogic support) says
the pen interface has a Logical Maximum of 32767. Over the 160x100mm
active surface this is ca 205x328 units/mm. This isn't correct across all
devices but let's use it as fallback value so the tablets work out of
the box.
It's hard to set these tablets via 60-evdev.hwdb otherwise because most
Huion tablets share a few PIDs only.

Note: this doesn't overwrite the kernel resolution it merely provides a
fallback where no kernel resolution is set.

The firmware report descriptor does set a physical range (2048) but it
sets it in cubic inch which is ignored by the kernel:

  # 0x65, 0x33,      //     Unit (EnglishLinear: in³)             48

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1004>
2024-05-27 14:51:25 +10:00
Peter Hutterer
fe3175748a evdev: don't return a size for 0-1 axes
Tablet pads historically need to have ABS_X/Y to be detected as tablets
but their min/max values are 0 and 1. Let's not return a size for those.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1004>
2024-05-27 14:51:23 +10:00
Yaraslau Furman
e802715785 quirks: lenovo: mark Lenovo 16ARX8 keyboard as internal
Fixes "Disable touchpad while typing" setting not working.
This quirk should work for all other keyboards with the same issue
listed above, as well as those that might come up in the future.

Signed-off-by: Yaraslau Furman <yaro330@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1001>
2024-05-22 12:00:31 +03:00
Putu Wiramaswara Widya
e7499aeb49 added quirks for Thinkpad X390 Yoga's trackpoint
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1003>
2024-05-21 09:17:00 +08:00
José Expósito
a2515fc3f6 evdev: log the right mouse wheel angle
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1002>
2024-05-18 18:55:29 +02:00
José Expósito
5f1b46370b quirks: fix end-of-file in 50-system-huawei.quirks
Picked up by the pre-commit hook.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1002>
2024-05-18 18:55:29 +02:00
Peter Hutterer
430c1b89c6 CI: bump to Fedora 40
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1000>
2024-05-13 11:19:21 +10:00
PLTorrent
7c87d3e671 Add support for Matebook X Pro 2024 Touchpad
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/998>
2024-05-05 21:23:45 +00:00
Marge Yang
0c347a9728 quirks: add quirk for HP Haptics Touchpad.
This Touchpad is a pressure pad and needs the pressure
handling disable.

Signed-off-by: Marge Yang <marge.yang@synaptics.corp-partner.google.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/995>
2024-04-30 06:59:42 +00:00
Julian Orth
857780ede7 Ring positions increase clockwise
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/994>
2024-04-29 15:06:13 +00:00
Peter Hutterer
ace22ad0b0 gitlab CI: don't run MR pipelines in forks
Commit originally by Simon Ser in wayland/wayland-protocols!305.

Currently our CI setup has a downside: for each push on a merge
request, two pipelines are triggered. The first is triggered in
the context of the forked repository, and the second is triggered
in the context of the MR in the parent repository.

Replace the workflow rules with the ones in the official docs [1],
so that a branch pipeline isn't triggered when a MR exists for that
branch.

[1]: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/993>
2024-04-29 14:50:07 +10:00
Martin Rys
a191a46a78 Include COMPOSE and KANA keys in tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/990>
2024-04-28 23:59:14 +00:00
Martin Rys
7c91e3539c Add definitions for LIBINPUT_LED_COMPOSE and LIBINPUT_LED_KANA
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/990>
2024-04-28 23:59:14 +00:00
Yogas Kung
ed9570df60 quirks: increase MacBook touchpad AttrPalmSizeThreshold 2024-04-24 04:11:51 +00:00
Peter Hutterer
aebd81162b quirks: add quirk for RazerBladeAdvancedLate2019
Generated by tools/razer-quirks-lister.py

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/992>
2024-04-23 13:52:48 +10:00
Peter Hutterer
ba761664e8 pad: implement strip support for non-Wacom tablets
Wacom's strips are a log(2) value range which is a quirk specific to
that vendor. On other devices let's normalize the value normally.

Related #989

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/989>
2024-04-23 01:31:48 +00:00
Peter Hutterer
c5b732cc38 pad: rename two helper functions
This is the specific behavior of the Wacom strips and rings, so let's
add wacom to the name.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/989>
2024-04-23 01:31:48 +00:00
Maarten de Vries
a8acd4a692 quirks: add quirk for Lenovo Legion keyboard 048d:c103 2024-04-22 12:37:46 +02:00
Tarcísio Eduardo Moreira Crocomo
955158f982 fix: unnecessary braces and mistake in doc
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/988>
2024-04-09 23:40:34 -03:00
Tarcísio Eduardo Moreira Crocomo
46d1fff0b0 touchpad: add clickfinger button map
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/988>
2024-04-09 19:08:17 -03:00
José Expósito
1d5d45a251 touchpad: use boolean operator for booleans
Detected while compiling with Sparse enabled.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/987>
2024-03-18 23:35:34 +00:00
José Expósito
f6a1f264df sparse: make some variables static
Fix warnings about variables that should be made static when compiling
with Sparse enabled:

        $ CC=cgcc meson builddir

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/987>
2024-03-18 23:35:34 +00:00
Peter Hutterer
74f69dc9a0 test: replace an assert with double_ge
Better test debugging this way.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
4d9b25b234 test: force the apple magicmouse to 1000dpi
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
47f94633fe test: remove some old compat code for kernel<4.5
Kernel 4.5 and libevdev 1.5 were released in 2016, this code is no
longer necessary.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
3d246ef248 test: remove a workaround for libevdev 1.2 and earlier
libevdev 1.3 was released in 2014.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
02d01a53c6 util: slightly improve the trace() macro
Only one printf call instead of three, means better termination of the
color code. And auto-append the newline while we're there and use the
ANSI defines we have since added.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
bb1b1304df test: fix two wrong timeout calls
This are tests with drag lock enabled, so our timeout needs to be
be the tap and drag timeout (which is higher than the normal tap timeout).
Only worked because they're similar enough that if there's a bit of a
delay, the extra ms push us over the line.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
09b59e42fb test: fix some tests that may cause pointer jumps
Increase the number of events to move from one position to the next to
avoid accidental pointer jumps.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
34f86489a8 Revert "test: allow for substring matching in the various --filter- arguments"
Substring matching means it's impossible to select filters that are
substrings of others, making it too painful to test one specific filter.

This reverts commit a524cf9761.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
c775c23121 test: slightly increase the finger switch timeout wait
In touchpad_2fg_scroll_return_to_motion we sometimes fail because the
timeout is too close to the actual timeout expiry, creating a race
condition on whether the scroll stop event (triggered by the gesture
end) is sent before or after the timeout expiry.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
30c6d5983d test: add two more more libinput_dispatch() calls
We're writing a lot of events here, if the system isn't fast enough or
(in the future) if we have a custom socket instead of a kernel device we
might fill up the write buffer, causing the test to fail.

Easy workaround is to dispatch more often to ensure the data is being
read from the fd.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
d6e54c3597 util: fix error in mkdir_p if a parent directory fails to be created
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
9c69152428 Move mkdir_p into a utility header
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
3644372696 test: add helpers for checking (negative) errnos
This way we get to see the actual error when it happens.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
4935e52652 util: add a LIST_INIT macro
Necessary for the case where we need a compile-time initialized list.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
3a935507ae ci: bump to Fedora 39 and FreeBSD to 13.2
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/985>
2024-03-18 12:31:59 +10:00
Peter Hutterer
301895685e tools: fix two black warnings
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/985>
2024-03-18 12:29:57 +10:00
Peter Hutterer
bf061ad157 quirks: Add a the onebutton apple touchpad quirk for an old MacBook
This is a 2006 Macbook, model A1181. Should fix the warning:
  event9  - appletouch: kernel bug: missing right button, assuming it is a clickpad.

Related #981

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/983>
2024-03-13 11:52:00 +00:00
Peter Hutterer
15609213a6 touchpad: disable the immediate scroll state if tapping is enabled
On a touchpad without gestures we would take a 2-finger touch as
immediate start to a 2-finger scroll gesture. This effectively removes
the 1mm threshold we otherwise have before scrolling is assumed to have
started.

If tapping is enabled and a user triggers a small motion event this
results in scroll events being sent before the two-finger tap.

Closes #981

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/982>
2024-03-12 15:19:59 +10:00
Derrick Timmermans
6faab3a1d4 Add quirk for the Legion Slim 7 Gen 8 keyboard
Signed-off-by: Derrick Timmermans <derrick.timmermans@outlook.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/980>
2024-03-06 10:14:35 +01:00
José Expósito
bee06c10ce quirks: add quirk for Dell Precision 5480 touchpad
The Dell Precision 5480 has a large touchpad without any visible markers
for the touchpad buttons.
Since the ModelTouchpadVisibleMarker quirk is enabled by default for all
Dell touchpads, the middle button area ends up being too small. Disable
the quirk for this specific model.

Closes: #976
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/979>
2024-02-29 09:51:43 +01:00
José Expósito
a43f1edbfe Add libinput_device_get_id_bustype()
Allow to get the device bus type ID in addition to its vid and pid.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/975
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977>
2024-02-28 22:49:29 +00:00
José Expósito
7ac26ed9c2 CONTRIBUTING: Add CONTRIBUTING.md
Add a very basic CONTRIBUTING.md file with a link to the documentation.

Closes: #974
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/978>
2024-02-28 17:07:45 +01:00
José Expósito
b5b825a7c3 doc/user: Document "Closes" and "Fixes" tags
Describe how the tags should be used. The guidelines for the "Fixes"
tag are taken from the Linux kernel documentation [1][2].

[1] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes
[2] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#describe-changes

Closes: #974
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/978>
2024-02-28 16:59:58 +01:00
Peter Hutterer
399ba5e0ee CI: only check the MR if we're in a merge request pipeline 2024-02-28 18:53:25 +10:00
Joshua Goins
beca998122 tablet: add API for relative dials
Some tablets such as those in the XP-PEN PRO series use "dials" which
are actually scrollwheels and emit EV_REL events. These should not be
emulated as rings (which are absolute) so we must expose them as a new
tablet event.

Adds LIBINPUT_EVENT_TABLET_PAD_DIAL that work largely identical as our
high-resolution wheel events (i.e. the values are in multiples or
fractions of of 120). Currently supports two dials.

This is a lot of copy/paste from the ring axes because the interface is
virtually identical. The main difference is that dials give us a v120
value in the same manner as our scroll axes.

Notes:
- REL_DIAL is mutually exclusive with REL_WHEEL, we assume the kernel
  doesn't (at this point) give us devices with both. If this changes for
  devices with three dials (wheel + hwheel + dial) we need to add code
  for that.
- REL_DIAL does not have a high-resolution axis and we assume that any
  device with REL_WHEEL_HI_RES will also have REL_HWHEEL_HI_RES (if the
  second wheel exists).
- With dials being REL_DIAL or REL_WHEEL there is no possibility of
  detecting a finger release (the kernel does not route EV_RELs with a
  value of zero). Unless this is implemented via a side-channel - and it
  doesn't look like any hardware that supports dials does that - we
  cannot forward any information here. So unlike absolute rings we
  cannot provide a source information here.

Closes #600

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/967>
2024-02-20 02:49:05 +00:00
Peter Hutterer
d487ca36a4 test: only expect one button event from the intuos-like test
BTN_0 is the only one guaranteed to exist (otherwise we skip the test)
so let's ensure we have at least one event - all the others will fail if
we don't get the right event sent.

This enables the test to run against devices that only have one button.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/967>
2024-02-20 02:49:05 +00:00
Josip Medved
566857bd98 Recognizing Framework 16 keyboard modules as internal keyboards 2024-02-19 03:20:32 +00:00
Peter Hutterer
0d7b281f49 doc: fix end-of-file in the state machine SVG
Picked up by the pre-commit hook
2024-02-19 12:21:16 +10:00
Peter Hutterer
18d1d4fd75 quirks: tighten the match for the Graviton N15i touchpad
Other systems use the same touchpad but without physical buttons (e.g.
SpeedMind M-BOOK) and obviously the various systems using the 5288
touchpad, see commit d1f274c7.

Let's tighten this quirk to just the Graviton only.

Closes #970
Fixes 8163b552be23ef3f4082775649bb12a3f6162df6
Related !957
2024-02-14 06:23:59 +00:00
Bogdan Mircea
83d780e572 Added quirks for TongFang/Uniwill touchpad and ITE keyboard 2024-02-12 11:04:59 +00:00
Peter Hutterer
f46d45a589 doc: drop permissions to 644 for the gesture state machine SVG
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-02-06 11:32:42 +10:00
Theluga
8b9328415e quirks: Add Lenovo's Ideapad Gaming 3 white backlit keyboard as an internal keyboard 2024-02-02 01:43:10 +00:00
Peter Hutterer
8079a51b7f doc/user: note the requirement to apply for gitlab fork permissions 2024-02-02 09:51:31 +10:00
Peter Hutterer
049beea4c5 triage-policies: add a bugbot command to close issue in favour of an MR 2024-02-02 09:51:31 +10:00
Hooloovoo Blue
1788d3523f Update 50-system-lenovo.quirks to fix X201t tablet buttons 2024-02-01 04:25:09 +00:00
Peter Hutterer
4bc27543e9 tablet: add tablet tool pressure range configuration
Add a configuration option to reduce the available hardware range to a
fraction thereof. This is done by copying the absinfo struct for the
pressure value and adjusting that copy's minimum/maximum value for
scaling into the target normalized range.

The 1%/5% tip thresholds are kept but pressure offset detection is
disabled if there is a custom pressure range.

Unlike the pressure curve which is implemented in the compositor, the
pressure min/max range needs to be in libinput, primarily because the
tip threshold needs to adjust to any new minimum, allowing for
light touches with a pen without triggering tip down even at a higher
hardware pressure.
2024-01-30 14:29:25 +10:00
Peter Hutterer
47f0bce7ec tablet: document a known bug about pressure thresholds across tablets 2024-01-30 14:29:25 +10:00
Peter Hutterer
54aa01a267 tablet: move tool creation into a helper function 2024-01-30 14:29:25 +10:00
Peter Hutterer
7cffd28e8f tablet: don't use absinfo_range for the percentage calculation
Our percents are inclusive 0% and 100%.
2024-01-30 14:29:25 +10:00
Peter Hutterer
0322403ea4 tablet: fix tilt handling for even-ranged tablets
The tablet tilt range may be set as [-N, M] in which case we assume that
a value of zero is vertical (and thus should result in a libinput tilt
value of zero). Unfortunately some tablets report an even total value
range, e.g. [-64, 63] so zero is not actually the mathematical center of
the axis.

Fix this by bumping the axis maximum so zero becomes the logical center.
All devices we've seen so far have [-A, (A-1)] as range so bumping it by
one makes it symmetric.
2024-01-30 14:29:25 +10:00
Peter Hutterer
72eca2db56 util: add a helper to normalize an axis to [0.0, 1.0]
Like the input axis, a normalized range has min/max inclusive so we
cannot use the absinfo_range() helper which assumes the max is exclusive.

Reverts parts of 4effe6b1b9
2024-01-30 14:29:25 +10:00
Peter Hutterer
f20eefbc59 Revert "tablet: fix the pressure offset range being off by one"
Fixing the range is only required when the output range is not inclusive
of the min/max (such as when mapping an abs axis to a screen width).

Our pressure range is inclusive 0.0 and 1.0, so we want absinfo->maximum
to map to exactly 1.0

This reverts commit a5b6f4009b.
2024-01-30 14:29:25 +10:00
Peter Hutterer
8bb53150a9 tablet: handle BTN_STYLUS3
And add a test to make sure the tool we know that has three buttons (Pro
Pen 3) can send all those. Enough to run that test one one compatible
device, no real benefit of running it on all tablet devices.
2024-01-24 12:34:25 +10:00
Peter Hutterer
2218da2f31 test: fix a wrong value for the auto-assigned BTN_TOOL
This was actually passed through:
  litest debug event19 - 0.000 EV_KEY           BTN_TOOL_PEN         -2147483648
2024-01-22 01:21:29 +00:00
Peter Hutterer
8603584e33 test: set pressure to zero on proxout for the tablets with forced prox out
If a test goes past the tip-down threshold, the proximity timeout does
not trigger. And one can spend a long time trying to debug why the test
fails...

As far as I vaguely remember, these devices' pressure values are correct
enough, it's just the lack of BTN_TOOL_PEN that is the issue so instead
of a proper proximity out, we just send enough data to set the pressure
to below the tip threshold.
2024-01-22 01:21:29 +00:00
Peter Hutterer
c5f808ac2e test: debug print the events we're draining 2024-01-22 01:21:29 +00:00
Peter Hutterer
cf1c07e066 Add a helper for radians to degrees 2024-01-16 19:49:02 +10:00
José Expósito
3fd38d8927 libinput 1.25.0
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2024-01-15 09:53:20 +01:00
Peter Hutterer
11a7de7640 evdev: default tablets to allow for rotation
If libwacom is disabled or there is no .tablet file in libwacom for this
device yet, default to enabling a left-handed setting. Otherwise the
tablet may not be usable.

See https://github.com/linuxwacom/libwacom/issues/616
2024-01-03 12:20:16 +10:00
Peter Hutterer
d5ff9d75a8 triage-policies: emphasize that recordings must be attached 2024-01-03 08:40:17 +10:00
Aiden
5abe45cd49 Add Lenovo ThinkPad E14 Quirk 2023-12-24 13:50:33 -05:00
Peter Hutterer
19446a029b fallback: add messages for touch arbitration debugging 2023-12-19 04:26:50 +00:00
Peter Hutterer
c22ee58b4c triage-policies: add bugbot labels for requesting hid-recorder output
And libinput record too while we're at it.
2023-12-19 10:15:04 +10:00
Airat Makhmutov
106b61e216 quirks: touchpad quirk for Graviton N15i-K2
The generic quirk introduced in commit d1f274c7 ("quirks: add a
more generic match for the 5288 Synaptics clickpad") affects the
touchpad (with physical buttons) present in the Graviton N15i-K2.
2023-11-29 12:17:47 +00:00
Peter Hutterer
b600cc35c5 gitlab: make the bug template the default template
This way users who don't know gitlab much but are most likely reporting
a bug get to use this template and anyone else can remove the
boilerplate and be more free-form and/or prosaic.
2023-11-23 09:53:09 +10:00
José Expósito
9b964ae5da quirks: rename 50-framework.quirks
Follow the same naming used by other quirks.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-11-17 06:18:52 +00:00
José Expósito
d253165d7c quirks: disable button debouncing for the QEMU/KVM mouse integration
When using a touchpad to double click on a QEMU/KVM virtual machine,
fast double taps are filtered by our debouncing code.

Since these are emulated devices and by definition cannot have a stuck
button, let's tag them so we don't enable the debouncing code.
If the button of the physical device is stuck, that's a problem that
needs to be fixed in the host system.

The same device name and broken behavior was found in GNOME Boxes and
Virtual Machine Manager.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-11-16 23:07:32 +00:00
Benjamin Tissoires
ec0421d0ad CI: bump vm2c and kernel for VMs
Actually libinput is one of the last users of harbor.fd.o, because it uses
an outdated version of vm2c.py. Use the new location of the project,
bump its release, and also bump the kernel version we test while at it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2023-11-16 14:25:10 +00:00
Peter Hutterer
e29a00d657 quirks: don't disable the keyboard on the Dell Latitude 7275
Fixes #950
2023-11-16 09:46:32 +10:00
Peter Hutterer
0e564f0857 quirks: disable button debouncing for the VirtualBox mouse integration
Fixes #158
2023-11-16 09:46:31 +10:00
Miroslav Jarý
da557f99cb Add quirk for Lenovo LOQ 15IRH8 2023-11-09 16:46:34 +00:00
José Expósito
802b0e14d0 doc/user: add FAQ about scroll speed
This question showed up in my email and it has been asked in the issue
tracker a few times. Explaining why libinput is not the right place to
implement it for future reference.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-11-07 09:50:29 +01:00
Czcibor Bohusz-Dobosz
713892c162 Number the fingers by slot in debug-gui 2023-10-16 04:31:17 +00:00
Rajas Paranjpe
686ec27ba3 quirks: disable Chromebook Redrix AttrPalmPressureThreshold
This device doesn't need libinput's palm detection, see
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/939
2023-10-12 05:33:48 +00:00
Peter Hutterer
98c689ebb2 quirks: add quirks for RazerBlade162023 and RazerBlade182023
Autogenerated from our razer-quirks-lister.py tool
2023-10-09 20:15:10 +10:00
Peter Hutterer
fe3ae87b09 touchpad: allow a palm pressure threshold of 0 to disable
Where a more generic match assigns a palm threshold to a device, allow
unsetting this by assigning a threshold of zero.

And remove the bug log for palm size threshold of 0 for the same reason.
2023-10-09 07:03:47 +00:00
Peter Hutterer
ba32f0818f test: group the test devices and sort them
Group the LITEST_FOO enum into sections for touchpads, mice, etc. This
makes it easier to find whether a particular device may have a
representation already.
2023-10-09 07:03:47 +00:00
lilly-lizard
31062d6e53 removed thinkpad 13 gen 2 trackpoint pre-multiply quirk
Signed-off-by: Lilly Lizard <bigbanana29@aol.com>
2023-10-07 21:49:44 +00:00
Peter Hutterer
e9e3d2140a zsh: fix completion
Was missing a backslash

Fixes #941
2023-10-05 18:37:32 +10:00
Peter Hutterer
4b03374d50 doc/user: update the udev rule to handle bind/unbind events (part 2)
Summary: we expect add, change or remove but kernel 4.12 added bind and
unbind. These events were previously discarded by udevd. Our rules should
handle any event *but* remove, so update as suggested in the announce email
linked below.

For a longer explanation, see the system 247rc2 announcement
https://lists.freedesktop.org/archives/systemd-devel/2020-November/045570.html

See cd37dcfa66 where we did this already
for the udev rules we use ourselves and
a88d107c0d for the patch where we already
updated parts of the docs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-09-28 08:57:15 +10:00
Vadim Yanitskiy
769cb992cc quirks: match 'ITE Device(8910)' keyboard by USB VID/PID
This allows the "Disable while typing" feature to work properly for:

  048d:c102 Integrated Technology Express, Inc. ITE Device(8910)

This keyboard was found in the following Lenovo laptops:

* Legion 5 Pro 16ARH7H
* Legion 5 15ARH7H

The quirk for 16ARH7H was added in 94c785a2 (see #933), however
matching by DMI does not work for 15ARH7H, so let's match by
USB VID/PID instead.

https://gitlab.freedesktop.org/libinput/libinput/-/issues/933#note_2099049
2023-09-25 19:40:26 +07:00
José Expósito
b6ea2f3976 quirks: add a quirk for the HUAWEI MateBook X Pro 2022 touchpad
Clickpad that announces BTN_RIGHT.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/939
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-25 10:15:35 +02:00
Elliot Gawthrop
99c4721f95 quirks: add RollerMouse Pro3 double-click fix 2023-09-05 09:39:06 +01:00
Branko Grubić
94c785a29c quirks: Adds Lenovo Legion 5 Pro 16ARH7H keyboard quirk
Fix allows touchpad Disable while typing feature to work properly.

Fixes: #933

Signed-off-by: Branko Grubić <bitlord0xff@gmail.com>
2023-09-05 01:43:26 +00:00
WeirdTreeThing
d4d0cee077 quirks: Add quirk for Google Chromebook Drobit
This device has a touchpad with uncommon pressure sensitivity which
makes it hard to use out of the box.

Signed-off-by: Brady Norander <bradyn127@protonmail.com>
2023-09-03 18:25:55 +00:00
José Expósito
63732a5431 meson.build: Fix add_lamguages() warning
We need to set the `native` flag:

    meson.build:704: WARNING: add_languages is missing native:,
    assuming languages are wanted for both host and build.

As documented [1]:

    If set to true, the language will be used to compile for the build
    machine, if false, for the host machine.

[1] https://mesonbuild.com/Reference-manual_functions.html#add_languages
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
José Expósito
74829a650d meson.build: Update to meson v0.56.0
The meson version was `>= 0.49.0` but features from `0.56.0` were used:

    meson.build:485: WARNING: Project targets '>= 0.49.0' but uses
        feature introduced in '0.56.0': meson.project_source_root.

Update meson's target version to reflect the features used.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
José Expósito
12bb7547f9 meson: Use the meson setup command
Meson recommends using the `meson setup [options]` command:

    WARNING: Running the setup command as `meson [options]` instead of
    `meson setup [options]` is ambiguous and deprecated.

Update the documentation and CI to use the recommended command.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
José Expósito
8d0f2f5f62 pre-commit: Fix end of files
The new pre-commit hook introduced in commit 53517dccb8 ("Add
pre-commit hooks") found 2 files ending with a double empty line:

    Fix End of Files.............................Failed
      - hook id: end-of-file-fixer
      - exit code: 1
      - files were modified by this hook

Fix this error.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
José Expósito
973c461d4b tools/record: print bus name
A follow up on commit 65eaabf91f ("tools/record: print the vid/pid
with proper 4 hex digits").

Print the bus name in addition to the bus ID. Only the busses available
in quirks are printed.

Example:

    $ sudo libinput record
    [...]
    # ID: bus 0x0003 (usb) vendor 0x046d product 0x406d version 0x0111
    [...]

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-01 16:21:15 +02:00
Peter Hutterer
53517dccb8 Add pre-commit hooks
This ensures a few things are correct before we commit and/or push,
making life a bit easier for both our contributors and our maintainers
since some things should no longer end up in the MRs.

Activate via:
$ pre-commit install
$ pre-commit install --hook-type pre-push

The latter is required for the ci-templates hooks which are pre-push
only.
2023-09-01 09:12:54 +00:00
José Expósito
bf59231f23 evdev: Fix uninitialized variable
Due to a patch pushed accidentally to main, the `key_count` variable is
uninitialized in the `evdev_log_bug_libinput` code path:

  ../src/evdev.c:148:12: error: ‘key_count’ may be used uninitialized [-Werror=maybe-uninitialized]
    148 |         if (key_count > 32) {
        |            ^
  ../src/evdev.c: In function ‘evdev_pointer_post_button’:
  ../src/evdev.c:132:13: note: ‘key_count’ was declared here
    132 |         int key_count;
        |             ^~~~~~~~~

Fixes commit bb1e4a493f ("evdev: Log bug when releasing key with count 0")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-01 10:07:20 +02:00
José Expósito
bb1e4a493f evdev: Log bug when releasing key with count 0
libinput keeps an internal key count. It is increased by 1 when the key
is pressed and decreased by one when the key is released.

The count should never be negative, however a user found an issue while
running Sway and hit an assert.

Replace the assert with a log to avoid the crash.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/928
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-08-31 16:46:46 +02:00
Peter Hutterer
17e556503d tools: rename an enum value to fix a FreeBSD 14 name clash
Fixes #931
2023-08-31 12:21:00 +10:00
Weifeng Liu
5aca13a65c quirks: Add quirk for Google Chromebook Redrix
Google Chromebook Redrix (HP Elite Dragonfly) is shipped with a touchpad
from ELAN (ELAN2703:00 04F3:323B) with uncommon pressure parameters
which make moving and tapping not working out of box.

Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com>
2023-08-30 08:22:25 +00:00
Peter Hutterer
4effe6b1b9 evdev: add a helper macro for the absinfo range
The range is (max - min + 1) because the kernel range is inclusive min
and max. Let's fix that once and for all with a helper function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 17:07:38 +00:00
Peter Hutterer
a5b6f4009b tablet: fix the pressure offset range being off by one
Kernel ranges are inclusiv min/max, so let's make sure we calculate that
correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 17:07:38 +00:00
Peter Hutterer
d75a0fa42d tablet: fix the tilt range being off by one
Kernel ranges are inclusiv min/max, so let's make sure we calculate that
correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 17:07:38 +00:00
Peter Hutterer
65eaabf91f tools/record: print the vid/pid with proper 4 hex digits
The field with includes the 0x if printing with "0x04d". And because
that format prints zero as just 0000, let's move the 0x prefix out and
let printf only handle the actual number.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 05:35:15 +10:00
Peter Hutterer
1680f2fbaa libinput 1.24.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-25 13:04:17 +10:00
Bjørn Forsman
34b9c4ce44 quirks: Add Wacom Bamboo Fun Pen
We must disable ABS_DISTANCE or else the automatic pressure offset
calculation doesn't work for this device.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
2023-08-24 19:22:00 +02:00
Bjørn Forsman
3dba00845c tablet: increase pressure offset limit from 20% to 50%
detect_pressure_offset() currently rejects offsets that are greater than
20%. My graphics tablet (Wacom Bamboo Fun) is about 30%. The pen tip is
2 mm. Wacom recommends replacing at 1 mm, which means this isn't worn
out yet and we should instead increase the limit to make these devices
usable.

Without this change a "pen down" event happens simultaneously with the
pen being detected -- about 1 cm above the surface -- and producing
libinput pressure of about 0.30. This means you start drawing "in the
air", without knowing up front where the cursor is going to be.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
2023-08-24 08:04:03 +02:00
Yinon Burgansky
f259cac9ca docs: improve custom pointer acceleration documentation.
- Explain calculation made by the driver.
- Provide detailed example with a plot for a custom function.
- Fix inaccurate explanation of unit values.

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
2023-08-16 20:13:39 +03:00
Peter Hutterer
5534a5f640 quirks: add quirk for the RazerBlade152023 keyboard
Autogenerated from our razer-quirks-lister.py tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-08 20:26:28 +03:00
José Expósito
08e4a3deb9 quirks: Add Lenovo Legion 7i 4090 keyboard quirks
Disable while typing is not working because the keyboard uses the USB
bus.

Add the `AttrKeyboardIntegration=internal` quirk to fix it.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/911
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-07-31 17:16:42 +02:00
José Expósito
fa0d27d175 quirks: AddHP Spectre x360 15 ModelTabletModeNoSuspend keyboard quirk
The HP stream x360's embedded-controller filters out events form its
builtin keyboard when in tablet-mode itself; and it has a volume up/down
on the side.

Do not suspend the keyboard when in tablet-mode so that the volume
up/down button keeps working when in tablet-mode.

Add a ModelTabletModeNoSuspend quirk so that the home button keeps
working when in tablet-mode.
This can safely be done since the rest of the keyboard gets disabled by
the embedded-controller for us.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/920
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-07-31 13:25:57 +02:00
Llerraf Gnem
38fdfd1dfe
docs: fix "See also" link in libinput_config_accel_profile
Used to be to libinput_device_config_accel_set_points, corrected to
libinput_config_accel_set_points
2023-07-26 11:41:34 -05:00
Peter Hutterer
f617b414fb Drop the Signed-off-by requirement
We've had this for roughly 10y now and it's value is dubious. Most of
xorg no longer requires, mesa accepts but doesn't require it, most of GNOME
doesn't accept it and neither does systemd.

Let's drop the requirement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-21 09:08:46 +10:00
Peter Hutterer
35a237e24c Fix a few gcc analyzer complaints in util-strings.*
Sprinkle a few asserts into the various string helpers for where our
arguments must not be NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-19 14:19:08 +10:00
Peter Hutterer
2ebb6f629f Fix a gcc analyzer complaint
Doesn't trigger here since we never call it with NULL but let's make
sure anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-18 16:05:13 +10:00
Peter Hutterer
3fb876a49d test: expand the tablet mode switch test to check for fake key releases
If a key is still down when the tablet mode switch goes on, make sure we
release the key before the switch goes in effect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-17 09:32:24 +10:00
Peter Hutterer
9bd0604ea3 Add a triage policy for kernel bugs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-04 13:52:44 +10:00
Peter Hutterer
51875324e0 Add triage policies for merge requests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-04 12:14:12 +10:00
Peter Hutterer
b39145e468 doc/user: quirks are available, not supported
This is a bit nitpicky but let's call the current quirks merely
"available" rather than "supported" since quirks should never be seen as
supported API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-29 03:32:05 +00:00
Peter Hutterer
a244b9e32b tablet: apply pressure offset handling for non-distance tablets
Previously we only applied pressure offset handling for tablets that
supported ABS_DISTANCE. Detecting a pressure offset when the tool
doesn't actually touch the surface is easy after all.

But tablets without distance handling may also have a pressure offset,
so let's try to detect this. This is obviously harder since the pen will
always touch the tablet's surface whenever it is in proximity and thus
will always have *some* pressure applied to it.

The process here is to merely observe the minimum pressure value during
the first two strokes of the pen. On the third prox in, that minimum
pressure value is taken as the offset. If the pressure drops below the
offset, the offset is adjusted downwards [1] so over time we'll
get closer to the pen's real offset.

[1] this is already done for distance tablets too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-23 05:21:51 +00:00
Peter Hutterer
ecf02deb17 tablet: split proximity and axis update handling
Let's make this two conditions, this is too confusing to read otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-23 05:21:51 +00:00
Peter Hutterer
eea10aef47 tablet: split detecting and updating the pressure offset
detect_pressure_offset() would previously update an existing offset but
otherwise skip most of the work for any event other than proximity-in
events. This was too hidden, let's split this into two functions - one
to update an existing offset and another one to detect a new offset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-23 05:21:51 +00:00
Peter Hutterer
71f5dc6e23 tablet: move setting the pressure offset into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-23 05:21:51 +00:00
Peter Hutterer
a88d107c0d doc/user: update the udev rule to handle bind/unbind events
Summary: we expect add, change or remove but kernel 4.12 added bind and
unbind. These events were previously discarded by udevd. Our rules should
handle any event *but* remove, so update as suggested in the announce email
linked below.

For a longer explanation, see the system 247rc2 announcement
https://lists.freedesktop.org/archives/systemd-devel/2020-November/045570.ht

See cd37dcfa66 where we did this already
for the udev rules we use ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-15 03:31:30 +00:00
Peter Hutterer
6f10f01af2 test: check that the pressure offset is reduced during motion events too
Ensure that if we do get pressure < offset that that offset is reduced
to the current pressure value.

The implementation for this is arguably buggy, reducing the pressure
means we get a tip up event since we now reach 0% of pressure. Arguably
we should enforce the tip staying down and releasing it later but since
this should typically never happen more than once per tool per context
and working around this is a lot of effort, we live with it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-14 10:46:24 +10:00
Peter Hutterer
24cf215f54 test: check the tablet pressure values with a helper function
Makes the code a bit easier to read. Adds precision to some tests,
slightly loosens precision in some other tests but that shouldn't matter
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-13 15:24:43 +10:00
Peter Hutterer
684ac6b0c2 test: remove a confusing comment
We don't actually increase the pressure here, so let's not say we do

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-13 13:50:10 +10:00
Peter Hutterer
65c71fd6b4 doc/user: move ignoring devices to separate page
This is way too hidden to the point where i couldn't find it for quite a
while despite knowing it exists. Move it to an entry under
troubleshooting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-12 13:50:25 +00:00
Peter Hutterer
d159799637 CODING_STYLE: drop the unintended real name policy
This was never intended as a true real name policy (and we never
actually interpreted it that way), its purpose is to identify users
and avoid commits from 12345@example.com.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-12 15:05:34 +10:00
Peter Hutterer
83144a0edc man: hide debug-gui from the libinput.man page if disabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-09 13:00:08 +10:00
Peter Hutterer
9a3429f4af test: add a calibrated (swapped) tablet device
Swap any input for both x/y and default to a calibration matrix that
swaps it back. In theory, that device will then behave as every other
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
bc18b18e32 test: add a pre-calibrated flag and exclude the tests as necessary
Prep work for adding a precalibrated tablet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
44de3ff367 test: add an extra override hook for tablet motion
Currently unused but it complements the existing override handlers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
160b062454 test: change tablet coords to doubles and pass the pointer through
All other motion/touch/... coords are already doubles so let's follow
suite here. And passing a pointer into the custom handlers
means we can modify x/y slightly and return false, leaving the rest up
to the generic event handling code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
4bdec007ba CI: add a comment to the meson build helper
We now have an upstream for it so we can sync changes between projects.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-05-30 15:17:14 +10:00
Simon Ser
57a2339779 doc/user/timestamps: document which clock is used
Document that all timestamps are given in the CLOCK_MONOTONIC
domain.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-09 11:18:23 +02:00
Peter Hutterer
d3481c8807 evdev: if a device's rotation is around 180 degrees, flip the wheel
For a device used upside-down, make sure the wheels correspond to the
new physical directions. There's a grace range of 20 degrees either way
since that seems like it makes sense.

For 90 degree rotation (or 270 degree) the wheel is left as-is, the
heuristics to guess what angle we want in this case is not clear enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00
Peter Hutterer
64af4beb6b fallback: remove write-only rotation.is_enabled variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00
Peter Hutterer
bee70901ec tools: add rotation support to debug-events and debug-gui
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00
Peter Hutterer
a328ada6ef test: carry the step as argument for arg testing
Simplifies things a bit since it makes it all more explicit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00
Peter Hutterer
a9f4fdde0e CI: update to use Fedora 38
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-20 09:51:49 +10:00
Peter Hutterer
861f01928a tools/debug-gui: fix a deprecated warning
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-20 09:51:49 +10:00
Peter Hutterer
c1ab44c566 tools: fix a few scan-build dead store warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-20 09:51:49 +10:00
Peter Hutterer
b4cf6e9baf CI: fix the rpm build job's Fedora version
We have the variable set, we just didn't use it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-20 09:04:57 +10:00
Peter Hutterer
8e34037dcd doc/user: add a section on natural scrolling
Just for completeness, turns out we were missing that one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-18 16:54:57 +10:00
Peter Hutterer
7073a39ec0 doc/user: fix documentation for rotation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-18 16:54:57 +10:00
Peter Hutterer
2432b6eeff tools: add a tool to update our Razer quirks for internal keyboards
openrazer keeps a convenient list of keyboard devices that belong to the
RazerBlade line and thus should be marked as internal by us. Let's
use that one.

This script git clones the current openrazer repo, imports the file we
need and then overwrites our current quirks file with the sorted list of
devices.

For the second part of this to work reliable we need a marker in the
quirks file that marks the start of autogenerated entries.

Heavily influenced by @danryu in !887.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-11 14:48:41 +10:00
Peter Hutterer
8a01c3423d quirks: sort the razer entries by PID
No functional changes here, this should help with adding autogenerated
entries since we no longer rely on the source order.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-11 14:43:46 +10:00
Robert Glossop
57f0354ee5 Disregard touchless clicks on flaky devices
Some touchpads, notably those on the Dell XPS 15 9500, are prone to registering
touchpad clicks when the case is sufficiently flexed. Ignore these by
disregarding any clicks that are registered without touchpad touch.

Signed-off-by: Rob Glossop <robgssp@gmail.com>
2023-04-11 02:00:52 +00:00
Peter Hutterer
7c84fb87e9 CI: remove unused meson-prep.sh and meson-test.sh scripts
From an earlier version of the b2c patches, before meson-build.sh got
updated to do what's required here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-11 00:13:08 +00:00
Hector Martin
4a8b5e6ec4 touchpad: Disable edge palm detection Apple touchpads
This hurts more than it helps, and users complain of dead trackpad
edges. Apple touchpads have fairly sophisticated internal palm rejection
algorithms going back many years, so let's just disable this one on
everything Apple.

Related to: #433 (need to figure out what other hardware may need this)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-06 16:34:20 +09:00
Hector Martin
d61d385951 evdev: Enable natural scrolling by default on Apple
As suggested by the comment itself. I think most users expect this.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-06 15:30:14 +09:00
Peter Hutterer
7ae3713a77 doc/user: the CI uses FEDORA_PACKAGES, not FEDORA_RPMS
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-04 08:56:47 +10:00
Peter Hutterer
898f80fa37 tablet: always enable touch arbitration with touchscreens/ext. touchpads
Right now for touch arbitration to work, we require the device group to
be the same (i.e. they're hanging off the same physical bus). That's not
always the case and statistically we have a lot more devices that have
a built-in tablet + touchscreen than we have Intuos-like external
tablets.

So let's default to the more common case - enabling arbitration with the
first touchscreen/external touchpad we find. If a subsequent device is
"better", swap it out. Right now, the only heuristic we have here is the
device group check but in the future we could get more precise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-30 05:53:23 +00:00
Peter Hutterer
c26c05b255 tablet: split out arbitration/rotation handling assignment
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-30 05:53:23 +00:00
Peter Hutterer
7e1ab13f89 test: move arbitration test into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-30 05:53:23 +00:00
Peter Hutterer
01a02d4033 fallback: don't double-map if any left-handed buttons are down
The key_count array for buttons records the logical button sent to the
client - for left-handed configurations that means a BTN_LEFT is
recorded as BTN_RIGHT.

When the device is suspended and we are releasing all keys we must thus
release the button code as-is without trying to map it again.

Fixes #881

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-29 16:37:24 +10:00
Peter Hutterer
41b16e6e4f CI: bump to latest ci-templates for a new ci-fairy
This version includes the (possible) fix for our CI picking up the wrong
range in the commit checks and failing the pipeline.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-29 06:03:04 +00:00
Peter Hutterer
40869bf11e test: minor cleanups
A whitespace fix, moving a check-related #define closer to the #include
and change a test that doesn't need a device to litest_add_no_device().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-29 11:14:27 +10:00
José Expósito
f8497bf176 doc: document libinput_device_tablet_pad_get_* error case
Like in libinput_device_switch_has_switch()'s documentation, document
the error case in libinput_device_tablet_pad_get_num_buttons(),
libinput_device_tablet_pad_get_num_rings() and
libinput_device_tablet_pad_get_num_strips().

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-03-25 19:33:05 +01:00
José Expósito
0b005eb64b libinput 1.23.0
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-03-25 18:59:47 +01:00
Peter Hutterer
b2f5925e62 quirks: add a bunch more Razer internal keyboards
Generated with the same script as the list from
commit 3dcfae3fb6.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-24 04:32:20 +00:00
Peter Hutterer
fbd8febc79 test: add a test to make sure we don't accidentally add Logitech receivers
IDs copied over from libratbag which has that same check, with C548
added.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-23 12:13:23 +10:00
Peter Hutterer
dcea365373 test: add a quicks file validation test
Now that we're Python ConfigParser compatible (again), we can check our
quirks file for things our actual parser doesn't care about, but that we
should honour. Right now that means that bustypes and vid/pid matches are
all spelled consistently.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-23 12:13:23 +10:00
Tobias Bengfort
ec0041f116 touchpad: rm dead tp_palm_tap_is_palm
This was added in 39f1125347
(https://bugs.freedesktop.org/show_bug.cgi?id=89625)

Later, a more sophisticated palm detection was implemented in
46eab97538
(https://bugs.freedesktop.org/show_bug.cgi?id=103210)

The only place where `tp_palm_tap_is_palm()` is called is if the more
sophisticated palm detection has already decided that this is not a palm,
so it should never return true.

Signed-off-by: Tobias Bengfort <tobias.bengfort@posteo.de>
2023-03-23 00:22:25 +00:00
Peter Hutterer
9422d72f97 test: comment two tap tests
This is confusing without any explanation - the first set of touches is
within the edge zone, the second set of touches is explicitly within the
software button area but not inside the edge zone. Let's add comments so
the intention is clear.

Same-ish for the clickfinger test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-22 16:16:59 +10:00
Peter Hutterer
c491e3b94d CI: make the ci-fairy commit check verbose
This way it prints the commit range which should help debug why it fails
when it does.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-22 14:27:36 +10:00
Peter Hutterer
2a3a116e05 test: drop the explicit -n auto to the tool options test
This script adds the option automatically where xdist is available.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-20 22:13:19 +00:00
Peter Hutterer
6bfd658173 tools: honor FDO_CI_CONCURRENT in the tools option parser
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-20 22:13:19 +00:00
Peter Hutterer
f276f3de54 quirks: change all 3-digit matches to zero-prefixed 4-digit matches
Time to get some standardization here!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-20 17:38:28 +00:00
Peter Hutterer
28a246188d quirks: fix duplicate section names
Our parser doesn't care about this, but let's stick to the proper format so
we can read those files with e.g. Python's ConfigParser

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-20 17:38:28 +00:00
José Expósito
74a94be8ed quirks: add a note to not quirk the Bolt Receiver
The Logitech Bolt Receiver can be used with multiple mice, but the
kernel exposes the same product ID for all of them.

Adding a quirk for the device trying to fix a specific mouse would
break other mice.

Since we avoided this problem during code review a couple of times [1]
[2] add a warning to avoid it in the future.

[1] https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/867#note_1759931
[2] https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/847#note_1725364
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-03-20 18:10:10 +01:00
Tobias Bengfort
1843a2dd0f doc/user: fix tap in palm exclusion zone
See 211bed2c25 and
79139ebcd1

Signed-off-by: Tobias Bengfort <tobias.bengfort@posteo.de>
2023-03-17 12:23:59 +01:00
Peter Hutterer
8b7320b8fa test: give the generic MT touchscreen realistic ranges
This way we can rely on physical coords on this screen being actually
meaningful. Not currently in use but future tests will use this touch
device as generic screen.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-17 14:04:58 +10:00
Peter Hutterer
f1e93b5159 CI: add new workflow rules
Required for pipelines to run after some infrastructure changes, see
https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/438

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-15 09:30:58 +10:00
Peter Hutterer
da58d59b99 CI: update to latest ci-templates
The commit fixes linebreaks at the end of the files for files generated
with ci-fairy generate-templates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-03-15 09:30:58 +10:00
Yinon Burgansky
93135c2012 filter: add scroll movement type to the custom acceleration profile
Adds a dedicated scroll movement type to the custom acceleration profile.
Supported by physical mouse and touchpad.
Other profiles remain the same by using the same unaccelerated filter for the scroll filter.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2023-02-24 13:01:34 +02:00
José Expósito
6c88d9a251 quirks: fix DWT on Legion 5i
The keyboard present on this device is not recognized as internal and
disable while typing does not work.

Add a quirk to fix this feature.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/848
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-02-13 02:44:20 +00:00
Peter Hutterer
b044b5fae1 gitlab CI: explicitly run the test in the systemd service
This shouldn't have functional changes because MESON_TEST_ARGS was set
for all our b2c/qemu tests and thus the tests would run automatically.
To make this script more generic, specify --run-test explicitly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-13 09:43:47 +10:00
Peter Hutterer
c739cc7b41 gitlab CI: remove a leftover use of a fedora image
This is overridden by the template users anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-13 09:43:47 +10:00
Peter Hutterer
9a12a447ec gitlab CI: drop comment about weekly rebuild of images
This was disabled many moons ago, pre the b2c work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-13 09:43:47 +10:00
Peter Hutterer
ba3ddc9e2d CI: bump to use Fedora 37
This was delayed by https://github.com/systemd/systemd/pull/25941 which
is now available in F37 as of v251.11

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-13 09:07:00 +10:00
Aksel Stokseth
9764d1f362 add quirks for Logitech MX Master 3B
Signed-off-by: Aksel Stokseth aksel.stokseth@gmail.com
2023-02-09 04:59:51 +00:00
Benjamin Tissoires
c40286bbf4 CI: bump b2c and kernel
Same than https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/106
We need to upgrade to a newer boot2container

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2023-02-08 11:01:13 +00:00
Tobias Bengfort
9bb2136bab filter: simplify speed_factor()
The `speed_factor()` formula is unnecessarily complex, The behavior that is described in the comment can be achieved with a simple power function.

And adjust the comment to explicitly state that 0.05 is the minimum.
2023-02-08 10:56:48 +00:00
Marge Yang
74415b13fb quirks: Dell Mayabay (Pressure Pad).
Signed-off-by: Marge Yang <marge.yang@synaptics.corp-partner.google.com>
2023-02-08 08:05:37 +00:00
hrdl
5d7fc54c22 evdev: apply calibration for touch arbitration
Rectangle-based touch arbitration should respect calibration. This
fixes #853.

Signed-off-by: hrdl <git@hrdl.eu>
2023-02-08 03:57:18 +00:00
hrdl
1e64d52fe9 evdev-tablet: clip touch arbitration rectangle
Previously the arbitration rectangle would be moved to lie completely in
the first quadrant of the coordinate system.

Signed-off-by: hrdl <51402-hrdl@users.noreply.gitlab.freedesktop.org>
2023-02-07 11:26:27 +01:00
gogogoghost
c855012ddb quirk: Google Chromebook Atlas (Pixelbook go)
Signed-off-by: Jax Leach <heiguiyj@gmail.com>
2023-02-06 18:23:31 +00:00
Peter Hutterer
41e7caac48 tools: add --replay-after and --once to libinput replay
For the cases where it's not possible to hit enter to start the replay
because e.g. we cannot change focus, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-02-06 18:02:58 +00:00
Bill A
bb21327efe quirks: add generic quirk for Dell 2-in-1 models for side volume buttons
Signed-off-by: Bill A's avatarBill A <vukk.euob@gmail.com>
2023-02-06 17:46:01 +00:00
Yinon Burgansky
886f1c6767 filter: validate custom acceleration function's points size
Adds min and max size limit for custom acceleration function's points.
Adds tests to make sure validation works properly.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2023-02-02 04:56:18 +00:00
Diep Pham
32c0af17f0 quirk: Lenovo P14s Gen 1 AMD Trackpoint 2023-01-28 16:06:06 +00:00
José Expósito
f668e827e4 doc/user: fix trackpoint quirks path
Fix a small typo in the file name.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/851
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-01-23 18:44:59 +00:00
Cyril LEVIS
32c9bdcccc fix: add apple m2 keyboard quirks
this fix dwt https://github.com/AsahiLinux/linux/issues/103

Signed-off-by: Cyril Levis <git@levis.name>
2023-01-23 18:23:13 +00:00
Richard Stefun
6e1be53df5 Improve X280 support
Signed-off-by: Richard Stefun <richard.stefun@icloud.com>
2023-01-23 15:17:08 +01:00
Zhangyuan Nie
3b1f86c7c6 quicks: invert horizontal scrolling for Logitech MX Master 3S
Signed-off-by: Zhangyuan Nie <yuan@znie.org>
2023-01-17 06:40:06 +00:00
Peter Hutterer
bf2e8a406e doc/user: fix sphinx warning
WARNING: extlinks: Sphinx-6.0 will require a caption string to contain
exactly one '%s' and all other '%' need to be escaped as '%%'.

Well, let's do that then!

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-17 12:29:25 +10:00
Yinon Burgansky
5324f425a1 Introduce custom acceleration profile
The custom acceleration profile allow the user to define custom
acceleration functions for each movement type per device, giving
full control over accelerations behavior at different speeds.

This commit introduces 2 movement types which corresponds to the
2 profiles currently in use by libinput.

regular filter is Motion type.
constant filter is Fallback type.

This allows possible expansion of new movement types for the
different devices.

The custom pointer acceleration profile gives the user full control over the
acceleration behavior at different speeds.
The user needs to provide a custom acceleration function f(x) where
the x-axis is the device speed and the y-axis is the pointer speed.

The user should take into account the native device dpi and screen dpi in
order to achieve the desired behavior/feel of the acceleration.

The custom acceleration function is defined using n points which are spaced
uniformly along the x-axis, starting from 0 and continuing in constant steps.
There by the points defining the custom function are:
(0 * step, f[0]), (1 * step, f[1]), ..., ((n-1) * step, f[n-1])
where f is a list of n unitless values defining the acceleration
factor for each velocity.
When a velocity value does not lie exactly on those points, a linear
interpolation of the two closest points will be calculated.
When a velocity value is greater than the max point defined, a linear
extrapolation of the two biggest points will be calculated.

Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-17 01:46:17 +00:00
Peter Hutterer
ee3330491d doc/api: set HAVE_DOT to YES
dot is required in meson.build, so we can hardcoded it here

Fixes: libinput/build/doc/api/libinput.h:4087: warning: ignoring \dot command because HAVE_DOT is not set

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-17 10:54:10 +10:00
Peter Hutterer
d199c6d8c1 filter: add helper functions to create/destroy a delta smoothener
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-17 10:51:33 +10:00
José Expósito
1d7172488d quirks: touchpad: add ModelPressurePad
Unlike in traditional touchpads, whose pressure value equals contact
size, on pressure pads pressure is a real physical axis.

We don't take advantage of the pressure information reported by
pressure pads yet, so we disable it to avoid errors.

Add a new model quirk for pressure pads instead of disabling
ABS_MT_PRESSURE and ABS_PRESSURE.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-01-16 19:22:04 +01:00
Peter Hutterer
0266428c93 tools: fflush the output in debug-events after each set of events
Fixes e.g. the case where debug-events is used to get the initial device
list but no more. Since we never flush, the content is stuck in the
buffers and gets lost.

Easy way to reproduce: `libinput debug-events | cat`, then ctrl+c and see
nothing show up (before this patch, anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-13 09:28:32 +10:00
Charles Wang
29a49e968e quirks: add quirks for Dell Precision5680 Touchpad
This touchpad is a pressure pad and needs the pressure
handling disable.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/849

Signed-off-by: Charles Wang <charles.goodix@gmail.com>
2023-01-12 10:02:35 +08:00
Peter Hutterer
31ecda7008 CI: use meson compile over ninja directly in meson-build.sh
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 10:16:33 +00:00
Peter Hutterer
48a1c47bc2 CI: make the meson-build.sh script even more generic
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 10:16:33 +00:00
Peter Hutterer
a858ed01b8 CI: give the meson-build.sh script a proper license tag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 10:16:33 +00:00
Peter Hutterer
54eea68296 meson.build: fix a deprecation warning
get_pkgconfig_variable is deprecated

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 13:22:07 +10:00
José Expósito
f185120936 quirks: add quirk for Dell Latitude 5290 2-in-1
Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/846
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-01-01 16:40:01 +01:00
Samuel Reddy
aed3fdb94b quirks: add quirks for Glorious Model O mouse
Signed-off-by: Samuel Reddy <samuelsumukhreddy@gmail.com>
2022-12-23 19:13:10 +11:00
José Expósito
7bfdf52db2 tools/record: fix quirk error message
When libinput-record fails to parse the quirks, it suggest to use the
--verbose flag to get more details. However, libinput-record does not
support the --verbose flag.

Replace the error message and add a link to the documentation instead.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-12-12 19:17:01 +01:00
Simon Ser
ea9db278f3 build: override dependency for use as subproject
Allows e.g. compositors to setup libinput as a subproject. Makes
it easier to ad support for libinput features which haven't been
released yet.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-12-09 11:17:33 +01:00
Peter Hutterer
69fe6f37cd doc/user: document the new list-kernel-devices tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-09 13:16:38 +10:00
Peter Hutterer
e6a5c4e175 tools: add a --hid toggle to libinput-list-kernel-devices
Lists all SUBSYSTEM=hid devices, including the respective hidraw and
evdev nodes.

Note that this takes a shortcut in the udev handling: in theory we
*should* compare the hidraw/evdev parent device with our hid device. In
practice, checking if the devpath starts with the same substring is good
enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-08 10:08:44 +10:00
Peter Hutterer
1250407c7c tools: add a libinput list-kernel-devices tool
Same as libinput list-devices, but lists the available event nodes. This
effectively does the same as libinput record without arguments but it's
more obvious in what it is supposed to do and thus easier to point to.

Also, it uses pyudev instead of libevdev so it does not need to run as
root to discover devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-08 10:08:44 +10:00
Lucas Zampieri
fb8d285566 Allow rotation on all mice and for any angle
Previously we restricted rotation to trackballs only and to multiples 
of 90 degrees. Update rotation allow angles other than multiples of 90.

Also enable rotation on all mice. The only devices without rotation
are now pointing sticks.

Fixes #827

Signed-off-by: Lucas Zampieri <lzampier@redhat.com>
2022-12-05 22:57:51 +00:00
Peter Hutterer
38dbfe41a1 evdev: only read the trackpoint multiplier on trackpoints
Check the tag before we read any multiplier quirks. And don't bother
reading the DPI for trackpoints either because it doesn't make sense for
those devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-12-05 14:38:25 +10:00
José Expósito
3fd9b3fbc6 quirks: add quirks for Positivo-Vaio touchpad
The generic quirk introduced in commit d1f274c781 ("quirks: add a
more generic match for the 5288 Synaptics clickpad") affects the
touchpad (with physical buttons) present in the Positivo-Vaio.

Fixes #819
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-28 11:26:47 +01:00
Peter Hutterer
a7e4cbc212 quirks: allow overriding of AttrEventCode and AttrInputProp
This switches the quirk from AttrEventCodeEnable/Disable to just
AttrEventCode with a +/- prefix for each entry.
This switches the quirk from AttrInputPropEnable/Disable to just
AttrInputProp with a +/- prefix for each entry.

Previously, both event codes and input props would only apply the
last-matching section entry for a device. Furthermore, an earlier Disable entry
would take precedence over a later Enable entry. For example, a set of
sections with these lines *should* enable left, right and middle:

  [first]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;BTN_MIDDLE

  [second]
  AttrEventCodeDisable=BTN_RIGHT

  [third]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;

Alas: the first line was effectively ignored (quirks only returned the
last-matching one, i.e. the one from "third"). And due to implementation
details in evdev.c, the Disable attribute was processed after Enable,
i.e. the device was enabled for left + right and then disabled for
right. As a result, the device only had BTN_LEFT enabled.

Fix this by changing the attribute to carry both enable/disable
information and merging the commands together.

Internally, all quirks matching a device are simply ref'd into an array
in the struct quirks. The applied value is simply the last entry in the
array corresponding to our quirk.

For AttrEventCode and AttrInputProp instead do this:
- switch them to a tuple with the code as first entry and a boolean
  enable/disable as second entry
- if the struct quirk already has an entry for either, append the more
  recent one to the existing entry (instead of creating a new entry in
  the array). This way we have all entries that match and in-order of
  precedence - i.e. we can process them left-to-right to end up
  with the right state.

Fixes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/821

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-28 08:25:41 +10:00
Peter Hutterer
bb6ff0ec00 gitlab CI: add a job to check for whitespace issues
Trailing whitespaces and tab after a space are a no-go.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
6ae0d1bac4 tools: fix a tab after space whitespace issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
a5dd45e8ce Remove duplicate empty lines in our source
We only touch src and tools, imported headers from include are not ours
to change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
d2f6773831 Remove a few empty lines with nothing but a lonely tab
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
Peter Hutterer
703ecb200c Remove trailing whitespaces in the tree
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-25 10:08:20 +10:00
José Expósito
96e57b5eff tablet: increase touch arbitration rectangle height
A user was experiencing issues with their hand being recognized as
touch input above the stylus tip.

Since touch above the stylus should be rare, increase the touch
arbitration rectangle height by 50mm.

Fix: https://gitlab.freedesktop.org/libinput/libinput/-/issues/809
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 22:39:02 +00:00
José Expósito
8a6ca3c1c5 sparse: make some variables static
When compiling with Sparse enabled:

	$ CC=cgcc meson builddir

Fix warnings about variables that should be made static.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 21:57:28 +00:00
José Expósito
41e61c1c13 test: fix uninitialized variables
Fix the warnings generated:

	[232/243] Compiling C object libinput-test-suite.p/test_test-pad.c.o
	../test/test-pad.c:211:3: warning: variable 'count' is uninitialized
	when used here [-Wuninitialized]
		        count++;
		        ^~~~~
	../test/test-pad.c:261:3: warning: variable 'count' is uninitialized
	when used here [-Wuninitialized]
		        count++;
		        ^~~~~

When building with Clang v15 and without libwacom:

	$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 18:50:38 +01:00
José Expósito
3726de351d test: fix compiler warning when -Dlibwacom=false
Fix the warning generated:

	[129/243] Compiling C object libinput-test-suite.p/test_test-touchpad.c.o
	../test/test-touchpad.c:2679:1: warning: unused
	function 'touchpad_has_rotation' [-Wunused-function]
	touchpad_has_rotation(struct libevdev *evdev)
	^

When building with Clang v15 and without libwacom:

	$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 18:47:32 +01:00
José Expósito
d84fc4ad11 tablet: fix compiler warning when -Dlibwacom=false
Fix the warning generated:

	[82/243] Compiling C object libinput.so.10.13.0.p/src_evdev-tablet.c.o
	../src/evdev-tablet.c:938:1: warning: unused function
	'tool_set_bits_from_libwacom' [-Wunused-function]
	tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
	^

When building with Clang v15 and without libwacom:

	$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 18:42:34 +01:00
José Expósito
49227bf2de tablet-pad-leds: fix compiler warning when -Dlibwacom=false
Fix the warnings generated:

	../src/evdev-tablet-pad-leds.c:54:1: warning: unused function
	'pad_mode_toggle_button_new' [-Wunused-function]
	pad_mode_toggle_button_new(struct pad_dispatch *pad,
	^

	../src/evdev-tablet-pad-leds.c:194:1: warning: unused function
	'pad_group_new' [-Wunused-function]
	pad_group_new(struct pad_dispatch *pad,
	^

	../src/evdev-tablet-pad-leds.c:238:1: warning: unused function
	'pad_led_get_sysfs_base_path' [-Wunused-function]
	pad_led_get_sysfs_base_path(struct evdev_device *device,
	^

When building with Clang v15 and without libwacom:

	$ CC=clang CXX=clang++ meson builddir -Dlibwacom=false

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 18:32:11 +01:00
José Expósito
4f6949cf2c test: remove unused variable
Fix warning building with Clang v15:

	../test/test-pad.c:334:15: warning: variable 'expected_number'
	set but not used [-Wunused-but-set-variable]
		unsigned int expected_number = 0;

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-23 18:28:01 +01:00
Hector Martin
c2b420c793 quirks: Add Apple MTP touchpad quirk
Apple M2 (and presumably newer) laptops now embed the touchpad
controller into the main SoC, and use a new internal communications
protocol between it and the main CPU. This isn't really a "bus" like
SPI or I2C, so the downstream kernel driver currently uses the (not
well supported) HOST bus type. MatchBus can't match on that, so let's
just use a name match (plus the vendor ID, which is still valid and
the usual Apple one).

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-11-22 23:48:01 +00:00
Peter Hutterer
2f3e943e14 test: print the usage from the symbols-leak-test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-22 19:02:03 +00:00
Peter Hutterer
5db44d9b68 doc/user: explicitly specify language as en
Unlikely we'll ever have the docs fully translated (or translated at
all...) anyway.

Fixes "WARNING: Invalid configuration value found: 'language = None'.
Update your configuration to a valid language code. Falling back to 'en'
(English)."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-22 14:26:44 +10:00
José Expósito
fc59e574e0 libinput 1.22.0
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-19 12:21:06 +01:00
Peter Hutterer
70a79069f1 gitlab CI: pre-install all packages we need
Running "dnf install" during a job can lead to issues when the image is
old - package renames/replacements/etc. may require a dnf upgrade to get
those packages sorted first before our dnf install works.

This hasn't been a problem for us because we had weekly rebuilds of the
images scheduled and were usually on the latest package set but let's do
this properly anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-16 09:00:25 +10:00
Peter Hutterer
56b9cac865 gitlab CI: update freebsd to 13.1
This gets rid of of the following error:
  ld-elf.so.1: /lib/libc.so.7: version FBSD_1.7 required by /usr/local/lib/libpython3.9.so.1.0 not found

Too tired to debug what is really going on, so let's pretend the update
is the best way to fix this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-16 09:00:22 +10:00
Peter Hutterer
44f42dc970 gitlab CI: don't install valgrind, it's already in the template
This has been a noop for quite a while, so we might as well skip it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-15 08:56:53 +10:00
José Expósito
0da2d0095c touchpad: add escape and asterisk to the DWT blacklist
The escape key can be used to cancel a drag and drop action in some
desktop environments. However, it triggers disable-while-typing, ending
the drag and drop action rather than cancelling it.

Add it to the tp_key_ignore_for_dwt() set to avoid it.

Since I'm here, add the asterisk key as it is the only numpad key not
ignored by tp_key_ignore_for_dwt().

Fix: https://gitlab.freedesktop.org/libinput/libinput/-/issues/820  # [1]
Suggested-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-14 19:11:12 +01:00
José Expósito
955a9cc338 util: use ck_assert_ptr_eq() instead of ck_assert_ptr_null()
The ck_assert_ptr_null() function is not available in the version of
the check library included in 20.04 LTS Focal (0.10.0).

Use ck_assert_ptr_eq() to avoid compilation errors.

Fixes: eeae8906db ("util: return the number of elements from strv_from_string")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-11-14 19:11:12 +01:00
Yinon Burgansky
eeae8906db util: return the number of elements from strv_from_string
Signed-off-by: Yinon Burgansky <51504-Yinon@users.noreply.gitlab.freedesktop.org>
2022-11-07 22:32:24 +02:00
José Expósito
e8732802b7 debug-gui: avoid locking pointer twice
On Sway, and probably other Wayland compositors based on wlroots, the
window_lock_pointer() was called twice.

Avoid errors when window_lock_pointer() is invoked multiple times.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/808
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-10-10 08:46:30 +00:00
José Expósito
9c789cc254 tools: hide debug-gui help when building with -Ddebug-gui=false
Some distributions, like Fedora, compile libinput with the debug-gui
option set to false.

Running "libinput debug-gui" indicates that the program is not
installed; however, the help message suggests that  the command is
available.

Hide debug-gui from the help message when it is not included.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/480
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-10-10 08:27:05 +02:00
José Expósito
e9a1999a7f meson.build: always set HAVE_GTK_WAYLAND
In commit 6a1bd5b0c9 ("meson.build: check gtk targets before
building") introduced a custom config option to check whether Wayland
is supported by GTK or not.

However, in some cases the config option is not set generating this
warning:

    ../tools/libinput-debug-gui.c:51:5: warning: "HAVE_GTK_WAYLAND" is
    not defined, evaluates to 0 [-Wundef]
       51 | #if HAVE_GTK_WAYLAND
          |     ^~~~~~~~~~~~~~~~

Make sure to always set HAVE_GTK_WAYLAND.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-10-09 20:07:59 +02:00
José Expósito
640208531c tablet: avoid errors calling libevdev_get_abs_info()
Commit 806d4a1393 ("tablet: check libevdev_get_abs_info() return
value") prevented a crash when tilt was deactivated by a quirk.
For more information check [1].

Add similar checks before calling libevdev_get_abs_info() to avoid
possible crashes.

[1] https://gitlab.freedesktop.org/libinput/libinput/-/issues/805
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-10-03 12:53:22 +02:00
Tadhg McDonald-Jensen
7d29e2d616 Fix Framework quirk so it wirks with 12 gen intel
Removes a colon from frameworks quirks dmi match
so it matches pnLaptop(12thGenIntelCore) on newer model

Signed-off-by: Tadhg McDonald-Jensen <tadhgmister@gmail.com>
2022-09-23 14:03:39 -04:00
José Expósito
806d4a1393 tablet: check libevdev_get_abs_info() return value
Commit b5f0536a4f ("quirks: add a quirk for the Wacom 524c device")
added the quirk "AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;" to the
Wacom 524c.

When using the pen in a display with tilt support, the tilt X/Y axes
are set as changed. Using the pen again, but this time in the display
without tilt support, will try to get the tilt information, crashing.

Check the return value of libevdev_get_abs_info() to avoid this crash.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/805
Fixes: b5f0536a4f ("quirks: add a quirk for the Wacom 524c device")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-09-18 16:00:26 +02:00
Peter Hutterer
ad71c74885 filter: add a flat trackpoint accel
Previously, trackpoints got assigned the normal flat profile which does not
accommodate for the trackpoint magic multiplier *and* had a config range
that was too small if you take the multiplire indo account anyway.

Fix this by adding a trackpoint-specific flat accel that has a wider
configuration range and take sthe magic multiplier into account.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
7ba0af575b filter: apply the same factor for constant motion as for normal motion
Users that want a flat pointer acceleration want the input speed to
match 1:1 to the output speed, barring a fixed constant multiplier.
This will apply to things like button scrolling as well, so let's map
the constant accel function to the non-constant accel functions to the
speed setting applies to every movement.

This is applied to both the flat and the touchpad flat filter.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
49707691c8 filter: don't normalize the speed again in the default mouse filter
The first thing this filter does is normalize the coordinates to
1000dpi, i.e. all other values are in normalized coordinates.

By normalizing the speed again we get an invalid value, effectively
stretching or compressing the acceleration curve. e.g. on a 5000dpi
mouse the estimated speed was 1/5 of the real speed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
f87fffd193 evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel"
Rather than normalizing manually, leave this up to the pointer acceleration
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
f80b142dc3 evdev: use filter_dispatch_constant() for button scrolling
Our pointer filter code has two functions - one for accelerated movement
and one for "constant" movement (i.e. no accel factor provided but same
conversions). Let's use that instead of a manual normalization.

This fixes an issue with button scrolling on high-dpi mice in the flat
pointer acceleration: normal pointer motion in the flat profile isn't
normalized but the button scrolling was - resulting in e.g. 5 times
slower motion for button scrolling on a 5000dpi mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
cef91f5b43 filter: don't normalize the const filter approach
The filter vs const filter is supposed to be for accelerated vs
non-accelerated motion (e.g. pointer motion vs scrolling) - in both
cases the returned value is supposed to be in the same coordinate
system, just once with an extra accel factor applied.

This was broken in the flat and low-dpi profiles: in both of those the
accelerated filter does *not* normalize, it merely applies the fixed/adaptive factor.
The constant filter normalized however. The result was that on e.g. a
5000dpi mouse the constant motion was 5 times slower than the
accelerated motion, even with a factor of 1.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
fc1a28951a filter: constify the interfaces and make them static
No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
0bb82faab1 evdev: rename post_trackpoint_scroll to post_button_scroll
This is no longer trackpoint-only, so let's rename this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
e59dc2ec58 filter: localize a few variables
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
528f09a969 filter: constify the tracker API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
b6e1f5d120 filter: remove an unnecessary layer of indirection
This is a leftover from when some of the filter code was shared between
pointer acceleration methods (pre v1.11 or so). Now these functions are
duplicated across files, so both the names and what they do isn't
necessarily reflective anymore.

Let's drop one layer of indirection to make the code a bit easier to
understand.

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
87c769f3f2 filter: fix the mix of normalized vs device coordinates
No functional changes, this is just for improving readability and a
leftover when some of these functions were used by multiple filters.

This filter normalizes the data first, then applies the acceleration to
the normalized values. So let's keep the data in normalized_coords
structs and only drop to device_float_coords when we have to to use the
tracker API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
9179acd638 filter: a few whitespace fixes and extra comments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-08 09:03:15 +10:00
Peter Hutterer
70c57e9644 CI: drop the job count for the valgrind test suite to 2
Too many timing-related failures with 4 or (the default) 8 jobs, clearly
our runners aren't fast enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-09-02 08:41:34 +02:00
Benjamin Tissoires
24956221b9 CI: in b2c, compile on the host, then test in qemu
Looks like we are having clock skew issues on qemu, so given that
we just need qemu in the image, we can compile on the host (reliable)
and then only start the tests in qemu.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2022-09-02 08:41:28 +02:00
Benjamin Tissoires
a034a9f66b CI: start a full systemd environment before running the testsuite
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2022-09-02 08:39:44 +02:00
Benjamin Tissoires
46df4f588c CI: include systemd-udev in the fedora image
This will allow us to have the udevadm tool and systemd-udevd available
while running inside qemu

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2022-09-02 08:39:43 +02:00
Benjamin Tissoires
1ccbeabb0b CI: rely on b2c to start qemu tests
This allows us to not have to create a specific image, and also
should be more reliable because we don't have to boot a full distribution
each time we just start our test suite.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2022-09-02 08:39:42 +02:00
Benjamin Tissoires
fb4f4131a1 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>
2022-09-01 10:18:18 +10:00
Benjamin Tissoires
bafffb7ecb 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>
2022-09-01 09:39:12 +10:00
Benjamin Tissoires
553092ea93 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>
2022-09-01 09:39:02 +10:00
Benjamin Tissoires
0d602e12a4 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>
2022-09-01 09:38:49 +10:00
Benjamin Tissoires
c8c825289f CI: prettify the include of templates
Makes the resulting file easier to read

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2022-09-01 09:38:46 +10:00
Peter Hutterer
6c2e98e40d 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>
2022-08-31 16:01:26 +10:00
Peter Hutterer
30776d670b gitlab-ci: explicitly call "meson setup" to improve readability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-08-31 15:41:35 +10:00
Peter Hutterer
4177093d49 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>
2022-08-31 15:37:37 +10:00
Peter Hutterer
c16844d1b2 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>
2022-08-23 13:23:37 +10:00
Leonard Lausen
6efc4aa05c quirks: add generic quirks for ARM based chromebooks
Signed-off-by: Leonard Lausen <leonard@lausen.nl>
2022-08-22 00:48:18 +00:00
Leonard Lausen
62f8b53316 quirks: add quirks for Acer Spin 513 (Lazor)
Signed-off-by: Leonard Lausen <leonard@lausen.nl>
2022-08-15 16:22:28 +00:00
Peter Hutterer
507b0a38b3 tools: add missing dwtp option setting
Fixes 1f1ddbc6df

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-08-08 13:57:13 +10:00
Peter Hutterer
45db4ceb49 gitlab ci: drop EOL'd ubuntu 21.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-08-03 13:43:32 +10:00
Boris Pek
187ec90bb2 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>
2022-07-18 11:06:22 +03:00
Peter Hutterer
91610165d9 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>
2022-07-15 10:47:13 +10:00
José Expósito
71f79b9de1 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>
2022-07-12 19:44:59 +02:00
Peter Hutterer
368b12ad45 evdev: fix a tab vs space indentation issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-07-12 10:00:24 +00:00
illiliti
05501cd34f 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>
2022-07-12 00:05:06 +00:00
Maximilian Luz
238a56eb7c 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>
2022-07-10 18:25:22 +00:00
Maximilian Luz
ad95d68f47 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>
2022-07-10 18:25:22 +00:00
Max Huber
d137c41319 quirks: add volume rocker quirk for Lenovo IdeaPad Duet 3i
Signed-off-by: Max Huber <ycbcr@disroot.org>
2022-07-10 15:22:24 +02:00
Dale A. Jackson
a2dc175c19
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>
2022-07-01 10:26:44 -07:00
Peter Hutterer
3475850084 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>
2022-06-29 14:37:58 +10:00
Peter Hutterer
68f39925ed 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>
2022-06-28 23:09:53 +00:00
Peter Hutterer
1f505ce2e9 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 6a1bd5b0c9
Fixes #786

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-06-28 23:09:53 +00:00
satrmb
4a202a95c0 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>
2022-06-28 13:22:25 +02:00
Peter Hutterer
6569938b1a 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>
2022-06-16 08:28:53 +10:00
Peter Hutterer
2d3eee76ad 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>
2022-06-14 13:11:14 +10:00
José Expósito
bc363328a7 libinput 1.21.0
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2022-06-11 13:47:52 +02:00
Peter Hutterer
7888ef2787 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>
2022-06-11 10:54:15 +00:00
Peter Hutterer
6a1bd5b0c9 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>
2022-06-11 10:54:15 +00:00
Peter Hutterer
3542023996 test: fix a typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-06-08 09:25:59 +10:00
Peter Hutterer
d833f265c0 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>
2022-06-08 09:25:02 +10:00
José Expósito
4ae72b6eb2 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: 6bb02aaf30 ("High-resolution scroll wheel support")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Tested-by: Peter Ganzhorn <peter.ganzhorn@gmail.com>
2022-06-07 19:55:42 +02:00
Peter Hutterer
7688f35477 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>
2022-06-07 12:42:50 +10:00
Peter Hutterer
164227d193 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>
2022-06-07 12:42:50 +10:00
satrmb
92233df57b 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>
2022-05-29 12:50:37 +02:00
Peter Hutterer
bfbcf1737b 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 61bdc05fb0 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>
2022-05-23 05:43:18 +00:00
Peter Hutterer
988329d5d9 tablet: use a helper variable to make the code more readable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-05-23 05:43:18 +00:00
Peter Hutterer
393442fd3a 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>
2022-05-23 05:43:18 +00:00
Peter Hutterer
374d32c6be 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>
2022-05-23 05:43:18 +00:00
José Expósito
a9e6cd03d0 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>
2022-05-18 23:17:35 +02:00
Sean Rhodes
4d26736e20 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>
2022-05-16 05:10:10 +00:00
Peter Hutterer
e0e0e3aa8f quirks: remove an unused quirk
Removed in b925a0878b
   quirks: switch the models with missing buttonpad to use the new attr

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-05-16 12:24:16 +10:00
Peter Hutterer
8cb2b47b7b quirks: move the canvas quirk enum to the right order
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-05-16 12:23:57 +10:00
Sean Rhodes
a6fa862c00 quirks: Add quirk for StarLite Mk IV
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2022-05-09 18:26:05 +02:00
Peter Hutterer
5dd751a3d0 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>
2022-05-09 05:03:00 +00:00
Peter Hutterer
43a8d769ac 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 be7045cdc7
  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>
2022-05-09 05:03:00 +00:00
Peter Hutterer
d48c7e72f7 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>
2022-05-06 14:25:50 +10:00
Peter Hutterer
4ac5fd9e24 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>
2022-05-06 14:05:13 +10:00
Peter Hutterer
200bc920ac tools/record: fix indentation for libinput events
Commit 0cdf459643
  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 0cdf459643

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-05-06 14:04:59 +10:00
Peter Hutterer
f22d193879 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>
2022-05-04 17:32:27 +00:00
Peter Hutterer
509747c01b 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>
2022-05-04 17:32:27 +00:00
Alexander Courtis
e0813f4825 AttrLidSwitchReliability quirk default unreliable->reliable 2022-04-26 01:55:22 +00:00
Peter Hutterer
a423d7d326 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>
2022-04-20 13:32:31 +10:00
Peter Hutterer
a6ec596467 tools/record: fix the indentation of the system: section
Fixes 0cdf459643

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-04-07 14:46:57 +10:00
Tom Stellard
bdd2c9b76f 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>
2022-04-05 17:22:42 -07:00
Peter Hutterer
3d064a07f8 doc/user: add a page to troubleshoot right-click Clickpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-03-28 23:25:26 +00:00
Peter Hutterer
423bb6455f 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>
2022-03-28 21:41:58 +00:00
Peter Hutterer
f917661980 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>
2022-03-28 21:41:58 +00:00
José Expósito
321458576d 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>
2022-03-28 12:44:55 +02:00
Peter Hutterer
395d12d634 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>
2022-03-09 10:16:07 +10:00
pudiva chip líquida
1f1ddbc6df 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>
2022-03-08 01:33:40 +00:00
José Expósito
602e8dcb99 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>
2022-03-02 11:01:14 +00:00
José Expósito
5664007013 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>
2022-03-02 08:35:23 +01:00
José Expósito
ea568a7bcb 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>
2022-03-02 08:21:49 +01:00
Peter Hutterer
2e7dd3f84e gitlab CI: fail the sanity check stage if the fork is not public
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-02-24 10:21:53 +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
Peter Hutterer
ac385e12dc libinput 1.19.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-10-21 14:19:49 +10:00
A-w-x
74fac6d040 quirks: add quirk for GPD Win Max
clickpad that announces BTN_RIGHT

Signed-off-by: A-w-x <awxkrnl@gmail.com>
2021-10-20 16:18:33 +02:00
Peter Hutterer
e2d4e0552a test: use a plain libinput context for the log priority check
Don't use the litest wrapper context here, it changes log priority if
the test suite is run with --verbose, causing the test to fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-10-19 13:05:00 +10:00
Travis Wrightsman
9b77661e02 quirks: relax DMI modalias match for Purism Librem 14v1
Both "svnPurism:pnLibrem14:" and "svnPurism:pnlibrem_14:" are possible

Signed-off-by: Travis Wrightsman <travis@wrightsman.org>
2021-10-11 19:23:20 -04:00
Eduardo de Souza Cruz
f5c20fe6b3 evdev: avoid usage of bogus BTN_FORWARD name
Signed-off-by: Eduardo Cruz <eduardo.cruz@kdemail.net>
2021-10-11 17:43:26 -03:00
Sean Rhodes
f2d110dfc5 quirks: Update dmi for StarBook Mk V
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-11 07:19:39 +00:00
Eduardo de Souza Cruz
34bab6e15e evdev: disable button scroll timeout for extra mouse buttons
Signed-off-by: Eduardo Cruz <eduardo.cruz@kdemail.net>
2021-10-10 23:32:36 +00:00
José Expósito
cf929e9835 gestures: avoid processing the last hold and motion event twice
During the transition from GESTURE_STATE_HOLD_AND_MOTION to
GESTURE_STATE_POINTER_MOTION the last pointer motion event was
processed twice.

Fix #680

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-10-07 08:34:43 +02:00
Sean Rhodes
89cd0f990e quirks: Add quirk for StarLabs clickpads with two phyisical buttons
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
2021-10-04 10:19:52 +01:00
Peter Hutterer
b3e5846410 libinput 1.19.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-28 08:46:37 +10:00
José Expósito
5bda716ebf fallback: hires scroll heuristics for buggy devices
Some devices might announce support for high-resolution scroll wheel
by enabling REL_WHEEL_HI_RES and/or REL_HWHEEL_HI_RES but never send
a high-resolution scroll event.

When the first low-resolution scroll event is received without any
previous high-resolution event, print a kernel bug warning and start
emulating high-resolution scroll events.

Fix #668

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-27 22:43:22 +00:00
José Expósito
e0aa946e39 test: add kernel bugs to log handler
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-27 22:43:22 +00:00
Peter Hutterer
bad8b73617 quirks: update the Dell N5110 touchpad quirk
Later versions of this same model seem to have a different ALPS touchpad
and don't need the pressure settings. Narrow down this match so we only
apply to the one from the actual bug report in #565.

Fixes #676

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-28 08:13:54 +10:00
Peter Hutterer
bf61ab9bb0 quirks: add quirk for the Prestigio Smartbook 141 C2 touchpad
Fixes #674

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-27 05:56:37 +10:00
José Expósito
f0d3761f73 libinput: add hold to get base event
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN and LIBINPUT_EVENT_GESTURE_HOLD_END
were missing from libinput_event_gesture_get_base_event.

Add them to avoid triggering an erroneous client bug warning.

Fix #671

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-24 19:06:53 +02:00
José Expósito
ceda09e87b evdev: v120 scroll: invert horizontal scrolling quirk
When required, invert horizontal scrolling in evdev_notify_axis_wheel
following the QUIRK_MODEL_INVERT_HORIZONTAL_SCROLLING quirk.

Fix #669

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-21 19:21:03 +02:00
Peter Hutterer
b6e8aef4fb touchpad: mark USB touchpads as internal by default
External touchpads using USB are vanishingly few, built-in touchpads
that use USB are comparatively common. So let's default to internal,
for vendors like Logitech and Wacom that only make external touchpads we
have special conditions in place anyway.

Fixes #664

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-21 09:28:18 +10:00
Peter Hutterer
ea7a88d213 touchpad: use the model flags to determine internal vs external
When pairing a trackpoint, use the model flags for the touchpad, don't
use a separate set of conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-21 09:28:18 +10:00
José Expósito
5f966dc6c6 doc: guarantee end sequence for continuous scroll
GTK handles LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS as
GDK_SCROLL_SMOOTH, the same event type that is used to handle
LIBINPUT_EVENT_POINTER_SCROLL_FINGER.

Because Mutter and other compositors, like wlroots based compositors,
translate libinput terminating event to axis_stop instead of doing their
own emulation, if libinput stops sending terminating events, it will
cause client bugs.

Since libinput always sends the terminating event for trackpoints and
button scrolling and there are even tests in place to check for them,
update the documentation to guarantee the terminating scroll sequence.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-19 21:32:59 +02:00
Peter Hutterer
77b36de85d touchpad: reduce the jumping cursor warnings to 5 per day
It's been a while since we really could do something about those jumps,
so let's assume most of these are informative and not a bug in libinput.
For that let's not spam the user's journal and ratelimit it to a handful
a day.

Per day because that increases the chance of an error being present in
the recent logs if the user does search for it.

Related #663

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-17 09:03:17 +10:00
Peter Hutterer
6c869071fb touchpad: fix leak when the touchpad is removed before the dwt keyboard
If a touchpad is removed before its dwt-paired keyboard, we're leaking
the keyboard struct. Fix this by cleaning up properly when our device is
removed.

This is the cause of many failed tests in the udev backend tests during
the CI valgrind run. Because we're testing the udev backend it will add
any devices created by tests run in parallel, some of which are keyboard
devices. Depening on the test completions, the keyboards may or may not
get removed before this device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-15 09:03:21 +10:00
Peter Hutterer
ca0c2470d7 libinput 1.19.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-14 17:52:56 +10:00
José Expósito
c9483a6a82 quirks: no button debouncing on generic emulated mouse
When the kernel doesn't support a touchpad, the device is handled as a
generic mouse named "ImPS/2 Generic Wheel Mouse".
Taps are handled as button clicks and the button debouncing code makes
it difficult to double click.

Add a quirk to disable button debouncing for this devices.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/656

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-12 21:51:53 +00:00
José Expósito
dbcb003c5e util: add a function to parse bool properties
Move the logic used to parse boolean quirks and udev flags to a common
function in utils.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-12 21:16:32 +00:00
weizhixiang
d808817614 use ARRAY_FOR_EACH when traverse array
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
2021-09-12 15:58:16 +00:00
José Expósito
e4f9c6185b quirks: Microsoft Surface Pro 3 Cover
Mark the Microsoft Surface Pro 3 Cover keyboard as internal.

Fix https://gitlab.freedesktop.org/libinput/libinput/-/issues/655

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-06 18:51:01 +02:00
José Expósito
1d6c38782f doc: add missing literal blocks in contributing
Add missing literal blocks in the section "Failed pipeline errors"
introduced in 140b4b7853.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-09-06 08:42:28 +02:00
Clayton Craft
c053d7b078
quirks: Pine64 PineBook Pro keyboard
The keyboard is 'internal' (built-in), and attached over usb.

Signed-off-by: Clayton Craft <clayton@craftyguy.net>
2021-09-05 14:05:24 -07:00
Peter Hutterer
01cccd8387 libinput 1.18.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-09-01 14:09:26 +10:00
Peter Hutterer
6bb02aaf30 High-resolution scroll wheel support
Starting with kernel v5.0 two new axes are available for high-resolution wheel
scrolling: REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES. Both axes send data in
fractions of 120 where each multiple of 120 amounts to one logical scroll
event. Fractions of 120 indicate a wheel movement less than one detent.

This commit adds a new API for scroll events. Three new event types that encode
the axis source in the event type name and a new API to get a normalized-to-120
value that also used by Windows and the kernel (each multiple of 120 represents
a logical scroll click).

This addresses a main shortcoming with the existing API - it was unreliable to
calculate the click angle based on the axis value+discrete events and thus any
caller using the axis value alone would be left with some ambiguity. With the
v120 API it's now possible to (usually) calculate the click angle, but more
importantly it provides the simplest hw-independent way of scrolling by a
click or a fraction of a click.

A new event type is required, the only way to integrate the v120 value
otherwise was to start sending events with a discrete value of 0. This
would break existing xf86-input-libinput (divide by zero, fixed in 0.28.2) and
weston (general confusion). mutter, kwin are unaffected.

With the new API, the old POINTER_AXIS event are deprecated - callers should use
the new API where available and discard any POINTER_AXIS events.

Notable: REL_WHEEL/REL_HWHEEL are emulated by the kernel but there's no
guarantee that they'll come every accumulated 120 values, e.g. Logitech mice
often send events that don't add up to 120 per detent.

We use the kernel's wheel click emulation instead of doing our own.

libinput guarantees high-resolution events even on pre-5.0 kernels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-31 08:45:01 +02:00
José Expósito
427c855d21 test: refactor litest_assert_event_type logic
Extract the logic in litest_assert_event_type to a generic function,
litest_assert_event_type_is_one_of, that takes a variable number of
expected event types.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-31 14:42:15 +10:00
Dmitry Maluka
a1566e3492 quirks: Thinkpad T470 trackpoint multiplier
Set multiplier for T470 to 0.4, same as for T480.

Trackpoint behavior on T470 was good before 1.9.0 (more precisely,
before the commit 87b568) when a new trackpoint acceleration algorithm
was introduced instead of the traditional linear filter. Since then
it is too sensitive and seems impossible to fine-tune using hw settings
or libinput accel speed setting.

With multiplier set to 0.4 it is as good (or better) as in 1.8.4.
Sensitivity feels the same as in 1.8.4 with the same hw settings for
speed and sensitivity.

Signed-off-by: Dmitry Maluka <dmitrymaluka@gmail.com>
2021-08-26 23:55:57 +02:00
José Expósito
53bd70f4c7 quirks: Lenovo Trackpoint Keyboard II
The device sends its own scroll events when its trackpoint is moved
while the middle button is pressed.

Because scroll events are inhibited while the middle button is pressed
a quirk is necessary for this device to not inhibit scroll events.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-24 18:01:59 +02:00
Peter Hutterer
ca1c05ab44 test: create devices for our udev seat checks
This way we can ensure that at least one device is available, and that
it is the device we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-09 10:50:25 +10:00
José Expósito
7265d1676f editorconfig: add settings for meson files
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-04 05:58:29 +00:00
Peter Hutterer
b925b55634 test: use MESON_TESTTHREADS to determine the number of jobs
meson uses MESON_TESTTHREADS to determine the number of parallel test
jobs. Since our main test suite cannot be run in parallel anyway, use
that same variable in litest to determine how many jobs we should fork
off.

In the CI pipeline, we can use FDO_CI_CONCURRENT to pass that down so we
don't end up running a billion jobs on a test runner.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-03 22:14:29 +00:00
José Expósito
375618b81b meson.build: use the / operator instead of join_paths
Starting with meson v0.49.0, the "/" operator can be used instead of
join_paths.

Update meson to v0.49.0 and remove all calls to join_paths.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 20:00:37 +02:00
José Expósito
44212baaf1 ci: update to GTK 4 when available
Update GTK to version 4 on Fedora, Arch and Alpine Linux.

Not updating Debian and FreeBSD because the package is not available yet
and Ubuntu because it is not available on 20.10.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
be7264f35b debug-gui: pointer locking on X11
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
a9b334ebb5 debug-gui: pointer locking on Wayland
Use the pointer constraints protocol to lock the pointer on Wayland.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
895e866da6 debug-gui: migrate to GTK4
Global:

- Stop passing commandline arguments to gtk_init:
  https://docs.gtk.org/gtk4/migrating-3to4.html#stop-passing-commandline-arguments-to-gtk_init

window_init function:

- gtk_window_new doesn't require a type anymore

- gtk_window_iconify has been renamed to gtk_window_minimize

- gtk_container_add has been removed in favor of container specific
  APIs. Use gtk_window_set_child in this case.

- gtk_widget_show_all has been removed, widgets are now visible by
  default:
  https://docs.gtk.org/gtk4/migrating-3to4.html#widgets-are-now-visible-by-default

- gtk_widget_set_events to NULL is no longer required, widgets must set
  their event handlers explicitly now:
  https://blog.gtk.org/2020/04/29/custom-widgets-in-gtk-4-input/

window_delete_event_cb function:

- Use the new close-request event:
  https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkwidget-event-signals

map_event_cb function:

- gtk_widget_set_cursor_from_name instead of gdk_window_set_cursor

- Wait until the draw area is resized to use the whole window to start
  calculating sizes

window_place_ui_elements function:

- Use gtk_widget_get_width and gtk_widget_get_height instead of
  gtk_window_get_size

Drawing:

- Use gtk_drawing_area_set_draw_func instead of the GtkWidget::draw
  signal:
  https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-drawing-model-changes

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
55889adeff tools/debug-gui: refactor UI element placement
Move the code used to pace the different UI elements to its own
function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
791fbad5b9 tools/debug-gui: use GMainLoop instead of gtk_main
Migrate to GMainLoop because gtk_main is deprecated in GTK 4.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
José Expósito
f36ccc3c11 tools/debug-gui: move gtk_main_quit to a function
Wrap the calls to gtk_main_quit in its own function.

Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-08-03 16:52:39 +00:00
Peter Hutterer
c21f20cc5a meson.build: disable documentation by default
This does little other than drag in a whole bunch of dependencies. The
libinput documentation is designed to be consumed online, so there's no
need building it on every machine.

We leave the dependencies installed in the images because it's a lot
easier to remove them and test if the build still works than adding them
and dragging in every updated package since we built the image.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-08-03 12:11:09 +10:00
satrmb
1773973d4d quirks: Chuwi AeroBook Plus has a clickpad falsely claiming to have BTN_RIGHT
Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2021-07-30 22:59:22 +02:00
Quytelda Kahja
e8bcf71c69
test: Add test for parsing of boolean quirk attributes.
Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2021-07-30 06:11:20 -07:00
José Expósito
140b4b7853 doc: add common failed pipeline errors
Add a section in the contributing documentation with common pipeline
errors and how to fix them and point to this page when the CI fails.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-07-30 05:21:59 +00:00
Peter Hutterer
355635ad4f gitlab CI: drop dependencies between jobs
None of our jobs rely on the artifacts of a previous job, so let's not
pass those around. Make this part of the default policy and include it
from every job.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-29 15:38:01 +00:00
Quytelda Kahja
fc24bba7b3 Add section for Lenovo Yoga C930 tablet in 50-system-lenovo.quirks.
Fixes #632.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2021-07-28 23:53:36 +00:00
Quytelda Kahja
e6c4b1d16e quirks: Add tablet smoothing attribute.
https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/512 disables
input smoothing for AES devices. However, some AES devices produce
segmented/wobbly curves without smoothing. This change introduces an
`AttrTabletSmoothing` boolean property, which overrides the default smoothing
behavior.

See #632

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
2021-07-28 23:53:36 +00:00
Sanjiv
8ee8537491 Update quirks/50-system-chuwi.quirks
Author:    Sanjiv <sanjerat@gmail.com>
Date:      Wed Jul 28 04:27:56 2021 +0000
Signed-off-by: Sanjiv Erat <sanjerat@gmail.com>
2021-07-28 22:37:35 +00:00
Kevin Anderson
eb2ed1863e quirks: add Framework Touchpad Quirk
Handle a bug that the touchpad announces BTN_RIGHT

Signed-off-by: Kevin Anderson <andersonkw2@gmail.com>
2021-07-28 16:47:48 -04:00
Peter Hutterer
79707b91c7 gitlab CI: debug the meson_build script
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 12:50:11 +10:00
Peter Hutterer
047557b7f0 Define the versionsort overrides as inlines
Squashes compiler warnings about unused functions given this header is
included in multiple files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 12:50:11 +10:00
Peter Hutterer
833e49ce01 gitlab CI: use the ci-templates FreeBSD templates
Replace our cross-compilation for FreeBSD with a proper template.
FreeBSD doesn't do normal containers so we need a bunch of if/else to
skip the container builds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 12:50:11 +10:00
Peter Hutterer
21824bc6ff gitlab CI: move the SUITES handling to the template where it matters
Should have been part of 9133693b15.

This fixes an issue with calls to meson_build.sh with an otherwise empty
MESON_TEST_ARGS - thanks to the space before $SUITES it would no longer
the zero-string condition in meson_build.sh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 12:48:56 +10:00
Peter Hutterer
94fc9b2200 gitlab CI: update to latest ci-templates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 09:46:20 +10:00
Peter Hutterer
9133693b15 gitlab CI: split the qemu meson build parts out as separate template
This was part of the test-suite-vm template but to make it easily
re-usable split out the parts that are just about building in a qemu
image from the parts that are specific to running the test suites.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 09:46:17 +10:00
Peter Hutterer
6516374ded gitlab CI: name the qemu tags per distribution
Having only one qemu tag worked only because we only had one
distribution using qemu. If we have multiple of those we just
duplicate/overwrite the variable so let's not do that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-28 08:59:09 +10:00
Peter Hutterer
ad239327c0 doc/user: move the hold gesture section up to the others
Better structuring this way: pinch, swipe, hold, then other comments

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-27 05:20:45 +00:00
Peter Hutterer
67405c2790 doc/user: fix the line alignments for the hold gesture tables
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-27 05:20:45 +00:00
Andrea Ippolito
967b9d3e45 doc/user: make "verifying install" command portable
According to the linker man page libraries are searched in the following paths:
LD_LIBRARY_PATH environment variable
Paths in the cache file /etc/ld.so.cache
/lib, /usr/lib, /lib64 and /usr/lib64
As we are not using LD_LIBRARY_PATH, we can rely on ldconfig as a fairly portable solution because it "creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib)".

Tested on fedora 34, manjaro 2021.07, kubuntu 21.04

Signed-off-by: Andrea Ippolito <andrea.ippo@gmail.com>
2021-07-26 12:35:33 +02:00
Peter Hutterer
2cf38f45a5 touchpad: remove two unused functions
These functions have been unused since 1668cd5e81

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
Peter Hutterer
9564b3c1e2 Mark some functions as printf-like to silence some compiler warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
Peter Hutterer
7cccee251f Disable -Wmissing-field-initializers
We really don't care about that one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
Peter Hutterer
fc70c4f862 Silence compiler warnings for -Wformat-nonliteral
In the various logging functions where we need to modify the format
argument, disable the compiler warnings. Interestingly, GCC doesn't seem
to mind those but building with clang unleashes pages of warnings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
Peter Hutterer
234eeabe2f Replace fallthrough comments with __attribute__((fallthrough))
This has recently been endorsed by the linux kernel, it should be good
enough for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
Peter Hutterer
492f6817d3 util-list: restore list_for_each_safe() to be a single statement
3d3d9b7f69 got rid of the need for a tmp
argument for list_for_each_safe() but switched the loop to be a
multiline statement. This could potentially cause bugs where the loop is
used inside a block without curly braces, e.g.

    if (condition)
        list_for_each_safe()
            func()

The assignment preceding the actual loop would result in the code
reading as:

    if (condition)
        pos = ....

    list_for_each_safe()

The actual list loop would be unconditional.

Fix this by moving the initial assignment into an expression statement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 12:53:08 +10:00
Peter Hutterer
29d311d634 quirks: add a quirk for the X61 bezel buttons
Fixes #628

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-13 21:58:24 +00:00
The_Observer
0a354dc16f quirks: add a quirk for the Purism Librem 14v1
Clickpad that announces BTN_RIGHT
Fixes #629

Signed-off-by: The_Observer <The_Observer@lindemann.space>
2021-07-13 21:28:57 +00:00
Mohamed Elsharnouby
5a23665dfb quirks: add pressure range for Dell Latitude 7480
Pressing Ctrl/Shift on this model triggers light touches that causes random clicks.
This doesn't occur on Windows 10 so adding this quirk to fix it

Signed-off-by: sharno <sharnoby3@gmail.com>
2021-07-11 19:00:42 -04:00
Thomas Stenhouse-Pyne
0ddb26a068 quirks: add volume rocker quirk for Lenovo Duet 7i
Signed-off-by: Thomas Stenhouse-Pyne <tommpyne@gmail.com>
2021-06-26 12:01:36 +01:00
Thomas Weißschuh
b7aac3c148 evdev: remove device when it is gone
This was observed when running in device mode with:
`libinput debug-events $EVENT_NODE`

When removing the monitored device, the no "device removed" message was
not shown.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2021-06-21 10:41:19 +00:00
Peter Hutterer
17783c24df quirks: add a quirk for the Huawei Matebook 2020 touchpad
Clickpad that announces BTN_RIGHT

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-21 08:52:27 +10:00
Peter Hutterer
6aa24d1054 gitlab CI: add a comment to explain how to actually edit the CI
We tell users not to edit it, but don't tell them how to change it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-17 16:10:53 +10:00
luokai
87447a0ee9 using secure functions safe_strdup
Signed-off-by: luokai <l18674732394.com>
2021-06-15 11:27:29 +08:00
Peter Hutterer
9cd6f3c5b8 meson.build: bump to 1.18.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-10 11:46:41 +10:00
José Expósito
1f548864bc gestures: improve one finger hold detection
When one finger is used to hold, tiny pointer movement deltas can easily
end the gesture.

Add a movement threshold to avoid small movement, before or after the hold
timeout, ending the gesture and make the hold-to-interact user
interaction more reliable.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-10 01:07:19 +00:00
José Expósito
45e6e28ca2 gestures: move first_moved and first_mm up
Move the calculation of first_moved and first_mm up inside
tp_gesture_detect_motion_gestures in order to be able to use their
values in the one finger code path.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-10 01:07:19 +00:00
José Expósito
13c47598bc gestures: always save touch information
When a single touch is used to hold or to move the pointer, save
information about the touch.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-10 01:07:19 +00:00
José Expósito
5603ed867d doc: update draw.io URL
The tool used to generate diagrams (draw.io) is now diagrams.net.

Update the URL in the comments.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 22:12:35 +00:00
José Expósito
8aed8b6df6 doc: add touchpad gestures state machine diagram
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 22:12:35 +00:00
Peter Hutterer
38e2a434c5 doc: add docs for hold gestures
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-09 13:12:59 +10:00
Peter Hutterer
c96d414fdc doc: note that gestures may be cancelled
This has been in place forever, so let's note it in the docs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-09 13:01:26 +10:00
José Expósito
9b024c6928 gestures: add quick hold implementation
When 1 or 2 fingers are used to hold, use a faster timer to make the
"hold to stop kinetic scrolling" user interaction feel more immediate.

Also handle double tap and tap and drag interations to send only one
hold gesture instead of two.

Holding with 3 or 4 fingers remains the same to try to avoid callers
missusing hold gestures to build their own tap implementation.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
92827de624 tests: add hold gesture tests
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
a18d9d3de4 tests: optionally hold in gesture test functions
Add an extra parameter to the common gesture test functions to allow to hold
before performing the gesture.

This parameter will be used by the hold tests allowing to share the code.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
c99b24e5a3 tests: move existing gesture tests to functions to be able to reuse them
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
8a180b52d6 gestures: add hold gesture implementation
Hold gestures are notifications about fingers on the touchpad.
There is no coordinate attached to a hold gesture, merely the number of fingers.
A hold gesture starts when the user places a finger on the touchpad and
ends when all fingers are lifted. It is cancelled when the finger(s) move
past applicable thresholds and trigger some other interaction like pointer
movement or scrolling.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
279d14b392 gesutures: allow to configure hold gestures
Valgrind can be too slow to run some time based tests. In those cases, we
need to disable hold gestures.

Add the required functions to configure hold gestures: enable, disable,
get default state and get current state.

Keep them private as they are intended to be used only from the tests.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
b6b15fa304 libinput: add hold gesture public API and tool support
Add hold gestures to the public API and the private functions to notify them.
Also add hold gestures to debug-events and debug-gui.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
781cee2d8b gestures: filter motion inside the gesture state machine
At the moment, every gesture is triggered by motion. In order to implement
gestures not based on motion, like hold, it is required to filter the unwanted
motion inside the gesture state machine so it transits to the correct states.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
b5b6f835af gestures: use events to change between states
Refactor the gesture state machine to emit events to change between states.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
d5636eb934 gestures: handle pointer motion as an extra state
Refactor the gesture state machine to integrate pointer motion as an extra state
of the state machine.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
ba3e79c9f4 gestures: refactor gesture enabled
Move the condition to check if gestures are enabled to its own function.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
José Expósito
bbc5aee5e5 gestures: add a function to know if there is pending pointer motion
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-09 01:18:58 +00:00
Peter Hutterer
2599b0d899 libinput 1.18.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-02 13:06:37 +10:00
Neev Parikh
a8d450d740 Update 50-system-asus.quirks to include Asus G15 Zephyrus quirk.
Signed-off-by: Neev Parikh <neev.v.parikh@gmail.com>
2021-06-01 11:04:44 -04:00
Peter Hutterer
0432fe59ad libinput 1.17.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-26 13:17:59 +10:00
Peter Hutterer
873a883906 gitlab CI: use FDO_CI_CONCURRENT in our meson build script
Always prefix the ninja args with the FDO_CI_CONCURRENT values (i.e. how many
jobs the runner tells us).

Note that this variable is currently not passed through to the qemu jobs, so
inside the VM we'll still use the ninja default values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-25 11:17:45 +00:00
Peter Hutterer
d09cc9db00 doc/user: #wayland is now on oftc
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-25 20:19:36 +10:00
José Expósito
624041c09b test: cleanup: remove fallthrough followed by break
Remove fallthrough comments followed by a break statement.
No functional changes.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-05-24 05:35:27 +00:00
weizhixiang
1339dbaf3d use more safety list_for_each_safe when remove element in traversing list
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
2021-05-24 04:42:49 +00:00
weizhixiang
cce5921015 use ARRAY_FOR_EACH when traverse array
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
2021-05-24 04:11:32 +00:00
satrmb
0cb570addd evdev: restart debouncing timers after every event
Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2021-05-19 12:24:59 +02:00
novenary
c4ea48eda6 Increase pinch grace period to 300ms
Windows allows "about a third of a second" to trigger a two-finger
pinch.

https://gitlab.freedesktop.org/libinput/libinput/-/issues/550#implementation-in-other-systems

Signed-off-by: novenary <streetwalkermc@gmail.com>
2021-05-19 05:12:58 +00:00
novenary
ca3df8a076 Allow reviving a thumb that moves sufficiently
When pinching, the thumb tends to move slower than the finger, so we may
suppress it too early.

Add a grace period during which it may be revived.

Signed-off-by: novenary <streetwalkermc@gmail.com>
2021-05-19 05:12:58 +00:00
novenary
939a022cbc Improve disambiguation between two-finger pinch and scroll
A pinch is defined as two fingers moving in different directions, and a
scroll as two fingers moving in the same direction.

Often enough when the user is trying to pinch, we may initially see both
fingers moving in the same direction and decide that they want to
scroll.

Add a grace period during which we may transition to a pinch in those
situations.

Test fix: touchpad_trackpoint_buttons_2fg_scroll emits movements that
change the distance between fingers, which triggers this new transition
and makes the test fail; correct this.

Signed-off-by: novenary <streetwalkermc@gmail.com>
2021-05-19 05:12:58 +00:00
dan g
3dcfae3fb6 quirks: add palm rejection support for all Razer Blade models
Generated with a script to scrape the openrazer project for Razer Blade
internal keyboard VIDs, see `razer_quirk_util.py` [1]

This allows us to potentially bulk-add all Razer Blade models to benefit from
palm rejection, rather than processing individual requests and merges.

[1] https://gist.github.com/danryu/ee0c24ac50af40321550462bbf9ab594

Signed-off-by: dan g <dan.garton@gmail.com>
2021-05-19 12:59:18 +10:00
Peter Hutterer
e72b30f424 tools/record: narrow down the obfuscation range
Let a few obvious modifiers through, including the F-key range. Especially
left control is useful to know if it's down.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-18 23:14:44 +00:00
Peter Hutterer
4c82cbd4d0 tools/replay: do not replay key repeat events
The kernel emulates key events on its own anyway, replaying key events with
libinput replay as well just duplicates the events. Turning kernel
repeat off is not an option, it  makes the device look different (EV_REP
changes). So let's just not replay those events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-18 23:14:44 +00:00
Peter Hutterer
5dc000323d gitlab CI: add a JUnit XML report for scan-build
Use a scan-build wrapper to generate plist files, then parse those into a
JUnit xml format. This makes the errors appear on the main MR page as opposed
to being hidden in the artifacts somewhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-12 13:31:42 +10:00
Peter Hutterer
b1c9667aca editorconfig: add settings for python files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-12 11:50:11 +10:00
Peter Hutterer
5a6f141bd8 gitlab CI: bump from Fedora 32 to 34
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-12 10:23:33 +10:00
Peter Hutterer
cf1abf0818 tools/record: add support for hidraw recording
New commandline switch --with-hidraw. This will open all hidraw devices
associated with this device and add any reports to the output in the
form:

  events:
    - hid:
        time: [0, 0]
        hidraw1: [0x01, 0x02, 0x03, 0x05, 0x06]
	hidraw2: [0x07, 0x08, 0x09, 0x0a, 0x0b]
    - evdev:
      ...

i.e. there's a nesting of `hid` with a list of reports, each with the hidraw
node as dictionary entry.

Because hidraw events do not have timestamps and always occur before the evdev
events, they are in a separate frame (as shown above). We could try to figure
out how to match them with the upcoming evdev frame but it's not worth it for
now.

The timestamp itself is a special key in the hidraw with the timestamp from
clock_gettime.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-05 03:59:34 +00:00
Peter Hutterer
f1b16c18e5 meson.build: bump to 1.17.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-05-05 12:46:33 +10:00
Nicolas Fella
20b2123fbc doc/user: Add instructions for using with CMake
CMake provides a nice way to use libinput, let the world now.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2021-05-04 21:16:55 +02:00
Hans Gaiser
b1f958a178 Add quirk for Lenovo Legion 5 Pro.
Signed-off-by: Hans Gaiser <hansg91@gmail.com>
2021-05-04 00:55:04 +00:00
Peter Hutterer
b38c6ca69f tools/record: linebreak the hid report descriptor every 16 bytes
New output:

 hid: [
    0x05, 0x0d, 0x09, 0x04, 0xa1, 0x01, 0x85, 0x01, 0x09, 0x22, 0xa1, 0x02, 0x09, 0x42, 0x15, 0x00,
    0x25, 0x01, 0x75, 0x01, 0x95, 0x01, 0x81, 0x02, 0x75, 0x01, 0x81, 0x03, 0x75, 0x06, 0x09, 0x51,
    0x25, 0x3f, 0x81, 0x02, 0x26, 0xff, 0x00, 0x75, 0x08, 0x09, 0x48, 0x81, 0x02, 0x09, 0x49, 0x81,
    ...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-30 14:54:35 +10:00
Peter Hutterer
7da7cd216f tools/record: print the HID report descriptor as hex
YAML does support hex as long as it's 0x-prefixed. The comment here (probably)
dates from an in-development version of libinput-record that used JSON.
Anyway, let's print the HID report descriptor as hex because that's the common
format for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-30 14:54:35 +10:00
Peter Hutterer
57811e40f0 tools/record: fix a strlen assumption
We want to be able to print single-character strings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-30 14:54:35 +10:00
Peter Hutterer
354df8bce9 Change various references to the master branch to main
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-29 01:31:03 +00:00
Peter Hutterer
65c27713cf doc/user: fix a link to the system hwdb file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-29 10:30:49 +10:00
Peter Hutterer
72f747f255 gitlab CI: switch to Ubuntu 21.04
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-23 01:41:12 +00:00
Peter Hutterer
a37d6dcc9c touchpad: if we have a right button, let's assume it's not a clickpad
This assumption dates back roughly a decade when INPUT_PROP_BUTTONPAD was
introduced into the kernel. To my knowledge, devices right now erroneously
advertise INPUT_PROP_BUTTONPAD when they are not a clickpad (but then they
have BTN_RIGHT) or they lack INPUT_PROP_BUTTONPAD (and only have BTN_LEFT).

So let's change our assumption here - if a clickpad has a right button log the
kernel bug and continue with the assumption the device is a touchpad with
physical buttons.

To disable that warning, fix the kernel or add an AttrInputPropDisable quirk
for the device.

Fixes #595

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-21 00:15:42 +00:00
Peter Hutterer
467266bbb4 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>
2021-04-21 00:15:42 +00:00
Peter Hutterer
16d5d78a4d touchpad: use some helper variables to make the code easier to read
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-21 00:15:42 +00:00
Peter Hutterer
f92a388c7a touchpad: factor out clickpad assignment to a helper
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-21 00:15:42 +00:00
Udo Rader
144f5ed93d 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>
2021-04-20 02:15:03 +00:00
Peter Hutterer
10124797b5 quirks: add palm size quirk for the Gigabyte Aero 15
Fixes #599

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-14 15:04:39 +10:00
JoseExposito
3565dafdf1 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>
2021-04-13 14:01:11 +10:00
JoseExposito
73ef2d70c2 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>
2021-04-13 14:01:11 +10:00
JoseExposito
020f13e10d gestures: move the code to get raw pointer motion to its own function
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-04-13 14:01:11 +10:00
JoseExposito
82da751726 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>
2021-04-13 14:01:11 +10:00
JoseExposito
b64a60a633 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>
2021-04-13 14:00:57 +10:00
Chris Dickson
9ce8d561c1 quirks: mark the 0x252 razer keyboard as internal
Signed-off-by: Chris Dickson <hobochili@pm.me>
2021-04-09 11:17:24 -05:00
Peter Hutterer
04dc67e092 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>
2021-04-09 10:14:47 +10:00
Peter Hutterer
95a72990ad 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>
2021-04-07 12:38:25 +10:00
Jonas Ådahl
f723b28220 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>
2021-04-06 16:33:42 +02:00
JoseExposito
c71a1f4347 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>
2021-04-06 05:10:32 +00:00
Ben Weston
74f6821d7a quirk: fix sensitivity for Dell Latitude 7490 pointing-stick
Signed-off-by: Ben Weston <b.weston60@gmail.com>
2021-04-03 23:24:33 +01:00
Peter Hutterer
943e258cca tools/record: line up the "neutral state" message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-30 09:02:31 +10:00
Peter Hutterer
33b30d4631 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>
2021-03-30 09:02:31 +10:00
Peter Hutterer
bacf4e5a62 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>
2021-03-30 09:02:31 +10:00
Peter Hutterer
7957f1980d 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>
2021-03-30 09:02:31 +10:00
Peter Hutterer
0b23cb1ba2 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>
2021-03-30 09:02:31 +10:00
Peter Hutterer
0cdf459643 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>
2021-03-30 09:02:31 +10:00
Peter Hutterer
632eedadf5 tools/record: mark the iprintf function as printf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-30 08:33:49 +10:00
Peter Hutterer
9011f91868 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>
2021-03-30 08:33:49 +10:00
Peter Hutterer
7f4df04d59 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>
2021-03-30 08:26:30 +10:00
Peter Hutterer
4da9349a91 tools/record: free the namelist when we're done
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-26 10:12:40 +10:00
Peter Hutterer
e511f96201 tools/record: localize a variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-26 10:12:40 +10:00
Peter Hutterer
8b822a84c4 tools/record: de-duplicate an error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-26 10:12:40 +10:00
Peter Hutterer
0828fdcea0 tools/record: factor out the output file collection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-26 10:12:40 +10:00
JoseExposito
2babdba1d7 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>
2021-03-19 08:37:02 +01:00
JoseExposito
cd4f2f32b5 fallback: disable mouse scroll wheel while middle button is pressed
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-03-17 03:23:56 +00:00
JoseExposito
0f79fe6677 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>
2021-03-17 03:23:56 +00:00
Greg V
06697b5e85 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>
2021-03-17 02:34:30 +00:00
Greg V
6941f74070 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>
2021-03-17 02:34:30 +00:00
Greg V
d8b1a773e3 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>
2021-03-17 02:34:30 +00:00
Greg V
5f00c32d9e 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>
2021-03-17 02:34:30 +00:00
Peter Hutterer
83b3670c9a 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>
2021-03-16 21:29:56 +00:00
Alexander Mikhaylenko
60d5172e15 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>
2021-03-16 21:29:56 +00:00
Peter Hutterer
1d9cdf76a5 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>
2021-03-16 21:29:56 +00:00
Peter Hutterer
dee0e5e725 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>
2021-03-16 21:29:56 +00:00
Peter Hutterer
5129d178b3 test: fix debugging messages for gesture begin event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-16 21:29:56 +00:00
Peter Hutterer
2f8dab4537 doc/user: explain why we are doing motion normalization
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-16 21:29:56 +00:00
Peter Hutterer
1d0dbd2461 filter: correct comments about the threshold's unit
See d6e5313497 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>
2021-03-16 06:03:56 +00:00
Peter Hutterer
cbff56e6a2 test: update a few tests for more modern helpers
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-15 16:17:19 +10:00
Peter Hutterer
3427b457ce test: localize a few variables
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-15 16:15:57 +10:00
Peter Hutterer
42d6fed868 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>
2021-03-11 16:33:00 +10:00
Peter Hutterer
832c346b2b 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>
2021-03-11 16:32:59 +10:00
Peter Hutterer
31d20acdf6 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>
2021-03-11 16:32:59 +10:00
Peter Hutterer
39b64107e9 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>
2021-03-11 10:40:00 +10:00
Peter Hutterer
1926a66fab 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>
2021-03-11 10:40:00 +10:00
Peter Hutterer
e99f59422c tools/debug-gui: move the pointer position into a struct point
No functional change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-11 10:40:00 +10:00
Peter Hutterer
c71fa06607 tools/debug-gui: start the unaccelerated motion deltas in the screen center
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-11 10:40:00 +10:00
Peter Hutterer
de70661213 util: document our list interface
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-10 03:48:21 +00:00
Peter Hutterer
f17ef2d543 tools/per-slot-delta: handle KeyboardInterrupts nicely
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-10 00:24:51 +00:00
Peter Hutterer
fe30bea36e tools/per-slot-delta: print the button state too while analyzing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-10 00:24:51 +00:00
Peter Hutterer
40b83b1105 completion: add missing libinput analyze subtools to the zsh completions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-03-10 09:54:07 +10:00
weizhixiang
c00c5cb691 replace strncmp with strneq for safety-check
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
2021-03-08 20:59:20 +00:00
Pedro Ribeiro
5e69c5f9ae Add Lenovo Legion 5 keyboard to 50-system-lenovo.quirks
Signed-off-by: Pedro Ribeiro <pedrib@gmail.com>
2021-03-02 23:07:48 +00:00
Konstantin Kharlamov
3d3d9b7f69 treewide: get rid of tmp argument in list_for_each_safe
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2021-03-02 09:10:35 +03:00
Konstantin Kharlamov
3f2c483439 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>
2021-03-02 09:07:42 +03:00
Peter Hutterer
9477d91d69 libinput 1.17.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-23 19:02:45 +10:00
Peter Hutterer
1b00eb5e03 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>
2021-02-23 16:55:58 +10:00
Peter Hutterer
6a6435ae4b 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>
2021-02-23 13:46:00 +10:00
Peter Hutterer
9323cdfc11 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>
2021-02-23 13:30:42 +10:00
Peter Hutterer
627a3dd2b2 tools/record: use a helper function to get the next event for a device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-23 10:56:53 +10:00
Peter Hutterer
4a7dece88c 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>
2021-02-23 10:56:53 +10:00
Peter Hutterer
d8b64d413d tools/record: reword parts of the man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-23 10:56:53 +10:00
Peter Hutterer
ca9067992e tools/record: use safe_basename() to get to the hid report descriptor
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-23 10:56:53 +10:00
Peter Hutterer
671eb8cbbb 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>
2021-02-23 10:56:53 +10:00
Peter Hutterer
fd9d165a77 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>
2021-02-23 10:56:53 +10:00
Peter Hutterer
ff87151764 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>
2021-02-23 10:53:31 +10:00
Peter Hutterer
f30342644a 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>
2021-02-23 10:43:52 +10:00
Peter Hutterer
59ca971898 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>
2021-02-22 14:53:41 +10:00
yuri1969
201b81ebe9 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>
2021-02-19 22:14:38 +01:00
Peter Hutterer
4b0f200936 tools/record: fix outdated comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-19 09:09:53 +10:00
Peter Hutterer
a8597e3ab3 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>
2021-02-19 09:09:53 +10:00
Peter Hutterer
ea4f89bd1d tools/record: correct the evdev data format in the man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-19 09:09:53 +10:00
Peter Hutterer
1b8dd97092 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>
2021-02-18 01:00:53 +00:00
Peter Hutterer
82e974ef1d 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>
2021-02-18 01:00:53 +00:00
satrmb
dc936707a9 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>
2021-02-17 08:14:11 +01:00
Peter Hutterer
115a8ff141 libinput 1.16.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-16 13:10:18 +10:00
Peter Hutterer
e96852ac37 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>
2021-02-15 18:03:34 +10:00
Peter Hutterer
06ef838b5b 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>
2021-02-15 18:03:34 +10:00
Peter Hutterer
b8d4197697 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>
2021-02-15 17:34:51 +10:00
Peter Hutterer
a0d842a640 doc: update the docs with a note regarding multifinger dragging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-15 17:13:46 +10:00
Peter Hutterer
da5bdd2022 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>
2021-02-15 16:28:44 +10:00
satrmb
37e6e89ed5 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>
2021-02-15 05:46:46 +00:00
satrmb
4ccdacaf95 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>
2021-02-15 05:46:46 +00:00
satrmb
a91ecbde74 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>
2021-02-15 05:46:46 +00:00
Peter Hutterer
03280de5e9 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>
2021-02-15 15:22:42 +10:00
Peter Hutterer
d0d2994254 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>
2021-02-12 15:24:15 +10:00
Peter Hutterer
d3115f4875 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 d838e3a3a4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 15:24:15 +10:00
Peter Hutterer
e6ed506df3 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>
2021-02-12 14:31:50 +10:00
Peter Hutterer
8ab2581d20 gitlab CI: make the test suite names a list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 14:31:48 +10:00
Peter Hutterer
d838e3a3a4 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>
2021-02-12 11:05:38 +10:00
Peter Hutterer
aed15dd791 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>
2021-02-12 11:04:57 +10:00
Peter Hutterer
db0a2be1a0 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>
2021-02-12 11:04:46 +10:00
Peter Hutterer
3eb428ef56 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>
2021-02-12 07:35:58 +10:00
Peter Hutterer
f6c05ae4cc 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>
2021-02-12 07:35:58 +10:00
Peter Hutterer
595d870449 test: init an array to zero to silence scan-build
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 07:35:58 +10:00
Peter Hutterer
6c32f78020 tools/record: add some curly braces
list_for_each is just a fancy for loop but it looks weird without braces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 07:35:58 +10:00
Peter Hutterer
c83c739a8c tests: drop the duplicate test for pointer event conversion
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-11 15:54:17 +10:00
Peter Hutterer
1d714e68df test: don't set the log handler 10 times
Once is enough, we don't need to set it inside the loop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-11 15:53:53 +10:00
Peter Hutterer
51da77f9ea gitlab CI: rename the VM stage "test-suite"
A much more sensible name than "vm"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-11 02:56:49 +00:00
наб
e51be40905
totem: separate X/Y resolution from touch size in discriminator
Ref: bf4277623f (note_793589)
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
2021-02-09 13:52:20 +01:00
наб
0dd8b9725f
totem: fix suspension-as-addition and resumption-as-removal in interface
Ref: bf4277623f (note_793592)
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
2021-02-09 13:50:57 +01:00
Gablegritule
9f594664d9 quirks: add pressure ranges for the Dell Latitude E5510 TouchPad
The default setting makes the "Dell Latitude E5510 TouchPad" too sensitive and
consequently difficult to use.

Note that the the size of the TouchPad is detected to be higher than it is
(the side-bars are half out of the TouchPad), see
https://github.com/systemd/systemd/pull/18493 for the hwdb overrides for this
device.

Signed-off-by: Gablegritule <guillet.gabriel@laposte.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-09 09:23:01 +10:00
Peter Hutterer
d1f900f764 Create /etc/libinput on install
Users that need to create the local-overrides.quirks are sometimes hesitant to
do so because /etc/libinput doesn't exist by default. Let's create it on
install.

Related #568

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-08 04:28:42 +00:00
Peter Hutterer
61e41df901 touchpad: disable the pressure axes wherever the resolution is nonzero
The kernel/udev set the pressure resolution to nonzero to indicate the value
is in a known scale (units/g). We use that information to disable the
pressure axis on such devices - real pressure cannot be translated to
contact size.

For the kernel patch see:
https://www.spinics.net/lists/linux-input/msg71237.html

Fixes #569

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-08 03:38:26 +00:00
Peter Hutterer
4422e95747 test: don't require root to list tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-05 16:04:54 +10:00
Peter Hutterer
ff7c52d78d quirks: reword the requirements section in the quirks README
Change the wording from "these will fail" to "this must be followed" which is
easier to understand. And add the requirement for uppercase hex numbers as
enforced since c412924003.

Related #568

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-03 07:45:12 +00:00
Peter Hutterer
081f914692 doc/user: expand the explanations on how to submit a merge request
I keep answering this in bug reports, much easier to just have a link to
copy/paste.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-03 17:09:09 +10:00
Peter Hutterer
4c4a0e1f0b doc/user: some whitespace fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-03 17:09:09 +10:00
Peter Hutterer
14bec5b64e quirks: improve the README
Make the headers valid markdown and reword/reformat a few other things
to make it clearer and easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-02 11:54:14 +10:00
Peter Hutterer
affc3d929a libinput 1.16.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-01 19:14:10 +10:00
Gary Wolfe
3f15bc3985 Dell touchpad was too sensitive with default settings
The touchpad for the Dell Inspiron 15R N5110 was too sensitive with default settings, leading to excessive movement when lifting finger.

Fixes #565

Signed-off-by: Gary Wolfe <avidgamefan@yahoo.com>
2021-01-29 02:42:12 +00:00
Peter Hutterer
ff598741a9 tools: add a tool to analyze the finger count from a recording
Given a libinput recording, print the timestamps of any finger changes, i.e.
which slots are currently logically down. For example:

Timestamp | Rel time |     Slots     |
--------------------------------------
 0.000000 |  +0.000s | + |   |   |   |
 0.454631 |  +0.454s |   |   |   |   |
 5.065401 |  +4.610s | + |   |   |   |
 6.140281 |  +1.074s | + | + |   |   |
 7.410377 |  +1.270s |   | + |   |   |
 7.420200 |  +0.009s |   |   |   |   |
11.233108 |  +3.812s | + | + |   |   |
11.850206 |  +0.617s |   |   |   |   |
13.827740 |  +1.977s | + |   |   |   |
14.704027 |  +0.876s | + | + |   |   |
16.050577 |  +1.346s | + |   |   |   |
16.905186 |  +0.854s |   |   |   |   |

This data is available with the per-slot-delta tool but the output here is
more compressed, making it easier to detect stuck fingers. Pressure
thresholds are not currently supported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 08:06:53 +10:00
Peter Hutterer
9925594257 tools/record: print the wall clock time every few seconds
For long-running recordings it's useful to know what the actual time was when
a particular event occured. A user can simply check the clock or system logs
for the time and thus know which portion of the recording to focus on.

Let's print the time into the recording, every 5 seconds (aligned at the 5,
10, 15s marks) or, if no events occured in the last 5 seconds, before the next
event. This granularity should be enough to identify the interesting parts of
a recording.

Let's print this as a comment until we have a use-case that requires parsing
this data.

The timer is the simplest approach, it just repeats at a fixed 5 seconds
interval from startup. There may be time drift, we can fix that if needed.

Fixes #560

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 07:31:46 +10:00
Peter Hutterer
0b8ad77624 tools/record: use a pointer to the libinput fd poll entry
No functional changes, this makes the code slightly more readable, especially
once we start adding more "special" fds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 07:31:46 +10:00
Peter Hutterer
773287e745 tools/record: use a pointer to the signalfd poll entry
No functional changes, this makes the code slightly more readable, especially
once we start adding more "special" fds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 07:31:46 +10:00
Peter Hutterer
b1f8ea0a5e tools/record: narrow the scope of two variables
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 07:31:46 +10:00
Peter Hutterer
f2133ef0f3 tools/record: initialize all pollfds in the same loop
Minor tidying up the code, set the default values for all fds in the same loop
instead of having it split to wherever the fd is created.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-29 07:31:46 +10:00
Peter Hutterer
1dbdef8fdb Use python black for all pyhon file formatting
Let's enforce a consistent (and verifiable) style everywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-28 21:02:45 +00:00
Jonas Ådahl
c0364f2317 doc: fix IRC channel name
It said #wayland-devel, but it's #wayland.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2021-01-28 08:32:03 +01:00
weizhixiang
2ea6589892 modify macro streq/strneq for check one null pointer
Signed-off-by: weizhixiang <1138871845@qq.com>
Minor modifications applied by Peter Hutterer <peter.hutterer@who-t.net>
2021-01-18 17:46:17 +10:00
Peter Hutterer
53595cb232 quirks: disable pressure on the Lenovo Yoga 9i touchpad
This touchpad is a true pressurepad and the pressure axis gives us physical
pressure down. Using it as contact size gives flaky touch detection, so let's
just disable the axis until we do something with that value.

Fixes #562

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-14 13:42:59 +10:00
Peter Hutterer
f2baea50c0 doc/user: list the known package repositories for libinput from git
Because dnf install is a lot easier than building from git where one just
wants to test the latest libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-07 22:48:35 +00:00
weizhixiang
2ed0f24e20 check return value for libudev/udev_device_get_action
Signed-off-by: weizhixiang <1138871845@qq.com>
2021-01-06 17:46:14 +08:00
Peter Hutterer
b43dc88c64 gitlab CI: use Fedora 33
This requires the latest CI templates for the updated mkosi fixes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-04 12:02:46 +10:00
Peter Hutterer
ba0aed7b27 gitlab CI: fix flake8 complaints
tools/libinput-measure-fuzz.py:212:15:
 F523 '...'.format(...) has unused arguments at position(s): 1

But the E741 is better turned off in general:
  tools/libinput-measure-fuzz.py:319:29: E741 ambiguous variable name 'l'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-04 12:02:46 +10:00
Torstein Husebø
18c9265224 treewide: fix typos
Signed-off-by: Torstein Husebø <torstein@huseboe.net>
2020-12-16 22:08:23 +01:00
Peter Hutterer
8c5a850d39 doc: somewhat document the write_open for lid switches
Not a full documentation but slightly more information than before. This is
too niche to document it fully, we're only using it on one device anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-16 10:47:58 +10:00
Peter Hutterer
306b00a19d doc/user: document that we're only using internal devices for DWT
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-15 15:49:17 +10:00
Blaž Hrastnik
aec8e0b4ef
Match all Surface (Pro/Laptop/Book) devices.
Signed-off-by: Blaž Hrastnik <blaz@mxxn.io>
2020-12-15 12:42:25 +09:00
Peter Hutterer
535f92a546 touchpad: increase the jump detection interval to 30ms
On serial touchpads it's common enough that frames slow down tofrom the usual
12ms to 24ms. That's too close to our 25ms cutoff so if we have a minor delay,
we end up missing out on jump detection.

Fixes #541

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-14 09:32:13 +00:00
Peter Hutterer
bfa077d2a8 gitlab CI: don't allow VM test failures
The VM runs are much more reliable now and where they do fail, they can be
retriggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-14 18:57:51 +10:00
Peter Hutterer
62a0b17007 test: plug a leak in the tablet smoothing test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-14 18:57:51 +10:00
Peter Hutterer
61d3427635 test: plug a memleak in a quirks test
Introduced in 56f4af51ec

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-09 21:22:32 +10:00
Jef Driesen
4ce0d41b3a quirks: add quirk for Dell XPS 15 9500 touchpad
The Dell XPS 15 9500 has a large touchpad without any visible markers
for the touchpad buttons. Since the ModelTouchpadVisibleMarker quirk is
enabled by default for all Dell touchpads, the middle button area ends
up too small. Disable the quirk again for this specific model.

Fixes #545

Signed-off-by: Jef Driesen <jefdriesen@telenet.be>
2020-12-09 08:43:28 +01:00
Peter Hutterer
56f4af51ec test: add a test for model quirk overrides
Related to #545

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-12-08 09:59:03 +10:00
Peter Hutterer
a506d092b8 tablet: disable smoothing for AES devices
Data in
https://gitlab.freedesktop.org/libinput/libinput/-/issues/225#note_379034
suggests that AES devices have lower noise than the older EMR
devices, so let's try disabling it for those devices.

We can't directly get the AES devices in libinput unless we want to add a
whole bunch of quirks for the various vid/pid combinations. But we can get
that info from libwacom, primarily because we know that libwacom will list all
known AES pens for any device. So we can check for one that we know of (0x11)
and if it's in the list, the tablet is an AES tablet.

Setting the history size to 1 means we never do any actual smoothing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-25 03:54:47 +00:00
Peter Hutterer
cd37dcfa66 udev: update rules to handle bind/unbind events
Summary: we expect add, change or remove but kernel 4.12 added bind and
unbind. These events were previously discarded by udevd. Our rules should
handle any event *but* remove, so update as suggested in the announce email
linked below.

For a longer explanation, see the system 247rc2 announcement
https://lists.freedesktop.org/archives/systemd-devel/2020-November/045570.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-24 23:47:31 +00:00
Peter Hutterer
bbd1be7a6d gitlab CI: check commits/CI template generation before spinning up containers
If either of those fails, no point in trying to generate containers.
And move the MR check down to the deploy stage where it belongs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-24 07:05:58 +10:00
Peter Hutterer
60e0995360 gitlab CI: use ci-fairy generate-template --verify
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-24 07:05:58 +10:00
Peter Hutterer
b7df846a8b gitlab CI: use the CI-fairy image
This removes the need to pull a docker image for each of those stages.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-24 07:05:57 +10:00
Peter Hutterer
dd47530932 gitlab CI: add curl to the debian image
The coverity job on debian needs curl.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-16 13:30:27 +10:00
Peter Hutterer
8691b83def gitlab CI: generate the package lists from the config.yaml
The string list is getting too confusing.

This gets rid of the separate packageset for qemu. That packageset only
differed by adding valgrind, we can just keep that in the same list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 10:51:20 +10:00
Peter Hutterer
8bb34dceeb gitlab CI: update to latest templates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:39:26 +10:00
Peter Hutterer
833b8d2da4 gitlab CI: remove unused custom ubuntu install script
Looks like this has been obsolete since
4df2ac731f where it stopped passing in the
packages.

And a bug caused the template to checked the "version" against "ubuntu", so
the script hasn't actually been included in any job anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:38:28 +10:00
Peter Hutterer
eef14179a2 gitlab CI: update Ubuntu to current distros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
05df169d2d gitlab CI: rename FREEBSD_PKGS to FREEBSD_PACKAGES for consistency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
b2dbe19605 gitlab CI: switch the coverity job to Debian stable
coverity doesn't work with gcc 10, it fails with "invalid GNU version
number: 201". F31 is about to be EOL but we can't use to F32 or later.

So let's switch to debian stable instead, that one will stick around for a bit
longer.

Debian packages are the same as the Ubuntu packages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
ed2e791f04 gitlab CI: Fedora only needs git-core, not git
The other lines are just for indentation to match up

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
c23af9e178 gitlab CI: use a template for the various ci-fairy jobs
And switch to python:alpine, an image that is tiny and sufficient for the job
we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
ef5919cdab gitlab CI: switch to the vmctl script
See ci-templates commit acda94e139030dc2caa058118956225e55bbec5f, it replaces
vm interactions with vmctl start/stop/exec and sets up an ssh config for the
hostname 'vm'.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-12 09:31:37 +10:00
Peter Hutterer
d7ba7b18d1 gitlab CI: pass MESON_ARGS down to the wayland-web job
Now that we're firing the wayland website generation as trigger, we're
automatically passing down the variables to the pipeline. Let's pass down
something sensible, we already had one issue with our space-separated
'build dir' and let's not require more than absolutely necessary to build
the docs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-10 22:44:15 +00:00
Peter Hutterer
2c50ffab24 tools: print the AttrEventCodeEnable and AttrInputPropEnable/Disable quirks
Introduced in e3c4ff3 and e882bd02

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-10 14:27:22 +10:00
Peter Hutterer
cfd8e6c76c Fix a few coverity complaints
All minor:
- execdir does not need initialization, it's not used until written to
- 'newest' could be NULL
- zalloc(-1) confuses coverity
- 't' is never used in that test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-10 14:27:22 +10:00
Peter Hutterer
34fe17f723 Fix the termination of the readlink result
nread is the number of bytes put into the buffer, let's terminate it there
instead of one byte over. This only worked because execdir was initialized to
zero.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-10 14:27:22 +10:00
Peter Hutterer
024162e606 gitlab CI: update the comments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-03 14:07:54 +10:00
Peter Hutterer
87e37453f4 gitlab CI: update to latest ci-templates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-03 14:07:08 +10:00
Peter Hutterer
3144d3afe5 gitlab CI: remove a now-unused VERSION variable
This became obsolete with FDO_DISTRIBUTION_VERSION being autogenerated by
templates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-11-03 14:06:55 +10:00
Peter Hutterer
61947b33f6 gitlab CI: trigger the wayland website pipeline directly
See the documentation here:
https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#trigger-a-pipeline-when-an-upstream-project-is-rebuilt

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-28 03:20:06 +00:00
Peter Hutterer
11d517f969 doc/user: update the timer offset warning for the new "too slow" message
Related #533

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-28 02:58:03 +00:00
Peter Hutterer
5faa3b7ae9 evdev: reduce the "your system is slow" warning to 5 per hour
Two cases where this can happen: system is currently slow and delaying events,
n which case we'll get a burst and it'll show up in the log files anyway. Or
the system is generally slow and we get these warnings all the time. In the
latter case, let's not spam the log.

Fixes #533

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-28 02:58:03 +00:00
Scott Jann
69959c8a3b quirks: add quirk for Dell Precision 7550/7750 touchpad
Signed-off-by: Scott Jann <sjann@knight-rider.org>
2020-10-23 13:35:50 +10:00
Peter Hutterer
b925a0878b quirks: switch the models with missing buttonpad to use the new attr
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-23 13:35:50 +10:00
Peter Hutterer
e882bd0216 quirks: add AttrInputPropEnable and Disable
The latter requires libevdev 1.10 but since that'll take a while to filter
into our various CI systems, let's make it conditional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-23 13:35:50 +10:00
Peter Hutterer
e3c4ff3898 quirks: add AttrEventCodeEnable as counterpoint to the disable one
Currently unused, but let's get this in because we may need this very soon for
broken tablets.

Enabling EV_ABS axes requires an absinfo struct - we default to a simple 0-1
axis range for those as the most generic option. Anything more custom will
need more custom treatment when we need it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-23 13:35:50 +10:00
Peter Hutterer
30502dee1e evdev: localize two variables during quirks handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-23 12:54:54 +10:00
Peter Hutterer
fa0c3ee388 evdev: quirks_get_tuples can deal with a NULL quirks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-23 12:53:35 +10:00
Peter Hutterer
1ebdc60576 tools/debug-events: rework touch event printing
Previously, touch up events did not contain the slot number which makes the
logs ambiguous (e.g. see the one in #532). Fix that, and since doing so would
require extra conditions anyway get rid of the current with/without coords
function and just handle it all inside one function instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 09:09:50 +10:00
Peter Hutterer
08999899cb Print the event name when using an invalid event type
Where an invalid event type is passed to a function (e.g. a keyboard event to
a touch-related function) we used to only print the event code. That makes
debugging less obvious than necessary, so let's print the event name too.

This requires the function to be moved below event_type_to_str()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-21 09:09:50 +10:00
Peter Hutterer
b121c350db test: fix the tip one axis test
Only worked because of axis smoothing mangling the coordinates - x is not
supposed to change where we're moving along a vertical line. And the same for
y and horizontal lines.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-08 12:45:10 +10:00
Peter Hutterer
546b7623a3 test: fix the tablet relative calibration test
This test only worked because axis smoothing mangled the coordinates, moving
from 5/10 to 10/20 cannot possibly have a dx of zero.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-08 12:45:10 +10:00
Peter Hutterer
a80fe32503 fallback: expand the range of valid keys
The kernel has since added a bunch of keys in the range between
KEY_ONSCREEN_KEYBOARD and BTN_TRIGGER_HAPPY. Let's designate those as keys so
we handle them correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-07 09:38:39 +10:00
Peter Hutterer
442b7b4e34 gitlab CI: add git depth to the coverity job and save the artifacts
A default git depth of 1 means git describe won't work, let's set it to
something high enough that we should always have at least one tag in the
history.

And save the artifacts after the coverity compilation, where the submission
fails for whatever reason we can just resubmit those manually without having
to rebuild the whole image locally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-07 07:27:13 +10:00
Peter Hutterer
82bf473d99 tools: color-group the debugging messages
Alternate between two randomly-chosen colors for each batch of debug messages
to make it easier to visually group the two.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-07 07:22:52 +10:00
Peter Hutterer
4f282688ac tools: print the libinput_dispatch() counter for debugging messages
The messages with priority DEBUG refer to the various internal state machines
updating, so it's useful to know when they did so. Let's count up every time
we trigger libinput_dispatch() so we know how the messages group together.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-06 16:12:17 +10:00
Peter Hutterer
7244e36b50 tools: only call libinput_dispatch() once per poll
This is a closer approximation of all callers anyway, and it makes it easier
to debug which events are handled per libinput_dispatch() call.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-10-06 16:12:17 +10:00
Davide Depau
ec939611fd quirks: fix force-press on Apple Magic Trackpad 2
The current defaults detect force presses as palm or thumb.
The values provided here work for a 99% accurate palm/thumb detection
and provide close zero false positives in my tests.

Signed-off-by: Davide Depau <davide@depau.eu>
2020-10-05 20:57:05 +00:00
Peter Hutterer
788c7179a4 doc/api: fix the doxygen output handling
Using output: ['.'] broke ninja after ninja clean - it removed the whole
directory and thus the meson-generated configure_files (i.e. all the
doxygen sources we copied). ninja didn't know how to build those.

Fix this by rearranging the doxygen output to build into a different
directory now and setting the output to that. This doesn't exactly *fix*
things since that directory is no longer removed during ninja clean, but at
least the build no longer fails.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-29 17:48:31 +10:00
Kai-Chuan Hsieh
f0997536a7 quirks: Customize ALPS i2c touchpad palm detect pressure threshold
ALPS i2c touchpad support ABS_PRESSURE and ABS_MT_PRESSURE capabilities,
The default threshold 130 is too easy to across while finger movement.
It will cause the cursor stalled after the threshold is achieved, which
impacts user experience.
Test with some ALPS touchpads 0488:101A, 0488:101D, 0488:101E, the value
180 is good on those platforms.

Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
2020-09-28 12:12:51 +08:00
satrmb
03e24309fa doc: update touchpad tapping state machine diagram
Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2020-09-25 06:01:28 +00:00
satrmb
f2faf370e0 test: expand drag and multitap tests to tap with up to 3 fingers
This covers the addition of two- and three-finger tap-and-drag,
as well as the fix for multitaps with more than one finger in later taps
and the multifinger enhancement to the tap ending drag-lock.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2020-09-25 06:01:28 +00:00
satrmb
44912aa384 touchpad: fix multitaps with more than one finger while dragging is enabled
Also permits any number of fingers in the tap that terminates drag-lock.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2020-09-25 06:01:28 +00:00
satrmb
0e569077fe touchpad: allow tap-and-drag for two-finger and three-finger taps
This commit duplicates the tap states responsible for tap-and drag (TAPPED
and all DRAGGING* states) to cover two-finger and three-finger taps;
the code for the new states is shared with the existing machinery for
one-finger tap-and-drag.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2020-09-25 06:01:28 +00:00
satrmb
5e6d03ff19 touchpad: track the release of all fingers in a three-finger tap
This is in preparation for three-finger tap-and-drag, which will start from
a completed tap with no fingers down.

Signed-off-by: satrmb <10471-satrmb@users.noreply.gitlab.freedesktop.org>
2020-09-25 06:01:28 +00:00
Peter Hutterer
d35f1319de test: set the elan test device to always double up on tool bits
This is the device from
https://gitlab.freedesktop.org/libinput/libinput/-/issues/259 which sets
BTN_TOOL_PEN in addition to the real tool. Integrate this into the test device
proper so it always does this to catch various outliers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
5cda7dfa1b test: move the x/y coords a bit when testing tool type switches
More realistic, there's no way you can get the x/y coordinates exactly the
same when moving the pen back into prox.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
df2759706f test: auto-assign the tool type for tablet tests
The current tool type test merely sends BTN_TOOL_RUBBER (and others) manually
and expects libinput to do the right thing. This only tests the perfect
sequence but not test weird devices that behave differently on a tool type
switch.

So let's fix this by setting the tool type as property on the libinput test
device itself, and then emulate the tool switch through litest.
For special devices this will need extra callbacks, this is just the initial
framework to handle those buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
06e7adfca3 tablet: split a ternary condition into a normal if else for readability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
e8860fcf55 test: don't run the tool switch test on tablets that require forced prox out
This test only worked because we're emulating events that the device never
sends that way. Just skip the test, devices that require a forced prox out
probably don't handle (or even have) erasers ayway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
5eb294e434 test: remove duplicate tool type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
0e9fe09f1e tablet: group the pressure related bit into a substruct
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-22 17:35:41 +10:00
Peter Hutterer
1303adbf1b tools/record: compress a set of printfs into one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-17 12:38:53 +10:00
Peter Hutterer
6e8aba9354 tools/record: prefix the device list with a # character
Too many recordings end up with the device list at the top when users redirect
stderr and stdout to the recordings file. This breaks yaml parsing and
requires manual removal of the first few lines.

Avoid this by prefixing the lines with a command character, this way the yaml
stays correct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-17 12:38:53 +10:00
Peter Hutterer
2d641e6b7b tools/record: add --grab option
Useful to record devices like power buttons, lid switches, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 23:59:57 +00:00
weizhixiang
7dee616621 check return value for libudev/udev_monitor_filter_add_match_subsystem_devtype
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-16 23:32:51 +00:00
weizhixiang
7f2989e2aa remove extra parameter in path_disable_device()
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-16 15:56:19 +08:00
weizhixiang
bb84fcc738 check return value for udev_new()
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-15 10:42:47 +08:00
Peter Hutterer
5ebd7bd1f0 tools/replay: check the recorded udev properties against the local properties
Where a device is replayed locally for testing, its udev properties should
match the recorded properties. Otherwise the testing results will not be
reliable.

The exception here is the device group which we currently don't set for
emulated devices and even if we did, it may intentionally differ anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-11 04:36:03 +00:00
Peter Hutterer
f86d6a6e5a meson.build: add a few compiler warnings and make them compiler-conditional
These seem like a decent-enough set to have, only -Wlogical-op actually
produced a new warning.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 13:57:39 +10:00
Peter Hutterer
7ad976984e timer: fix a logic error checking the list node
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 13:57:39 +10:00
Peter Hutterer
f00e388686 quirks: fix a logical error checking for A..Z
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 13:57:39 +10:00
Peter Hutterer
c6f87ade84 meson.build: drop the separate cpp flags
All we care about for C++ is that we build.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 13:57:39 +10:00
Peter Hutterer
ad2216b4c8 meson.build: bump minimum version to 0.47
It's been out for 2 years.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 12:36:28 +10:00
Peter Hutterer
5ef4329ceb doc/api: drop the doxygen/graphviz version checks
Both of our minimum versions were released in 2012, no more need to check.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 12:36:28 +10:00
Peter Hutterer
5201ed8cc6 meson.build: update libwacom dependency to 0.27 or newer
Released in 2017, that's enough waiting

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 12:36:09 +10:00
Peter Hutterer
a62e2b14a2 Drop the trailing slash from the HTTP_DOC_LINK
It makes the printf statements nicer and we ne don't use it on its own
anywhere anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 11:36:07 +10:00
Peter Hutterer
d007a8155b meson.build: we no longer install a hwdb file, so drop the directory define
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 11:36:07 +10:00
Peter Hutterer
9fa57c6ef7 meson.build: drop a meson < 0.43 condition
We require meson 0.45, so this can no longer be triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 11:36:07 +10:00
Peter Hutterer
852f7f8e03 meson.build: bump to 1.16.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-09 11:36:07 +10:00
weizhixiang
6e03da6344 remove extra paramenter in libinput-debug-events
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-07 09:50:07 +00:00
Peter Hutterer
0c51121556 touchpad: ignore the ALPS jump to 4095/0
Some ALPS touchpad send the occasional 4095/0 event on slot 1 during
two-finger interaction before snapping back to the actual position of the
finger. There doesn't seem to be a specific heuristic to predict this so let's
hardcode those values. When detected, overwrite the current touch point with
the position of the last point. This will likely cause a small pointer jump
when the finger later moves to the real position but based on #492 this could
be a second later, so all bets are off anyway.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/492

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-07 02:13:40 +00:00
Peter Hutterer
9f8b9f5f53 doc: fix a wrongly named parameter
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-04 09:54:49 +10:00
Rosen Penev
467752047e
[clang-tidy] do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 01:17:24 -07:00
Rosen Penev
cd71a73d62
[clang-tidy] fix inconsistent declarations
Found with readability-inconsistent-declaration-parameter-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 01:00:31 -07:00
Rosen Penev
9d72909658
[clang-tidy] remove pointless return in void function
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 00:58:40 -07:00
Peter Hutterer
e926d3d919 tools: fix a replay exception when a recording has an empty quirks list
Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/520

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 08:35:12 +10:00
Peter Hutterer
36f1c85b1e gitlab CI: drop Fedora 30
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-20 06:18:02 +00:00
Alyssa Ross
81e6179b1e
quirks: add Google Pixelbook (eve)
Signed-off-by: Alyssa Ross <hi@alyssa.is>
2020-08-15 17:55:40 +00:00
Peter Hutterer
9dbfc700fe libinput 1.16.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 12:05:58 +10:00
Peter Hutterer
6d1f2f88d6 test: add two test devices for the false joystick labelling
Two devices that were affected by the regression fixed with #517

Test devices taken from:
https://gitlab.freedesktop.org/libinput/libinput/-/issues/514
https://gitlab.freedesktop.org/libinput/libinput/-/issues/515

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 11:02:33 +10:00
Peter Hutterer
84591b80a8 include: update event codes to v5.8
SW_MAX changed and the device_capability_nocaps_ignored test will fail on
older kernels. Change that test to use some other unhandled-by-libinput switch
code instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 11:02:33 +10:00
Peter Hutterer
585dab0ae2 evdev: remove now-misleading comment
libwacom has been removing ID_INPUT_JOYSTICK for years

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 11:02:33 +10:00
Peter Hutterer
88b62031b3 Revert "evdev: fix the check for tablet vs joystick"
There are a number of devices that have the ID_INPUT_JOYSTICK tag set by udev,
usually because of seemingly random event codes set. We cannot rely on
ID_INPUT_JOYSTICK to be accurate enough.

Fixes #517

This reverts commit eededbeb7f.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-13 11:02:25 +10:00
haarp
834a6d1df1 Add original MX Master to inverted-horizontal-wheel-having mice.
with help from
https://github.com/libratbag/libratbag/blob/master/data/devices/\
logitech-MX-Master.device

Signed-off-by: haarp <main.haarp@gmail.com>
2020-08-11 19:47:23 +02:00
Peter Hutterer
af6fed94d8 libinput 1.16.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-03 15:37:49 +10:00
Peter Hutterer
a014df1081 test: semi-fix the switch_suspend_with_touchpad test
This used to do nothing, now at least it does the same thing as the
corresponding keyboard test. It merely tests the switch going on/off while a
touchpad is present, so short of an unexpected error message or a crash this
test doesn't actually test for any specific behavior.

Fixes #502

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-03 15:24:45 +10:00
Diego Abad A
0e7beaa058 FIX: typo on building documentation
Signed-off-by: Diego Abad <dabada83@gmail.com>
2020-07-27 08:37:10 -05:00
Peter Hutterer
13c3b008d0 libinput 1.15.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-27 15:36:24 +10:00
Peter Hutterer
b74f03301b gitlab CI: build an rpm package to verify the installed file list
This is not a package intended for, it's a job to fail when we accidentally
change the file list. An rpmbuild job like this was what detected
f15da0f108.

The spec file resembles the Fedora one but has BuildRequires removed (we rely
on the container for that).

The same task could be achieved by keeping a file list and comparing the
installed tree but since I had the rpm spec file already, let's use that for
now.

This requires meson 0.55 which hit F32 yesterday.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-22 10:47:22 +10:00
Peter Hutterer
813a458352 gitlab CI: remove a bunch of trailing spaces
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-22 10:47:22 +10:00
Peter Hutterer
ac91d8df3b touchpad: disable jump detection on the Lenovo X1 Gen6 touchpad
This touchpad has firmware that seems to buffer events. In the words of the
reporter:

  In usage, it feels like motions vary between smooth and choppy; slow
  movements are smooth and quick movements are choppy. It's as if the
  touchpad aggregates quick movements and sends one big movement instead
  of sending discrete events. To make the movement more natural, the
  events preceding the jump should be of higher magnitude and the jump
  less pronounced, but that's just not how the touchpad works, it seems.

In the actual event data this looks exactly like a pointer jump: small
movements, one big one, then small ones again. If we filter that large
movement out we prevent the user from moving quickly.

There's no way to detect this or work around this, so let's add a quirk that
disables the jump detection for this device.

Fixes #506

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 21:58:52 +00:00
Peter Hutterer
d6c6c40fda quirks: correct modalias for the Lenovo X1 Gen6
From commit 74e20e0ae0, bug report
https://bugzilla.redhat.com/show_bug.cgi?id=1565692

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 21:58:52 +00:00
Peter Hutterer
b9ec408872 evdev: drop the check for tablet vs joystick
libwacom has been unsetting ID_INPUT_JOYSTICK for known tablets since 2015
(libwacom 0.12) so this comment is outdated. And the input-id udev builtin
never labels something as tablet *and* joystick. Which means: systemd sets
either tablet or joystick. For tablets that are known to libwacom the joystick
bit gets corrected and we only see the tablet bits.

Tablets unknown to libwacom remain as joysticks and are ignored but that's the
behavior we had anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 03:24:44 +00:00
Peter Hutterer
eededbeb7f evdev: fix the check for tablet vs joystick
A device may have ID_INPUT_JOYSTICK and ID_INPUT_KEY in which case it would
still get added, despite being a joystick device. Make sure we check only the
tablet and joystick bits - where a device has the joystick bit set but not the
tablet one we ignore it.

Note that this check will get removed in the next commit anyway, it's just
here to make tracking the change easier in the history (and figuring out where
potential regressions come from).

Fixes #415

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 03:24:44 +00:00
Peter Hutterer
c9ff7e78d9 libinput 1.15.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 09:36:48 +10:00
Peter Hutterer
c64d148372 test: rename the identifier in the 50-litest.conf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-15 09:36:48 +10:00
Peter Hutterer
0ccf43600c test: fix the ABS_Y handling for the Protocol A test device
No effect on the test results because we never use ABS_Y anyway for multitouch
devices.

Fixes #505

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-09 09:50:49 +10:00
Peter Hutterer
912a457f18 tools: add missing linebreak in error message
Missing from a0643a9c98

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-08 13:25:12 +10:00
Peter Hutterer
2e25741061 test: grab the device before any lid or tablet mode switches
Putting an EVIOCGRAB on the device before sending those events means no-one
else sees those events - particularly upower. This means no-one else knows the
lid is on or off and thus we never blank the screen (or suspend/shut down but
those are inhibited anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
86946342fb test: store the list of open file descriptors in the litest context
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
52d6398753 test: use litest_destroy_context() for test-suite contexts
Symmetrical to litest_create_context(), this allows us to store special data
in that context that we have access to during the tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
d78d662928 test: use context creation helper in the log tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
9bb8133486 test: inhibit shutdown and suspend while the tests are running
We test lid switch events which are independently handled by Upower. Let's
make sure nothing else can tell logind to suspend or shut down while we're
running.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
3403692ff0 tools: when running the test suite, start the debug-gui minimized
This allows us to run the option parsing test without getting interrupted by a
million debug-gui windows popping up for half a second.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Ryo Munakata
58d8344da9 Add quirk for Lenovo ThinkPad X1 Tablet (1st Gen)
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
2020-07-03 22:18:05 +09:00
Peter Hutterer
04e612488a gitlab CI: hook up coverity
This requires the COVERITY_SCAN_TOKEN as listed on the project settings page
in coverity itself. The intention here is to run this as a scheduled job, with
the pipeline schedule itself controlling the branch name etc. This way we can
keep the gitlab CI simple enough and just check for COVERITY_SCAN_TOKEN
itself.

This job shouldn't ever fail unless coverity is down (we'll fix that then),
the results of the coverity run are sent to the user that owns the the
scheduled pipeline, i.e. me.

Because coverity does not currently work on F32 (invalid GNU version number:
101), we force this to run on F31.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-03 06:57:54 +00:00
Peter Hutterer
1ce05ca4a5 gitlab CI: drop custom scheduled handling, set FDO_FORCE_REBUILD instead
This is a leftover from pre-ci-templates days. Now that ci-templates handles
FDO_FORCE_REBUILD remove the custom handling and for the weekly rebuild just
set that variable to 1 in the scheduled pipeline itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-03 08:54:33 +10:00
Peter Hutterer
a0643a9c98 tools: change the error message for missing tools
Given that some people appear to not read until the "is not installed" part of
the error message, let's reduce the error message to just that part. This may
be confusing where a user mistypes the actual command but that happens rarely
compared to those that can't run libinput record because it's in a different
package.

Fixes #500

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-01 01:21:21 +00:00
Peter Hutterer
f15da0f108 meson.build: don't install the quirks in a further 'quirks' subdirectory
install_subdir() by default also copies the 'quirks' directory, resulting in
the quirks files being in <datadir>/libinput/quirks/*.quirks as opposed to the
previous <datadir>/libinput/*.quirks.

Fixes 727dc44b04

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-01 10:57:20 +10:00
Peter Hutterer
ad54c0c8b3 gitlab CI: move the MR check to the deploy stage
This gives the developer enough time to file an MR after pushing a branch.
Having this run in the first stage means we get false positives because no MR
has been filed yet when the job is run.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-30 10:43:44 +10:00
Peter Hutterer
401a80d8cf doc: don't ship the .doctree files with the documentation
They're build artifacts and not needed for the actual documentation. Tell
sphinx-build to generate those files in a custom directory that's not part
of the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-26 09:28:50 +10:00
John Rodriguez
c8e8c8fb4b Add quirks file for Sony Vaio Laptop
The file contains pressure overrides for the VPCEG series.
Signed-off-by: John Rodriguez <johrodri@optonline.net>
2020-06-17 13:33:08 +00:00
Peter Hutterer
727dc44b04 meson.build: use install_subdir() to install the quirks files
This removes the need to check whether the files were added in meson.build but
requires litest to traverse the source dir now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-17 07:52:00 +00:00
Peter Hutterer
d724dc060b Replace strneq() with strstartswith() for variable prefixes
Leaving in-place all those where we know the length of the prefix, but
replacing all those where we were calling strlen on the prefix.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-17 07:52:00 +00:00
Peter Hutterer
bd1fcb9c6e utils: add strstartswith() and strendswith() utility functions
Modeled after Python's str.startswith() and str.endswith()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-17 07:52:00 +00:00
Yariv Barkan
84b3b1731a quirks: fix Apple external trackpad v2 thresholds
The external Apple "Magic" trackpads, both the first and the second
generations, have pretty good built-in spurious touch filtering. For
these device models libinput's own filtering is not required. Using low
enough values such as 20:10 effectively disables libinput's filtering.

Signed-off-by: Yariv Barkan <oigevald+libinput@gmail.com>
2020-06-17 09:46:59 +03:00
Peter Hutterer
600a0334a7 gitlab CI: check merge requests for the allow collaboration checkbox
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 20:50:37 +10:00
Peter Hutterer
425950d3bc gitlab CI: use ci-fairy for commit message checks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 20:14:39 +10:00
Peter Hutterer
9b3e0e8043 tools: per-slot-delta: if a NONE touch gets data, assume it's starting
If we have a recording that started after the touch down, let's start that
touch on the first x/y position update.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-04 10:43:33 +10:00
Peter Hutterer
9ecac89bab tools: per-slot-delta: construct the right InputEvent
d107d5 broke this tool because the InputEvent was our local datastructure,
which needed the evbit redirect.

Fixes d107d58cd2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-04 10:43:33 +10:00
Peter Hutterer
4cf4aba3fb evdev: filter unreliable tablet mode switch events
If we know that the tablet mode switch is bogus anyway, filter the event and
don't pass it to the caller. They won't know whether it's bogus so the only
result we get here is buggy behaviour.

This is the simplest solution here, it filters the mode switch at the lowest
level and thus the caller won't know that the tablet even has a mode switch at
all. Where the device doesn't have any other switches it'll also lose the
switch capability.

This may cause issues in some niche cases where the event node only has
that one bit and we now disabled it leaving us with a zero-event bit device.
Shouldn't matter to callers, but let's see.

Fixes #491

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
8ee3b7a7f2 test: fix a bunch of checks for a given switch
The has_switch() function returns -1 if the device doesn't have the switch
capability - which is the same as "true" and how we used this so far. Fix the
checks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
4058c43579 evdev: a device without any seat caps is an unhandled device
If we don't have any caps, assume the device is unhandled and ignore it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
84fda690bd fallback: add missing curly braces to match the coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
fc7b8d7948 touchpad: correct the tap state transitions for a palm on TOUCH_BEGIN
Where a touch is labelled as palm on TOUCH_BEGIN (edge palms) we would still
feed the touch through the tap state machine. This would trigger the PALM
transition for each state, usually reducing the touch count.

When the touches were later released, the touch count was out of sync,
resulting in an error message. In the case of #488, the trigger was
a single evdev frame with three fingers down, the third of which was an edge
palm:
- touch 1 transitions from IDLE to TOUCH
- touch 2 transitions from TOUCH to TOUCH_2
- touch 3 (the palm) transitioned from TOUCH_2 back to TOUCH

That third transition is invalid, the palm hasn't been seen by the tap state
machine so it should just be ignored.

Fix this by moving making the tap state processing conditional on a touch
state other than TOUCH_BEGIN.

Fixes #488

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
6e9477a86d test: move the check for edge palms on devices to litest proper
We'll need this in other files soon

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
120d42812e touchpad: add touch state debugging to the palm and tap state debug logs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
75ca6dcfa3 gitlab CI: alpine needs pip explicitly installed now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:22:56 +10:00
Peter Hutterer
2a7ea444e3 Ignore key repeat in all backends
Since we don't really care about keys in any of these backends and buttons
shouldn't autorepeat anyway, this should have no effect on functionality. But
it does guard us against potential kernel bugs like  this one:
https://www.spinics.net/lists/linux-input/msg67653.html

See https://gitlab.freedesktop.org/libinput/libinput/-/issues/447#note_468971

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-02 01:07:01 +00:00
Evan Goode
034226d904 Allow the flat acceleration profile for touchpads
Signed-off-by: Evan Goode <mail@evangoo.de>
2020-05-27 06:21:00 +00:00
Peter Hutterer
0d06bfc4e2 tablet: add support for sendevents on tablets
This is merely the simple support that we use in the fallback backend as
well. It doesn't interact with touch arbitration directly but it'll be
good enough for the default use-case.

Fixes #476

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-26 05:11:01 +00:00
Hans de Goede
3618129496 quirks: Add HP stream x360 11 ModelTabletModeNoSuspend keyboard quirk
The HP stream x360 11's embedded-controller filters out events form its
builtin keyboard when in tablet-mode itself; and it has a capacitive
home-button (windows logo) underneath its display which also sends
PS/2 key-events.

Suspending the keyboard while in tablet-mode also disable the capacitive
home button, which is undesirable.

Add a ModelTabletModeNoSuspend quirk so that the home button keeps working
when in tablet-mode. This can safely be done since the rest of the
keyboard gets disabled by the embedded-controller for us.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-05-22 04:06:40 +00:00
Peter Hutterer
ba68cdf67e tools: replay: allow for missing quirks entry in libinput recordings
Older recordings don't have that field so we should just ignore that
case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:41:05 +00:00
Peter Hutterer
ba24c95b05 test: add a test for disabling the forced prox out
This somewhat duplicates the existing test
huion_static_btn_tool_pen_disable_quirk_on_prox_out

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Peter Hutterer
0b221c6c97 tablet: handle a valid prox-out sequence after a forced proximity out
With the previous patches a tablet would ignore a valid proximity out sequence
where it happends after a forced prox-out. Fix this by checking the state when
we're in forced proximity out - if we have a zero tool state but a tool
updated then we did get a proximity out.

And fix the existing test to check for that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Peter Hutterer
c457050d44 Revert "tablet: don't disable the proximity quirk on good sequences"
This quirk was introduced for #248 was caused by buggy input-wacom drivers,
not by actual firmware, see
https://gitlab.freedesktop.org/libinput/libinput/issues/381#note_279371

This appears to be the only tablet where this fix was needed, but we've been
playing whack-a-mole ever since to work around the various other tablets that
break with this behavior in place.

So let's revert that fix and hope there aren't any other tablets out there
(and if they are, we can probably quirk those). The revert makes the ISDV4 pen
quirk obsolete (see 9cb089f2b6), so this was
folded into this commit.

This reverts commit 4f63345b60.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Matt Mayfield
73870d938e touchpad: restore thumb detection while keeping fixes from !292
!292 improved libinput's ability to detect multiple-finger clicks when
the fingers were not aligned close to horizontally. However that caused
thumb detection to fail in several use cases.

This patch restores thumb detection for
- 2+ finger physical clickpad presses
- resting thumb while two-finger scrolling
- touches in the thumb exclusion area during multi-finger taps
and improves pinch detection when thumb is centered below fingers.

It also further enhances the flexibility of finger position for 2-, 3-,
or 4-finger taps: if all tapping fingers land on the touchpad within a
short time (currently 100ms), they will all count regardless of
position (unless below the lower_thumb_line).

Signed-off-by: Matt Mayfield <mdmayfield@yahoo.com>
2020-05-22 02:16:05 +00:00
Peter Hutterer
4ff6d6e317 Deprecate wheel tilt as separate axis source
This has never been supported through the stack. No device ever had the
required MOUSE_WHEEL_TILT_VERTICAL/HORIZONTAL udev property set, so
libinput never set the right axis source. Neither weston nor mutter
added the code for it. Even if we added wheel tilt for devices now, it
would break those devices. And the benefit we get from having those
separate is miniscule at best.

So let's do the long-term thing and just deprecate this axis source.

The wheel tilt mouse test device remains in the test suite, with the
udev properties set just to verify that we do indeed ignore those now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-21 07:29:44 +00:00
Peter Hutterer
152837f44a quirks: mark the 0x233 razer keyboard as internal
Razer Blade 2018 has a different model ID than the one we already have.

Fixes #489

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-21 13:34:28 +10:00
Peter Hutterer
bd7b91065b evdev: warn if our event processing lags by 10ms or more
Take a snapshot of the time every 10 libinput_dispatch() calls. During event
processing, check if the event timestamp is more than 10ms in the past and
warn if it is. This should provide a warning to users when the compositor is
too slow to processes events but events aren't coming in fast enough to
trigger SYN_DROPPED.

Because we check the device event time against the dispatch time we may get
warnings for multiple devices on delayed processing. This is intended, it's
good to know which devices were affected.

In the test suite we need to ignore the warning though, since we compose the
events in very specific ways it's common to exceed that threshold
(particularly when calling litest_touch_move_to).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-13 06:21:27 +00:00
Peter Hutterer
2ff0c3427d test: fix the lookup for the timer offset warnings
This was changed in 5e25bdfb03 but the litest
message lookup wasn't changed. Let's do that now and change to a generic
wording we can re-use for other messages.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-13 06:21:27 +00:00
Peter Hutterer
bfccf5c405 touchpad: correct a comment regarding the touchpad integration
The previous text wasn't accurate enough, USB used to be considered
external but we've since started deferring to the hwdb for those (except
Apple).

Fixes #483

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-12 13:46:57 +10:00
Troels Blicher Petersen
50ee371c59 Lenovo X201 Tablet: Added bezel buttons support in tablet mode
This patch allows the bezel buttons,
to work when entering SW_TABLET_MODE
similar to how other x2xx tablets are
working.

Signed-off-by: Troels Blicher Petersen <troels@newtec.dk>
2020-05-08 13:18:09 +00:00
Peter Hutterer
975d036713 tools: measure-fuzz: sleep for 2 seconds to give the hwdb time
one second isn't always enough here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 16:04:58 +10:00
Peter Hutterer
28e7f62302 tools: measure-fuzz: fix the tool to work again
Where libinput is installed, checking whether the fuzz is applied to the
device will always fail with an error - the udev rules will remove the
fuzz and copy its value to the LIBINPUT_FUZZ properties instead.

So let's fix this: where the fuzz shows up on the device print a warning
because libinput's udev rule isn't working. And where it's missing check
the udev properties and compare those to the settings instead.

Fixes #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 16:04:58 +10:00
Peter Hutterer
a22137e7fd tools: measure-fuzz: run systemd-hwdb update, not udevadm hwdb
For backwards compatibility reasons, the hwdb.bin created udevadm hwdb
does not actually apply matches in the way you'd expect. systemd-hwdb
creates the newer format and is preferred.

Related: #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 15:23:23 +10:00
Peter Hutterer
3ec74cfc35 tools: measure-fuzz: handle a None return correctly
Fixes #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 15:18:42 +10:00
Peter Hutterer
58cf854124 gitlab CI: Ubuntu 19.04 is EOL, drop it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-18 05:17:52 +00:00
Peter Hutterer
d107d58cd2 tools: per-slot-delta: skip the extra evbit indirection
e.code is the evbit anyway, we don't have to convert it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-16 06:10:25 +00:00
Peter Hutterer
e48a316c02 gitlab ci: fix a templating whitespace issue
For some reason I'm too tired to investigate, the whitespace in the CI is
different than the locally generated one. Alpine must've updated something, I
guess. Quickfix it by adjusting the whitespace so it's correct again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-16 15:45:05 +10:00
Peter Hutterer
78dcbec7a4 tools: per-slot-delta: drop an unused variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 15:32:22 +10:00
Peter Hutterer
f5ab18ab8f tools: per-slot-delta: always mark slot 0 as used
If a device never sends ABS_MT_SLOT, our output was emtpy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 15:32:17 +10:00
Peter Hutterer
d88ad293d2 tools: per-slot-delta: add arguments to set a threshold and ignore-below
The threshold colors events above a certain value in red, ignore-below skips
any line below that threshold.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 14:35:27 +10:00
Peter Hutterer
61296feaee tools: per-slot-delta: init the slots with the right index
The index is unused, but useful during debugging

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:50:53 +10:00
Peter Hutterer
4e03175307 tools: per-slot-delta: move printing the slot data into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:50:53 +10:00
Peter Hutterer
5a9fb539d9 tools: per-slot-delta: print the BTN_TOUCH etc. bits in-line
New output example:

 9.408899    +5ms DBL: ↑↗    1/  -9 | →→    0/   0 |

where DBL stands for BTN_DOUBLE.

This also widens the relative time by one so we don't lose formatting for >1s
delta time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:38:48 +10:00
Peter Hutterer
c23484a9ec tools: per-slot-delta: only render the slots that have been seen
Makes the output easier to understand given that most touchpads have 5+ slots
but don't actually use them (or the users don't).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:38:48 +10:00
Loïc Yhuel
dd0370f73c quirks: correctly print boolean values
When a boolean quirk is set to "0", it is correctly disabled, but "libinput quirks list" and
"libinput record" showed it as "1".

This happens for example if ModelXXXX=0 is set in /etc/libinput/local-overrides.quirks, to
override a default quirk.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2020-04-06 23:51:01 +02:00
Peter Hutterer
c4cb4da33a util: make the trace macro actually useful
This has been there for years and I never used it. Much better to convert it
to a generically useful one (i.e. one that prints red so it's easy to see) and
make it unconditional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-04 21:10:40 +10:00
Peter Hutterer
72af32c89e tablet: use the AttrPressureRange quirk for tablets too
The Aiptek 8000U has a pressure offset above our default (%5) but no
meaningful way of detecting that. It doesn't provide distance or BTN_TOOL_PEN
either, so our heuristics can't hook onto anything. BTN_TOUCH is set by this
tablet but not at consistent pressure thresholds.

Work around this by shipping a quirk that ups it to 70. Aiptek
re-uses USB IDs because of course they do, so this applies to more than one
device. Let's see what breaks.

Fixes #462

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-31 02:49:24 +00:00
Peter Hutterer
4a9d3e8796 tools: add a measure touchpad-size tool
Replacement for the touchpad-edge-detector tool with a slightly more
expressive design, hopefully cutting down on some of the bug reports.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 15:14:45 +10:00
Peter Hutterer
101cbe16c3 tools: make the thumb threshold configurable while measuring pressure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 14:45:19 +10:00
Peter Hutterer
ef5204fda7 tools: revamp the touchpad-pressure measuring tool
Let's hope this one is more obvious to use for users.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 14:44:47 +10:00
Peter Hutterer
9351f54d1c Fix race condition causing duplicate devices in udev seats
There is a race between adding the udev monitor and enumerating current
devices. Any device added in that window will show up in both lists, causing
it to be added twice.

Fix this by comparing the syspath of any added device to the existin ones in
the seat - where it matches we can ignore the device.

Fixes #459

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 03:48:25 +00:00
Peter Hutterer
281ecf10d1 udev: don't use IMPORT+=
IMPORT really only supports == and != and for a short while udevd warned about
this before that warning was reverted again.

Where anything else is used, it falls back to ==. systemd upstream rules all
use a single = though, so let's stick with that to be consistent, even if it
is technically wrong (udevd will warn about this in debug mode).

See the long discussion in systemd upstream for details:
https://github.com/systemd/systemd/issues/14062

Fixes #461

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 00:35:43 +00:00
Peter Hutterer
1f5a27bf3d tools: add libinput analyze to the libinput tool help output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-29 15:33:24 +10:00
Peter Hutterer
1547e5b5d2 completion: add libinput analyze to zsh completions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-25 05:52:56 +00:00
Peter Hutterer
8ed234243c doc/user: add a mini-blurb for the new libinput analyze tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-25 05:52:56 +00:00
Peter Hutterer
5063f30492 gitlab CI: generate the jobs for the custom builds from the config.yaml
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-23 07:05:28 +00:00
Peter Hutterer
dedee77d62 gitlab CI: autogenerate the qemu tests for the last version of a distribution
Where want_qemu is set for a distribution, we generate the qemu tests for that
distribution for its last version listed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-23 07:05:28 +00:00
Peter Hutterer
5991023a7c gitlab CI: invert the ci-templates check
This makes the config file simpler, use a variable that is default false but
true where we need it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-23 07:05:28 +00:00
Peter Hutterer
31479b346d gitlab CI: switch the 'needs' tags to a dashed list
We don't use the [...] style list elsewhere, so let's not do this here either.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-23 07:05:28 +00:00
Peter Hutterer
d946c062d8 gitlab CI: update the various build tests to F32
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-23 07:05:28 +00:00
Peter Hutterer
cbf55a6264 gitlab issue templates: remove the checkmarks
They show up like a task list in the issue tracker and that's not useful.

Likewise, make the "attach this" more prominent by no longer making it a
comment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 22:33:01 +00:00
Martin Cihlář
4d42e9b9e2 add trust mouse quirk #455
Signed-off-by: Martin Cihlář <martin.cibule@seznam.cz>
2020-03-22 12:07:51 +01:00
Peter Hutterer
7814bcfed0 meson.build: bump to 1.15.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:51:01 +10:00
Peter Hutterer
8a858fc65e test: fix a scan-build warning (value set but not read)
This test pre-dates litest_assert_empty_queue(), so let's just use that

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:44:17 +10:00
Peter Hutterer
a1a419df6c util: fix a scan-build warning (value set but not read)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:43:52 +10:00
Peter Hutterer
05201958eb evdev: print a human time for ratelimit tests
No point in printing an interval of e.g. 2h as milliseconds, let's convert
this to something human-readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:35:21 +10:00
Peter Hutterer
150f5dc801 doc: update the jumping cursor docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 09:34:22 +10:00
Peter Hutterer
d6eef77dd2 touchpad: ratelimit the touch jump tests
In most cases these days touch jumps aren't actually fixable, they don't have
any good heuristics we can employ to remove them. And, luckily, in most cases
it doesn't matter because the users only notice the issue because of the error
message. To avoid spamming the user's log, let's ratelimit it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 09:34:22 +10:00
Peter Hutterer
bf5229a601 pad: fix a compiler warning
gcc 10 isn't happy with the implicit enum conversion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-21 23:02:13 +00:00
Peter Hutterer
33c98fed54 doc/api: remove invalid doxygen option
doxygen 1.8.17 shows this error:

error: Illegal format for option FILTER_PATTERNS, no equal sign ('=') specified for item '*.h'
error: Illegal format for option FILTER_PATTERNS, no equal sign ('=') specified for item '*.dox'

This was added in deadbf35c4 but I cannot figure out how this ever had any
effect based on the documentation for it. So let's drop it, I don't think it
has any effect anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-21 21:22:52 +10:00
Peter Hutterer
d80bbcb028 tools: record: drop quotes from os-release information
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-21 11:02:48 +10:00
Peter Hutterer
4d92ea116c tools: if pytest fails to import, skip the tool option parsing test
It's not the most important test outside of my machine and CI, so let's just
skip over it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
2020-03-20 20:42:51 +10:00
Peter Hutterer
b35a32dd9d man: install the analyze per-slot-delta man page
And add libinput analyze to the main libinput man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-20 16:10:11 +10:00
Benjamin Tissoires
09509c9de6 ci: move the ci template to the expected file for ci-fairy
this makes the command to type much easier

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2020-03-18 12:21:52 +01:00
Benjamin Tissoires
8674bfc9d1 ci: use ci-fairy to generate the template, not a custom script
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2020-03-18 12:16:12 +01:00
Benjamin Tissoires
e44d725525 ci: use the ci fairy to delete unwanted tags
here is some magic dust from https://gitlab.freedesktop.org/libevdev/libevdev/-/merge_requests/49/diffs?commit_id=325839e6401d322ed632bf30e2e0255785bb31f6#7bc093350962b0f3fe1e612f06beaba806ee061f_219_217

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2020-03-18 10:28:06 +01:00
Benjamin Tissoires
4df2ac731f ci: use latest templates, and API
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2020-03-18 09:51:31 +01:00
Peter Hutterer
d0eb8d58a3 tools: switch tool option parsing test to use pytest
pytest is more powerful than unittest, so let's switch to that instead. And in
the process fix a few tests that for some reason succeeded even though they
shouldn't have (e.g. the autorestart test).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-17 10:08:48 +10:00
Peter Hutterer
2b3fd5aa30 tools: record: use the right exit code when the output file is missing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 16:21:04 +10:00
Peter Hutterer
6ed3a0b079 tools: record: allow for an output file without --o
libinput record touchpad.yml /dev/input/eventX
or just
  libinput record touchpad.yml
are simpler invocations and since we're quite limited in what we can record
(i.e. only device files) we can just check the argument list to figure out
whether there is something to record to.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 13:04:50 +10:00
Peter Hutterer
c48e5cf9a6 gitlab: revamp the bug template a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 09:07:36 +10:00
Peter Hutterer
e11bad41f5 tools: add a libinput analyze command with the per-slot-delta subcommand
I've been using this script ever since libinput record was available, might as
well ship it with libinput so I don't have to remember where it lives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 08:35:43 +10:00
Peter Hutterer
927a7c0745 tools: fix a typo in a man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-12 11:02:57 +10:00
Peter Hutterer
850925910f tools: record: fix dmi recording
Processing os-release in the same buffer that the dmi modalias used caused the
dmi to be recorded as 'dmi: "VERSION_ID=31"'. The cause for that was simply
that the dmi modalias was read but not printed until after the os-release
information was processed.

Fix this two-fold: rearrange that each part now reads and prints in
one go, and rename the buffers so we don't re-use them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-09 10:20:49 +10:00
Peter Hutterer
a1c8909337 libinput 1.15.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-06 13:23:38 +10:00
Peter Hutterer
cd5af1a4f6 touchpad: only reduce the slot count for ALPS serial touchpads
We're getting too many regressions on other devices for this feature and only
ALPS touchpads need it (it's a kernel driver bug). So let's limit this to
those devices only.

For example, synaptics serial touchpads don't keep the fake fingers and slot
states in sync when going from two to three fingers, causing an erroneous slot
downgrade. See
https://gitlab.freedesktop.org/libinput/libinput/issues/434#note_419912
That interferes with this code but fixing it is hard and anyway,
synaptics touchpads don't need the slot count drop.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-05 16:35:53 +10:00
Peter Hutterer
c7f06b0bdd quirks: rename the alps touchpad quirk to note it's a serial TP quirk
This quirk only applies to serial ALPS touchpads, so let's name it
accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-05 16:35:53 +10:00
Peter Hutterer
cd574ed5ef touchpad: add a note to the synaptics touch restore feature
We have code in place to handle the quirky transition from two to three
fingers (where one slot ends and another one starts). We do not handle the
same issue when transitioning from three to two fingers.

This is a note only because it hasn't mattered so far, at least until
eb6ef9fe70 from #408. And it doesn't matter anymore now either
because that code is now only called for ALPS devices.

https://gitlab.freedesktop.org/libinput/libinput/issues/434#note_419912

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-05 16:35:53 +10:00
Peter Hutterer
7b94955634 test: fix a coverity complaint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-02 12:51:15 +10:00
Peter Hutterer
f657d83428 gitlab CI: drop the distribution "flavor" in favor of using the name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-26 13:56:00 +10:00
Peter Hutterer
ebfb1e770e gitlab CI: split the task to run on a VM out from the host system
No functional changes here, it just makes the actual task more generic

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-26 13:56:00 +10:00
Peter Hutterer
dd8dcaaa94 gitlab CI: drop the distro name from the VM jobs
This changes rarely and it doesn't carry a lot of information anyway, at least
compared to the jobs that are specifically designed to build on various
distributions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-26 13:56:00 +10:00
Peter Hutterer
5eb53418b3 gitlab CI: update to latest ci-templates
Removes the special distro "flavor" handling for arch and it gives us nicer
warnings for VM failures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 19:46:05 +10:00
Peter Hutterer
712eb10aad gitlab CI: run the kvm test suite without libwacom
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 06:45:01 +00:00
Peter Hutterer
6d173f890a test: disable a bunch of tests relying on libwacom
Some of these may have a non-libwacom solution but let's be honest, you
shouldn't be skipping libwacom if you rely on tablets to be precise.

Fixes #436

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 06:45:01 +00:00
Peter Hutterer
200fd44439 gitlab CI: pass the MESON_ARGS through to the VM as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 06:45:01 +00:00
Peter Hutterer
8e2a107d07 gitlab CI: mark the template file as yaml file for vim
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 06:45:01 +00:00
Peter Hutterer
dafb68f306 gitlab CI: don't run meson test on the scan-build job
Unfortunate side-effect of this: scan-build would store the logs in the build
dir, only for them to be immediately wiped by meson test. And that never
generated the scan-build warnings.

So this job was complaining about (minor) issues for a while, they just never
made it to the GUI as CI failures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 01:53:21 +00:00
Peter Hutterer
20cf83789d tools: constify the optarg handling of seats
This shuts up scan-build complaining about memory leaks in libinput
debug-events (needs the right combination of --device option and eventually
triggering usage()) and saves us a bunch of unnecessary allocations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 01:53:21 +00:00
Peter Hutterer
2bfbdfaf6b test: remove double-assignment to a variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 01:53:21 +00:00
Peter Hutterer
6a604d7c2f gitlab CI: don't push to wayland web on scheduled jobs
We have a set of scheduled jobs to rebuild images and clean out old
containers, but since they're largely unsupervised (i.e. not in response to a
MR) we don't want to update the official documentation - just in case
something goes wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 00:56:38 +00:00
Peter Hutterer
44988f411b tools: replay: mkdir /etc/libinput if it doesn't exist yet
Where we're replaying a device with quirks, those quirks will be placed into
/etc/libinput/local-overrides.quirks. For that to work, /etc/libinput needs to
exist so let's make it where required.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 09:59:31 +10:00
Peter Hutterer
294298880d tools: record: fix fallback os-release file handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-21 11:42:01 +10:00
Peter Hutterer
b2cda3f4b7 gitlab CI: rename the custom build jobs
The distro we're running on is a side-effect, it's more important to see the
bit that describes what the job actually does.

And while we're there, shuffle the hierarchy a bit for less duplication.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:39:32 +10:00
Peter Hutterer
50d916467b gitlab CI: use a separate variable for the template list
Just because I feel more comfortable with having this code in python than in
the templates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:39:32 +10:00
Peter Hutterer
3a7412a4d7 gitlab CI: don't hard-code the arch/alpine versions
We only have one each and they're not really versions anyway but now that it
is all generated through templates, let's be consistent with the rest of the
CI script.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:39:32 +10:00
Peter Hutterer
02f5da42b2 gitlab CI: generate the various default-builds through templating
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:39:32 +10:00
Peter Hutterer
90888ab9f2 gitlab CI: generate the VM tests through the templates as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:38:46 +10:00
Peter Hutterer
f5506d1f22 gitlab CI: generate the CI script from a template
All the distro-specific stuff is the same template anyway, so let's generate
this (like we already do in libevdev and the ci-templates).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 13:38:39 +10:00
Peter Hutterer
acc60b9fb0 gitlab CI: add a comment to explain one of the jobs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 11:36:23 +10:00
Peter Hutterer
a2f354bb48 gitlab CI: whitespace fixes for better visual alignments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 11:26:06 +10:00
Peter Hutterer
a3fb9bd7db libinput 1.15.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-20 11:21:16 +10:00
Peter Hutterer
428acee867 tools: record: record basic os-release information as well
Because sometimes it's useful to know what distro a recording was made on, and
the kernel version doesn't always reveal that.

Fixes #428

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 08:31:18 +00:00
Peter Hutterer
7198e33ecf tools: record: rename a variable to just buf
Better name for re-use

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 08:31:17 +00:00
Peter Hutterer
1954523309 gitlab CI: handling killing the qemu process better
If qemu has already shut down by the time we call kill, pgrep returns nothing
and we fail the script. Let's not do that. And let's replace kill pgrep with
just pkill in the process.

Let's get rid of the after_script part too, gitlab kills any process started
in the main script anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 08:03:30 +00:00
Peter Hutterer
337ab84599 gitlab CI: print a warning when our VM startup fails
This happens on packet-3 and packet-4 atm, so let's print out a clear warning
that whatever the failure is, it's not directly related to libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 07:45:40 +00:00
Peter Hutterer
06591e5913 touchpad: sync the initial tracking id state to the touchpad
Where fingers are down during startup we need to sync them to the known state
of the device so our slot count is correct. Otherwise, when the fingers are
lifted we will trigger the new assert for nactive_slots being less than 0.

Regression introduced in eb6ef9fe70

Fixes #429

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-18 17:11:35 +10:00
Peter Hutterer
1e1b9c0e60 touchpad: never reduce the slot count to 0
Where a user releases all touches during a SYN_DROPPED and then puts more than
one finger back down before we sync, we end up with nonzero fake touches but
a zero slot count. This is caused by a wrong event sequences provided by
libevdev in that case.

This really needs to be fixed in libevdev, see
https://gitlab.freedesktop.org/libevdev/libevdev/merge_requests/19

In the meantime, put a check in to ignore that case and never reduce the slot
count to 0. It still leaves us open for some issues where 3fg gestures may
stop working if the right sequences are triggered during SYN_DROPPED but
updating libevdev will eventually make that go away too.

Fixes #422

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-18 06:26:56 +00:00
Victor Brekenfeld
0da2e744ea quirks: Add quirk for MadCatz RAT7 mouse
Signed-off-by: Victor Brekenfeld <github@drakulix.de>
2020-02-15 20:24:00 +01:00
Peter Hutterer
07a86b85dd tablet: don't force a proximity out while buttons are down
While buttons are down, don't let a forced proximity out happen. If the tablet
goes out of proximity normally that's fine but we don't force a proximity out.

Remains to be seen if this causes stuck buttons now on devices that rely on
the forced proximity out...

Fixes #403

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
ea78fef450 test: drop a wait in favor of direct event processing
We know we should have an event here, so we might as well process it
immediately to speed the error case up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
664ecaa152 test: fix a duplicate button down where we want a button press + release
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
eb085bddec test: mark the tablets that require forced prox out as such
Because certain things are hard to test when you have to guess whether a
tablet has forced proximity out or not. Currently unused, see future patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
0dcb02d369 test: add a test case for checking EVDEV_ABS overrides
Problem: it's still not a 100% check because the way real udev handles the
EVDEV_ABS overrides ignores any that are set through udev properties only. So
we manually have to trigger the keyboard builtin for our test device which
can give us false positives (e.g. it wouldn't have detected #424). But still,
it'll alert us if the actual overridden values are different to what we
expect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 21:22:01 +10:00
Peter Hutterer
5a51add5f3 test: drop the #define for the litest device rules
This was more useful when we installed multiple device rules but now it's only
one file anyway. Also, this drops the inadvertant double-dash
(e.g. 99-litest--Jo7Ji8.rules) which made the file name look like some
substitution was missing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 19:23:36 +10:00
Peter Hutterer
8040f94637 udev: directly import the device groups
No need for the indirection of PROGRAM, then ENV for the output value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 19:23:36 +10:00
Peter Hutterer
19898eb2b2 udev: *add* the fuzz-to-zero program to the udev RUN list, don't overwrite
For historical reasons, the keyboard builtin that sets the EVDEV_ABS values is
added as RUN. When we add our own fuzz-to-zero tool we must use +=, just using
an equals overwrites the existing RUN list.

The same is true for the IMPORT command we use to extract the fuzz to begin
with.

Fixes #424

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 19:22:50 +10:00
Peter Hutterer
ed1d181cf6 tools: record: record the EVDEV_ABS properties correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-07 16:18:27 +10:00
Peter Hutterer
ac2cfea5d2 libinput 1.15.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-03 14:28:44 +10:00
Peter Hutterer
71830dd460 tablet: fix the handling of axis updates after a forced proximity out
Where a pen was forced out of proximity and an eraser came into proximity
without axis updates on the prox-in, subsequent axis updates would trigger the
pen back into proximity. This resulted in two tools in proximity at once
though the new pen never went out of proximity

This would trigger crashes in various compositors/applications, see
https://github.com/xournalpp/xournalpp/issues/1141#issuecomment-578362497

The cause was a wrong condition introduced in ffd8c71e4e. We only need to
force the pen bit on if the current tool state is currently zero and no tool
update was sent with the axis event. In our case, the tool state is nonzero
already (eraser) and we can skip this bit.

Fixes #418

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
8705aba2ea test: add helper functions for checking proximity events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
736de2f9a7 test: add a comment to a test device
Just so I don't have to look up the git history next time

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
0a2bbdf6e7 tools: record: record the EV_ABS deltas along with the absolute value
It's useful to have this in the immediate recording. Example output now:

 - evdev:
    - [  2, 300309,   3,  47,       0] # EV_ABS / ABS_MT_SLOT               0
    - [  2, 300309,   3,  54,    3547] # EV_ABS / ABS_MT_POSITION_Y      3547 (+8)
    - [  2, 300309,   3,  58,      70] # EV_ABS / ABS_MT_PRESSURE          70 (-14)
    - [  2, 300309,   3,  47,       1] # EV_ABS / ABS_MT_SLOT               1
    - [  2, 300309,   3,  54,    3112] # EV_ABS / ABS_MT_POSITION_Y      3112 (+4)
    - [  2, 300309,   3,  58,      68] # EV_ABS / ABS_MT_PRESSURE          68 (-4)
    - [  2, 300309,   3,   1,    3547] # EV_ABS / ABS_Y                  3547 (+8)
    - [  2, 300309,   3,  24,      70] # EV_ABS / ABS_PRESSURE             70 (-14)
    - [  2, 300309,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +49ms

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 10:40:49 +00:00
Peter Hutterer
2059a015ae tools: fix typo in debug-events man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 17:28:15 +10:00
Peter Hutterer
5e25bdfb03 timer: make the timer offset error a bit more user-friendly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 13:03:00 +10:00
Peter Hutterer
da9eace8db tools: record: fix broken event time stamp recording
event->time ended up being an uninitialized field. Introduced in 5dc1a7e, the
event here isn't a struct input event but rather our internal event struct.
Fix this and reshuffle the time handling a bit so it's a bit more obvious
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
fb1f0a6886 tools: record: wrap the time offset handling into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
8e35a2f949 tools: refuse to replay recordings with timestamps from the future
This indicates a bug in libinput record, might as well complain about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
acfec31103 tools: align the tool type names on proximity nicely
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Jacob Kauffmann
aa3001668a doc/user: Fix grammar.
Signed-off-by: Jacob Kauffmann <jacob@system76.com>
2020-01-30 00:52:33 +00:00
Peter Hutterer
eb6ef9fe70 touchpad: correct a wrong slot count by the kernel
alps.c hardcodes 5 slots in the kernel but some devices only provide 2 slots
plus BTN_TOOL_TRIPLETAP, etc. Fix this by counting active slots and when the
fake finger count exceeds the active slots but is still less than the number
of slots, adjust the slots themselves downwards.

And because the new test device messes with our slot count assumptions for the
various tests hardcode that one device to return 2 slots.

Fixes #408

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
56f1ac2b72 test: make the custom touch override methods filter-able
Let those functions return true if they handled the event or false where they
didn't. This makes it more flexible to override touches in special cases only
and fall back to the normal litest handling otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
8fdeba9ea2 test: wrap slot counting into a helper function
This is prep work for future devices that announce a wrong slot count. For the
tests this can be a problem if we rely on the correct slot count to decided
whether to run a test or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
William Brown
63ac196def Improve git commit section
It wasn't clear about the Signed-of-by requirements, so this has been
improved with an example, and clarifies that it is a requirement, not
optional.

Signed-off-by: William Brown <william@blackhats.net.au>
2020-01-29 13:32:55 +10:00
William Brown
e5a6200a8e Small improvements to contributing for accessibility.
This makes a small number of changes that can help improve onboarding
and diversity of contributors. Key to point out is that the code of
conduct is now one of the first items, to highlight the community
standards (rather than being at the bottom where it can be
overlooked). The use of the work "hack" often is off putting to
many people, so replaced with "work". Additionally, changed
the introduction to highlight a desire to be inclusive.

A follow up you probably could do, is have a "how to prepare the
development environment" aka "what depenedencies do I need for
my distro to build the project.

Much of this has come from experience working with outreach/diversity
experts, and my own experience on

http://www.port389.org/docs/389ds/contributing.html

Signed-off-by: William Brown <william@blackhats.net.au>
2020-01-29 13:21:02 +10:00
Peter Hutterer
78e22d5910 doc/user: explain the gitlab issue tags
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-21 11:47:42 +10:00
Peter Hutterer
63169c8252 doc/user: some minor improvements
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-21 11:47:42 +10:00
A. Wilcox
ab377baa12 evdev-fallback: Use input_event_init for fallback
Old-style field initialisation ignores the 64-bit time_t change in
Linux UAPI, which causes the structure to be incompletely initialised
on 32-bit systems with the 64-bit time_t kernel headers.

This patch uses the input_event_init helper from the original 64-bit
time_t enablement patch.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
Fixes: 5dc1a7ebd ("Adjust for 64bit time_t for 32bit architectures")
See-Also: libinput/libinput!346
2020-01-20 03:37:57 +00:00
Peter Hutterer
2fe672ecee gitlab CI: retry the VM jobs on script failure
Unfortunately the various VM jobs are timing sensitive and create a bunch of
false positives if the runners are under load and miss out on some of the
events (the tablet proximity handling is a particularly bad test here).
Let's retry on failure first to give the CI more opportunity to maybe succeed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-20 11:25:22 +10:00
Peter Hutterer
2d77260ba5 doc/user: expand the contributing document and make it top-level
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-20 09:14:44 +10:00
Peter Hutterer
ce8b256f91 tools: fix abort caused by the pointing stick integration quirk
See #400

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-15 14:12:12 +10:00
Peter Hutterer
9149c09a3b test: switch from counting slot max to num_slots
Much more human-readable this way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Peter Hutterer
b4fa301d1f test: simplify a slot count check
Smaller than 3 and greater or equal to 4 means - well, anything that's not 3.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Peter Hutterer
62df51789b test: fix some wrong touchpad slot range checks
This was excluding tests from some touchpads due to slot count confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Michael Forney
25a940a549 litest: Fix warnings about discarded qualifiers with check-0.13.0
check 0.13.0 introduced a new struct type TTest for test functions
instead of just a function. However, now the tcase_add_* functions use
`const Ttest *`, and since litest stores the test case in a `void *`,
we get warnings like the following:

../test/test-touchpad.c:7079:30: warning: passing argument 3 of '_litest_add' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  litest_add("touchpad:fuzz", touchpad_fuzz, LITEST_TOUCHPAD, LITEST_ANY);

To fix this, use `const void *`, which is compatible with both APIs.

Signed-off-by: Michael Forney <mforney@mforney.org>
2020-01-03 18:31:33 -08:00
Peter Hutterer
4d15fdf3e8 libinput 1.15.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-03 16:44:03 +10:00
Peter Hutterer
148b147173 test: indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-03 16:44:03 +10:00
Peter Hutterer
bfc4980754 test: add the test cases to the suite in the utils tests
oops...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-03 16:44:03 +10:00
Peter Hutterer
5c04bc1851 doc/user: fix some HTML formatting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-02 22:30:22 +00:00
Björn Daase
b80413f2d5 quirks: fix horizontal scrolling for Logitech MX Master 2S on bluetooth
It turns out that the MX Master 2S also has a different PID when connected
via bluetooth, causing horizontal scrolling to not work properly. Fix this,
by also adding it with the blueetooth PID (according to
https://github.com/libratbag/libratbag/blob/master/data/devices/logitech-MX-Master-2S.device
and in line with local testing) to the quirks file.

Signed-off-by: Björn Daase <bjoern@daase.net>
2019-12-26 11:09:00 +01:00
Peter Hutterer
565f9470ff meson.build: re-add missing trailing slash to the HTTP link
Got lost in 61f81ec93e

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-23 10:57:53 +10:00
Peter Hutterer
104e4a7d49 gitlab CI: update to latest ci-templates
Rebuild all the images to make sure this still works fine.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-12 09:00:04 +10:00
Anatolii Lishchynskyi
970b5aff59 quirks: ignore mode switch button on Madcatz R.A.T.3 mouse
Avoid stuck buttons, so window managers won't behave buggy, for example:
* You click on one window, but click is emulated in another one
* You hover cursor over button/link but see no feedback
Based on quirk for Cyborg mouse.

Signed-off-by: Anatolii Lishchynskyi <iamnotacake@protonmail.com>
2019-12-11 09:45:49 +00:00
Peter Hutterer
6c55880a7d gitlab CI: fix skopeo copy
skopeo doesn't handle the destination credentials correctly

See ci-templates commit 0a9bdd33a98f05af6761ab118b5074952242aab0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-11 15:29:11 +10:00
Peter Hutterer
1f49167b69 gitlab CI: use a minimal alpine image for the commit checks
This runs at the same time as the other images being created so it'll fail if
the image itself doesn't exist yet. Since we only need pip here, let's use
alpine and install the two packages we need.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-11 12:25:56 +10:00
Peter Hutterer
8f0af85072 libinput 1.14.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 13:50:24 +10:00
Peter Hutterer
6c2125d1df gitlab CI: add an explanatory comment why we're hardcoding master
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 10:40:40 +10:00
Peter Hutterer
9d996a0420 gitlab CI: add a local emulation mode to the gitlab CI script
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 10:40:40 +10:00
Peter Hutterer
902806c750 gitlab CI: make the commit check errors more verbose and useful
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 10:40:40 +10:00
Peter Hutterer
7f2749a03d gitlab CI: don't try adding the upstream remote if it exists already
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 10:40:40 +10:00
Peter Hutterer
11e97c2e64 Expand the CODING_STYLE with an explanation of commit requirements
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-05 10:40:37 +10:00
Peter Hutterer
2d1bcf982a pad: add LIBINPUT_EVENT_TABLET_PAD_KEY for pad keys
The Wacom Cintiq 24HD and later tablets send specific key events for
hardware/soft buttons. KEY_PROG1..KEY_PROG3 on earlier tablets,
KEY_CONTROLPANEL, KEY_ONSCREEN_DISPLAY, and KEY_BUTTONCONFIG on later tablets.
We ignore KEY_PROG1-3 because starting with kernel 5.4 older tablets will too
use the better-named #defines.

These differ from pad buttons as the key code in itself carries semantic
information, so we should pass them on as-is instead of mapping them to
meaningless 0-indexed buttons like we do on the other buttons.

So let's add a new event, LIBINPUT_EVENT_TABLET_PAD_KEY and the associated
functions to handle that case.

Pad keys have a fixed hw-defined semantic meaning and are thus not part of
a tablet mode group.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 15:38:39 +10:00
Peter Hutterer
27fda918d8 pad: switch the button mapping to one that can handle keys or buttons
No functional changes, we still use the same bits everywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 15:31:46 +10:00
Peter Hutterer
9696f37393 tools: debug-events: don't overrun the device array with too many arguments
Only the --device option was checked for argument count, not the rest so it's
easy to overrun the array by specifying too many devices.

Except: this was a theoretical bug only, more than 64 arguments trigger
an assertion in the argv processing in tools/shared.c anyway. Let's drop the
debug-events limit to 60 devices so we can at least have a test for this.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 12:50:11 +10:00
Peter Hutterer
b8bbf424de gitlab CI: run the meson script for the VMs as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 14:36:00 +01:00
Peter Hutterer
142399f8a3 gitlab CI: move the build instructions into a bash file
Extending/debugging scripts in the gitlab CI directly is a pain, the
turnaround cycle is terrible. Let's move this into a shellscript that we can
just call directly.

Bonus side-effect: if we wanted to extend the script: set somewhere, this is
now much easier to override.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 14:35:55 +01:00
Peter Hutterer
3f051ca9d8 gitlab CI: add meson to junit script
This script was written by Emmanuele Bassi, copied from
https://gist.github.com/ebassi/e5296ec77ae9e0d3a33fd483b5613b09/

It converts meson test results into a junit file which we can then use to
display in the merge request GUI.

Note that as litest writes out junit files as well, some tests are reported
twice. Specifically: where litest fails the failure will be reported once
through litest itself and once by meson test. Oh well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 11:52:54 +01:00
Peter Hutterer
3ac525db19 test: write our test case results out as junit xml files
libcheck has the ability to write out XML files for test results, but
converting those into junit isn't ideal, for a number of reasons:
- junit xml is different to libcheck's xml, so not all data is available or
  useful. Especially with our litest wrappers around it.
- litest forking off tests means we have to wrap around everything anyway to
  avoid multiple forks writing to the same test file.

This is the minimal implementation since it's only user is likely the CI which
we control fairly tightly. So there are a few corners we can skip:
- no filename validation is performed by litest
- we write out a lot of junit xml files (one per litest fork). Rather than
  collating those we just rely on the CI to find the files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 11:52:54 +01:00
Peter Hutterer
773b322e8b gitlab CI: apply some basic validity checks on the commit messages
Let's stop merge requests from users that don't set their git author name and
email address. Aside from it looking stange in the history it'll also make it
virtually impossible to ever find that user again should something important
arise in the future - especially if we switch off gitlab.

The rest is basic style, short subject lines, Signed-off-by lines and correct
formatting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[bentiss: use /usr/bin/env python3 as requested by the CI]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-11-28 11:43:26 +01:00
Peter Hutterer
c63c3b2f7b gitlab CI: rename the container_prep state to just "prep"
So we can shove other stuff in there without it looking strange.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 11:15:27 +01:00
Peter Hutterer
6824125412 gitlab CI: use multiple extends for the default artifact/build snippets
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 05:00:26 +00:00
Peter Hutterer
caa3ea7801 gitlab CI: use multiple extends over anchors for the upstream pull
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 05:00:26 +00:00
Peter Hutterer
a3a1f4f3d9 gitlab CI: add a global policy snippet for retries and interruptible
We want to retry if we have a system/timeout/stuck failure. And our jobs are
all interruptible, we want to cancel them when the branch has new commits.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 05:00:26 +00:00
Peter Hutterer
25105d0434 gitlab CI: split all extends into multiple lines
No functional changes, this merely prepares the file for easier multiple
extends.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 05:00:26 +00:00
Peter Hutterer
47767290a7 tools: print the libinput version in debug-events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 15:16:30 +10:00
Peter Hutterer
eb16ce2520 tools: libinput-record: drop the explicit --multiple argument
If we want to record multiple events, let's just specify multiple event nodes.
No need for a specific extra argument here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
5a275ef171 tools: libinput-record: return the correct exit value on invalid usage
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
1457ac8446 tools: libinput-record: bail out on invalid commandline arguments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
03bc7121eb tools: print stderr/stdout when a option test fails
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
5dc1a7ebd3 Adjust for 64bit time_t for 32bit architectures
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-26 15:11:44 +10:00
satrmb
29785df999 touchpad: simplify tapping state machine by eliminating the multitap states
Alternating between TAPPED and DRAGGING_OR_MULTITAP on repeated taps is enough, no need for more states.
2019-11-26 02:34:44 +00:00
satrmb
bba79754d6 test: fix a multitap test expecting one tap too few
The problem was masked by a missing timeout, causing one up / down pair to not yet be enqueued before reading the queue.
2019-11-26 02:34:44 +00:00
Peter Hutterer
490131ff61 tools: make debug-events accept multiple device nodes
For interaction between devices it's necessary to look at more than one device
at a time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-26 00:34:08 +00:00
Peter Hutterer
765f7917bb tools: replay: fix wrong timestamps for multiple device replay
When multiple devices are recorded, the event times are offset from a global
baseline. Each device thus has a different offset for the first event. To
replay correctly, we must figure out the offset of the first event (across all
devices) and use that for all of them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-25 23:06:09 +00:00
Rasmus Thomsen
8b492eaaa5 Add Palm&ThumbPressureThreshold for the Spectre x360 15-ch0xx
Without this palm rejection doesn't work properly, making typing pretty
annoying.
2019-11-25 02:02:55 +00:00
Peter Hutterer
61ce80c5b1 completion: add the new libinput debug-tablet to the zsh completion files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-19 14:48:54 +10:00
Peter Hutterer
f87a6203ee tools: print the tip state in the tablet debugging tool 2019-11-19 09:56:14 +10:00
Peter Hutterer
c9e9ea3840 tools: add stylus button support
For the evdev events only a few hand-selected ones, all other ones are ignored
for now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-19 09:56:14 +10:00
Peter Hutterer
733eb07eda tools: add a tablet debugging tool
Nothing sophisticated but easier to debug certain tablet oddities.
It shows a bar for each axis on the tablet (and the evdev axis) and prints
that relative to the axis range. This makes it easy to check if we do hit the
full range (especially for distance/pressure/tilt) and whether that matches
with what the device gives us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-19 09:56:14 +10:00
Peter Hutterer
2c613feb0c tools: debug-events: expand timestamp prints to full millis
Tens of millis is not quite enough in some cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 22:43:48 +00:00
Peter Hutterer
558cc3f11c tools: debug-events: offset timestamps by the first normal event
Start counting the timestamps from the first time we get something off the
actual fd. This makes it easier to match up timestamps with the output from
libinput record.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 22:43:48 +00:00
Peter Hutterer
eef00ff3c6 tools: libinput-record: expand the evdev event value to 7 digits
MSC_TIMESTAMPS need 7 digits so let's make sure everything is nicely aligned

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 05:34:56 +00:00
Peter Hutterer
db546c368c doc: remove the direct link to the various state diagrams
draw.io is playing up with old files and sending me into a redirect loop.
Duplicating files works but that changes the links. So to avoid dead links,
let's just remove the direct link and let anyone who cares enough about it ask
me.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
a524cf9761 test: allow for substring matching in the various --filter- arguments
A unique substring of a test/group/device should be enough to filter, even
without surrounding it with asterisks.

This allows for things like --filter-device=t440 as opposed to the previous
--filter-device="*t440*".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
2c4105ae51 doc: updates to the tap state machine
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
271616265b touchpad: don't allow for multifinger tapping after a move
In the current implementation, movements > threshold and timeouts usually move
to HOLD state and continue from there. Where a finger is lifted, we go back
up the diagram into the previous finger count's HOLD state.

The side-effect of this is that a tap of a finger can be counted as tap even
after a movement:

- two fingers down, move to scroll, hold down
- third finger down, third finger up

This sequence triggers an erroneous three-finger tap. Once the motion
threshold is hit by any touch, no finger must trigger 2/3 finger tap events
while any touch is down.

The false tap is only triggered where the new finger can execute a tap without
any other finger changing any property. This can be triggered on the
reporter's Dell Precision 5520 but on most other touchpads, a new finger down
will trigger slight movement, pressure or touch size updates and thus the bug
cannot be triggered.

Fixes #382

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
c5f5a0fa7b test: fix a pressure test to movement during tap
The motion event here was intended to offset the light pressure from the
extended touch down. This also causes motion past the tap threshold and won't
work with a future patch.

Make the touch "real" by simply plaing a normal movement in the current
position - the kernel will filter and we'll just update the pressure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Philipp Fischbeck
6f4ca7cd50 Fix typo in zsh completion 2019-11-14 20:28:00 +00:00
Peter Hutterer
3205c29c60 meson.build: drop the explicit -g flag
Let's rely on meson to set this for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-06 11:48:49 +10:00
Peter Hutterer
eab156ef74 gitlab CI: work around collapsed multiline commands in the rebuild check
Multiline commands are currently collapsed with no way of uncollapsing them
(https://gitlab.com/gitlab-org/gitlab-runner/issues/3392), so we never see the
skopeo invocations. Work around this by touching a file when scheduled and
using that to break up the conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 11:00:16 +10:00
Peter Hutterer
b9bfaebba2 gitlab CI: allow the qemu-prep job to fail, runners are unreliable
The qemu jobs themselves already have this tag so let's add it to the
container prep itself too. Unfortunately the CI doesn't have a conditional
allow-failure (ideally we want retry's stuck_or_timeout_failure condition).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 11:00:16 +10:00
Peter Hutterer
bdd798778a test: remove the hardcoded four-job valgrind test run
Make this dependent on the number of processes too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 00:54:32 +00:00
Peter Hutterer
c6905dcd0b test: drop a now-obsolete test
As of d20bbfa5cb we handle the direct tool switch correctly so there's
no more warning. Which means testing for the warning is pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 00:12:08 +00:00
Peter Hutterer
53200be4ae gitlab CI: add diffutils to the Fedora RPMs
Needed for the symbols leak test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-04 23:32:34 +00:00
Peter Hutterer
d20bbfa5cb tablet: handle a direct tool switch correctly
Fixes #259

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 23:27:39 +00:00
Peter Hutterer
bc461b0292 tablet: add a helper function to get the current tool
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 23:27:39 +00:00
Peter Hutterer
12021c860e tools: debug-gui: show pressure/distance as vertical bar
Both of these are normalized so let's draw a bar that shows the values
accordingly. This makes it a lot easier to check whether pressure values go to
the maximum, etc.

A little extra square is shown whenever the tip is logically down.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 08:38:59 +10:00
Peter Hutterer
7bd96ec923 gitlab CI: split the qemu test runs up into multiple jobs
The tests are split by topic but have varying runtime. Specifically, the
longest test (touchpad) takes ~170s whereas many of the others can take less
than a second. Splitting them all up into separate VMs costs too much in
startup time so here's the middle ground of some custom grouping to make the
tests roughly run the same time.

This list will need to be manually maintained but given that groups are rarely
added anyway this shouldn't be too much of a maintenance burden. And bonus:
since the kvm tests often fail due to timing issues, re-running one is
significantly faster now.

This shaves about 8min of the CI run

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 15:53:36 +10:00
Peter Hutterer
b6343d0a3f gitlab CI: fix an indentation issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 10:40:40 +10:00
Peter Hutterer
2f22580deb test: remove a useless assignment
copy/paste error that makes coverity unhappy. This is the code to correctly
release all touches and the buttons have already been processed above - no
need to reassign here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:43:18 +10:00
Peter Hutterer
3819b21967 test: silence a coverity warning
Coverity complains that we call libinput_event_destroy() twice on the variable
(once in and once just outside the condition). This is technically correct but
never true because we always break the loop early for the touch up/frame events.
Let's just reset the pointers so coverity is happy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:38:59 +10:00
Peter Hutterer
cfa06b6098 test: remove some useless code triggering a coverity warning
x/y assigned but never used. Dropping those few lines gets rid of the warning
and checks the coordinates correctly now too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:29:46 +10:00
Peter Hutterer
883e0a1eea tools: drop the specific libinput measure tools from the libinput man page
libinput measure lists them all anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 11:08:19 +10:00
Peter Hutterer
31dd2ba2f1 tools: correct libinput measure reference to the tap man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 11:08:19 +10:00
Peter Hutterer
454dd4a2cb test: make the test jobs dependent on the number of processors
Let's hope the test suite is more successful on puny VMs that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 08:01:00 +10:00
Konstantin Kharlamov
f3c132042e libinput-list-devices: make paragraph about different settings terser
Changes are:

1. "configuration options" is same as "options"
2. The clarification "e.g. scrolling" doesn't clarify anything because a
user don't necessarily knows there're "2-finger scroll" and
"edge-scroll"; and even if they do, they can imagine the settings to be
represented by "0" and "1" values, which then begs a question: why
aren't all "Enabled/Disabled" settings are prefixed with "*" too.
   Instead, replace the vague `multiple different settings` with more
specific `more settings than "enabled/disabled"`.
3. "ones" is shorter than "settings" and makes sure a user haven't lost
context.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-10-28 05:40:02 +00:00
Konstantin Kharlamov
404e69e93b libinput-list-devices: be more explicit about only listing defaults
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-10-28 05:40:02 +00:00
Sven Slootweg
f312cb803c quirks: add RollerMouse Free 3 for double-click fix 2019-10-26 16:04:05 +00:00
Peter Hutterer
b05e77e7f1 gitlab CI: switch to Ubuntu 19.10
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-25 10:32:03 +10:00
Peter Hutterer
159dbb8d98 gitlab CI: switch to Fedora 31
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-25 10:32:03 +10:00
Peter Hutterer
8a75da773e udev: fix potential memory leak for the phys string
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-24 14:27:37 +10:00
Peter Hutterer
727a504e0d fallback: fix a coverity warning
Value stored to 'rect' during its initialization is never read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-24 14:10:47 +10:00
Peter Hutterer
8011d991fe doc/user: add a faq entry about the pointer acceleration "issue"
Despite many bits wasted on reddit, phoronix, lwn etc. no-one seems interested
in actually fixing this for their device, so let's at least add a FAQ entry.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-23 08:00:44 +10:00
Peter Hutterer
17ec6ac79d doc/user: reword one of the FAQ entries to no tmake it read outdated
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-22 12:04:04 +10:00
Peter Hutterer
9ed14e0667 gitlab CI: add an alpine image
Alpine uses musl, eudev and elogind, so it's useful to build on that to get
those covered.

Notably, ninja test is not run because the litest-selftest will fail for
tcase_add_exit_test() and tcase_add_test_raise_signal(). This may be due to
some missing bits in musl or check not using the feature test macros, etc.
Someone with time and motivation to have this actually work on musl can figure
that out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 10:56:33 +00:00
Peter Hutterer
6f3e51faf6 quirks: make the diff call for the meson check more portable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 10:56:33 +00:00
Peter Hutterer
cbd31c89e9 doc/user: actually link to the API documentation
a6082d3a6f only included the base link

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 19:50:53 +10:00
Peter Hutterer
df0be64baa doc/user: add a link to the API documentation in the TOC
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 08:31:28 +00:00
Peter Hutterer
61f81ec93e meson: move HTTP doc url generation to here
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 08:31:28 +00:00
Peter Hutterer
63f9923013 Add a scroll button lock feature
Scroll button locking is an accessibility feature. When enabled, the scroll
button does not need to be held down, the first click holds it logically down,
to be released on the second click of that same button.

This is implemented as simple event filter, so we still get the same behavior
from the emulated logical button, i.e. a physical double click results in a
single logical click of that button provided no scrolling was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 12:21:41 +10:00
Luflosi
12eb14846a
doc: fix sentence
Signed-off-by: Luflosi <luflosi@luflosi.de>
2019-10-16 14:58:21 +02:00
Peter Hutterer
f392766155 fallback: don't send a single-touch motion if we just sent a begin
Any touch down event will also provide motion data, but we must not send a
motion event for those in the same frame as the down event.

Fixes #375

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-16 03:43:45 +00:00
Balazs Endresz
8c92328dc5 Fix horizontal scrolling for Logitech MX Master 3 on bluetooth 2019-10-15 10:50:32 +02:00
Peter Hutterer
44b5fea14e CI: UI improvements
This should not change the overall time, but allows for a nicer
UI when looking at the pipelines:

* first "check" icon is the container_prep stage
* second icon is all of the variations of builds
* third is the full test suite in the VM
* forth is the distribution specifics
* last one is the deploy

This allows to see which step fails from the UI instead of having
a lengthy list of jobs all in the same column.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-10-14 12:01:12 +02:00
Peter Hutterer
16ad7cca28 gitlab CI: run the valgrind test suite as well
Separate instance so we can speed things up a bit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-14 14:15:16 +10:00
Peter Hutterer
2b33445bc9 touchpad: use the same speed for scrolling as the baseline of the accel curve
Scrolling and gestures use unaccelerated motion. The idea behind it was that
at least for the default speed setting of 0, the accelerated speed and
unaccelerated speed are identical where meaningful.

The touchpad speed curve has a plateau for 'normal' speeds (i.e. not very slow
and not very fast) where the acceleration factor is constant. This is the
reference factor that the unaccelerated motion should use as well.

Since the touchpad acceleration rework in d6e5313497 the reference factor is
0.9 * TP_MAGIC_SLOWDOWN (previously the factor was 1.0 * TP_MAGIC_SLOWDOWN)
and scroll motion is thus 10% faster than the pointer movement at the default
speeds. Let's fix this and let the two match up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-14 02:57:48 +00:00
Aleix Pol
c20d08ac23 LIBINPUT_EVENT_TABLET_BUTTON doesn't exist, use LIBINPUT_EVENT_TABLET_PAD_BUTTON 2019-10-11 02:37:39 +02:00
Tadeo Kondrak
0e19d2c329
meson.build: fix building as a subproject 2019-10-07 01:04:21 -06:00
Peter Hutterer
f37a712ca2 util-time: include linux/input.h
struct timeval isn't defined in time.h, at least not on musl. And since we
need that value for struct input_events, let's include the header for that
struct. That'll sort out the includes for free.

Fixes #371

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-05 07:14:25 +10:00
Benjamin Tissoires
779ce028c3 gitlab-ci: use one sha1 instead of duplicates
because we can

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-10-04 15:03:50 -04:00
Benjamin Tissoires
60595e1cbb gitlab-ci: use qemu to run the full test suite
We currently allow the stage to fail, but at least,
we can make use of it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2019-10-04 20:02:33 +02:00
yy
863aa2b706 Added quirk for Lenovo ThinkPad X200 Tablet. 2019-10-04 19:07:34 +02:00
Jakub Schmidtke
8490384c68 Fixed horizontal scrolling on Logitech MX Master 2S/3
Logitech MX Master 2S and 3 by default use natural scrolling
for the horizontal scroll wheel, while the main wheel
uses traditional mode. This change inverts the default
direction of horizontal scrolling.
2019-09-30 23:34:45 +00:00
Peter Hutterer
df7b82588d test: fix a coverity warning about an unused value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-30 11:18:27 +10:00
John Chadwick
8568cf1b3a tablet: Improve forced prox out behavior.
Some graphics tablets (most or all Wacom, for example) do not emit
proximity out events when the tablet pen goes out of range. To
compensate for this, libinput synthesizes proximity out events when no
events are received for a certain period of time. Unfortunately, on some
tablets, this is fairly failure prone when moving the pen slowly. As a
workaround, this patch causes libinput to avoid synthesizing proximity
out events when the pen is still in contact with the tablet pad, as
defined by the TABLET_TOOL_IN_CONTACT status.
2019-09-29 23:35:09 +00:00
Peter Hutterer
a5c6571ed0 middle-button: add space to middlebutton state debug message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>`
2019-09-27 17:24:33 +10:00
John Chadwick
b71a1b6e2d test: Make udev_properties array fixed-size.
The udev_properties array is currently variable length, which causes the
tests to invoke undefined behavior on empty lists, as it attempts to
access the first array item to check if the key is NULL, which is an out
of bounds read and will fail when the struct alignment happens to line
up such that there is no padding after the list in the empty list case.

By making the udev_properties array 32 items long, it can encapsulate
every existing case, with only a fairly small amount of memory overhead,
and without requiring every single `TEST_DEVICE` call to initialize
`udev_properties`.
2019-09-26 20:06:11 -07:00
Peter Hutterer
67151ddcf5 test: don't use debounced clicks for the middle button emulation click
This used to work under valgrind up to F30 but with the F31 beta something is
now a tad slower so it triggers the timeouts before the middle emulation kicks
in.

The middlebutton timeout is 50ms and the first debounce timeout is 30ms, so if
we're late by 20ms, well, there goes the timeout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 16:49:08 +10:00
Peter Hutterer
058e198067 doc/user: drop markdown source parsers
This is deprecated in sphinx 1.8 but we don't include any markdown sources
anyway, so let's just drop it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 15:49:58 +10:00
Peter Hutterer
6a3bd50f94 doc/user: update copyright for the sphinx docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 15:49:36 +10:00
Peter Hutterer
b38722317c doc: update reference to the event codes header
The codes have been in input-event-codes.h for quite a few releases now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 15:16:45 +10:00
Peter Hutterer
cb1be90439 gestures: where we have more fingers than slots, default to swipe
Fixes #360

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 04:10:02 +00:00
Peter Hutterer
129a1dffa4 gestures: rename the inner/outer thresholds to min/max_move
inner/outer refer more to static thresholds when really what we have here is a
minimum movement before we look at the touch, and a maximum one after which
it's largely ignored.

Straight-up rename, no functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 04:10:02 +00:00
Peter Hutterer
0ce06d1314 touchpad: only identify for pinch in a distinct pinch position
Previously, any lower finger spaced more than the vertical threshold apart
would be labelled as thumb. This causes some taps to be detected as
single-taps, particularly where the user's hand is at an angle that causes the
touches to be effectively vertical.

Restructure that condition so that we only go for a thumb if we're
distinctively apart, and we only *not* go for thumb if we're distinctively
close together.

Fixes #359

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 04:10:02 +00:00
Peter Hutterer
d4ede2256c touchpad: drop useless asserts()
Just above that line is an early return if either is NULL, so...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 04:10:02 +00:00
Serhii Chaplia
79e91f8a30 Touchpad fix and trackpoint speed adjustment for Lenovo T490s
Same issue as #177
2019-09-25 00:46:23 +00:00
Konstantin Kharlamov
0fa8d0d983 libinput-tool.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
29de440b15 libinput-measure.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
18d526bc75 quirks.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
bf09712bff libinput-fuzz-to-zero.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
553637b00b libinput-fuzz-extract.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
476da352c0 libinput-debug-events.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
6a14c13088 udev-seat.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
fe5bc0df4f path-seat.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
ed698fbab5 evdev-mt-touchpad-buttons.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
fae8b9e14a filter.h/c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
25358feef6 libinput-fuzz-override.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Peter Hutterer
7126823fe1 meson.build: bump to 1.14.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-12 11:10:34 +10:00
Konstantin Kharlamov
25f7d85bb3 timer.c: remove unused include <inttypes.h>
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
dec003e6bd evdev-tablet-pad-leds.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
8f278e69c2 evdev-tablet.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
c29fabb2cf evdev-mt-touchpad-gestures.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
cad74b7451 evdev-mt-touchpad-edge-scroll.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
b825b0f1af evdev-mt-touchpad-tap.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
48366f4aab evdev-mt-touchpad.h: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
27324e006f evdev.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
4b219c03ac filter-trackpoint.c: remove unused include
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
0ae4032e85 filter-touchpad-x230.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
23f7a2647d filter-touchpad.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
832c59855d filter-mouse.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
22c044c1dd filter-low-dpi.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Konstantin Kharlamov
a3857b4bec filter-flat.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-12 09:36:40 +10:00
Peter Hutterer
e7a9c07ffe udev: parse the EVDEV_ABS properties for a potential fuzz setting
Where a fuzz is defined in the 60-evdev.hwdb, we rely on a udev builtin to
set the kernel device to that fuzz value. Unfortunately that happens after our
program is called with this order of events:
1. 60-evdev.rules calls IMPORT(builtin) for the hwdb which sets the EVDEV_ABS_*
  properties. It also sets RUN{builtin}=keyboard but that's not invoked yet.
2. 90-libinput-fuzz-override.rules calls IMPORT{program} for our fuzz override
  bits. That sets the kernel fuzz value to 0 and sets the LIBINPUT_FUZZ_*
  propertie
3. The keyboard builtin is run once all the rules have been processed.

Our problem is that where the fuzz is set in a hwdb entry, the kernel fuzz is
still unset when we get to look at it, so we always end up with a fuzz of zero
for us and a nonzero kernel fuzz.

Work around this by checking the EVDEV_ABS property, extracting the fuzz from
there and re-printing that property without the fuzz. This way we ensure the
kernel remains at zero fuzz and we use the one from the hwdb instead.

Fixes #346

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:24:02 +10:00
Peter Hutterer
1e6802b91b Remove some usage of libinput-util.h
Positive side-effect - this exposed a bunch of missing #includes that got
pulled in by other headers before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:23:06 +10:00
Peter Hutterer
c84366e85e Split utility functions into separate source files
libinput-util.h is getting a bit of a catchall bucket and it includes things
like libinput-private.h which in turn includes libwacom. This makes
libinput-util.h less useful for bits that only need e.g. the string processing
utilities.

So let's split them all up in to separate files, to be used as-needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:23:04 +10:00
Peter Hutterer
00f3345b80 test: do run the util tests under valgrind
These tests include string parsers, definitely want those to run under
valgrind to detect OOB reads and writes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:21:44 +10:00
Peter Hutterer
27632555e1 tools: flake8 fixes for the various python files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:02:58 +10:00
Peter Hutterer
975ff2fb6e tools: change python invocations to use /usr/bin/env python3
Let's be consistent here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:02:58 +10:00
Peter Hutterer
bd8123e459 tools: install local quirks during libinput replay
The quirks for each device are listed in the recording but they may not apply
during libinput replay (e.g. for DMI matches). Work around this by writing out
the local-overrides.quirks file before initializing the devices. This way
we're guaranteed that the device is identical as on the reporter's machine.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:41:46 +10:00
Peter Hutterer
93e91536db tools: make an infinite loop more obvious in the code
Nothing sets "stop", so we might as well make it a while True

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:13:36 +10:00
Peter Hutterer
73849515ef tools: factor out a sanity check in libinput-replay
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:13:36 +10:00
Richard McIntosh
4f9a795765 Added magic trackpoint multiplier for Thinkpad 13 G2 2019-09-08 15:21:11 +02:00
RussianNeuroMancer
8635d546ce Mark HP Elite x2 1013 G3 keyboard as external
Keyboard+touchpad is external:
http://h10032.www1.hp.com/ctg/Manual/c06077534 (page 12)
2019-09-03 08:02:28 +00:00
RussianNeuroMancer
3c13dd9ccd Tablet Mode Switch on HP Elite x2 1013 G3 is unreliable:
https://bugzilla.kernel.org/show_bug.cgi?id=204719
https://bugzilla.kernel.org/show_bug.cgi?id=204739

Keyboard+touchpad is external:
http://h10032.www1.hp.com/ctg/Manual/c06077534 (page 12)
2019-08-30 15:09:01 +00:00
452 changed files with 79888 additions and 28189 deletions

82
.clang-format Normal file
View file

@ -0,0 +1,82 @@
AlignAfterOpenBracket: Align
# This option we want but it's frequently broken and causes bad
# misalignment. The canary is wheel_click_count_parser, if that works
# we can actually enable it.
# AlignArrayOfStructures: Left
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCaseColons: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BinPackParameters: OnePerLine
BraceWrapping:
AfterFunction: true
BreakAfterReturnType: All
BreakBeforeBraces: Custom
BreakStringLiterals: false
ColumnLimit: 88
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^(<|")config\.h(>|")'
Priority: 0
SortPriority: 0
- Regex: '^<.*'
Priority: 1
SortPriority: 0
- Regex: '^"util-.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IndentCaseLabels: false
IndentGotoLabels: false
IndentWidth: 8
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
ReflowComments: true
RemoveEmptyLinesInUnwrappedLines: true
RemoveParentheses: MultipleParentheses
RemoveSemicolon: true
SkipMacroDefinitionBody: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpacesInContainerLiterals: true
SpacesInParens: Custom
TabWidth: 8
UseTab: ForContinuationAndIndentation
ForEachMacros:
- ARRAY_FOR_EACH
- list_for_each
- list_for_each_safe
- tp_for_each_touch
- range_for_each
- litest_log_group
- litest_with_logcapture
- litest_with_parameters
- litest_with_event_frame
- udev_list_entry_foreach
# END_TEST is defined as something that enforces a line break
Macros: [ "CASE_RETURN_STRING(s)=case s: return s", "START_TEST(s)=static void s(void)", "END_TEST=enum foo;"]

1
.clang-format-ignore Normal file
View file

@ -0,0 +1 @@
include/**/*

7
.clang-tidy Normal file
View file

@ -0,0 +1,7 @@
# optin.core.unix.Malloc: disabled so we can use __attribute__((cleanup)) without leak complaints
# optin.core.EnumCastOutOfRange: disabled because we use a lot of "wrong" enum values for testing
# and internally and don't want those values leak into the public API
Checks: >
-clang-analyzer-unix.Malloc,
-clang-analyzer-optin.core.EnumCastOutOfRange
WarningsAsErrors: '*'

1
.clang-tidy-ignore Normal file
View file

@ -0,0 +1 @@
include/*

25
.editorconfig Normal file
View file

@ -0,0 +1,25 @@
# https://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
[*.{c,h}]
indent_size = 8
indent_style = tab
[*.py]
indent_size = 4
indent_style = space
[{meson.build,meson_options.txt}]
indent_size = 8
indent_style = tab
[*.sym]
indent_size = 8
indent_style = tab

21
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,21 @@
# This file contains revisions to be ignored by git blame.
# These revisions are expected to be formatting-only changes.
#
# Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
# tell git blame to ignore changes made by these revisions when assigning
# assigning blame, as if the change never happened.
#
# You can enable this as a default for your local repository by running
# `git config blame.ignoreRevsFile .git-blame-ignore-revs`
# Important: if you do this, then switch to a branch without this file,
# `git blame` will fail with an error.
#
# Run clang-format over the code
2a1095924b0be60f822bc0ff20d567e209a9db73
# Add trailing commas to prevent clang-format oddities
aebf3cd4915adc576cf055926caa621e098ec32b
# Fix some inconsistent whitespace.
60abf1575560cb8e2220ae48a67e7f74b5dc70dd

File diff suppressed because it is too large Load diff

803
.gitlab-ci/ci.template Normal file
View file

@ -0,0 +1,803 @@
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
{# You're looking at the template here, so you can ignore the below
warning. This is the right file to edit #}
########################################
# #
# THIS FILE IS GENERATED, DO NOT EDIT #
# #
########################################
# To change the gitlab CI, edit .gitlab-ci/ci.template and/or .gitlab-ci/config.yaml
# and run ci-fairy generate-template. For details, see
# https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml
# This is a bit complicated for two reasons:
# - we really want to run dnf/apt/... only once, updating on the test runner for
# each job takes forever. So we create a container image for each distribution
# tested, then run the tests on this container image.
#
# This is handled by the ci-templates, ensuring containers are only rebuilt
# when the TAG changes.
#
# - GitLab only allows one script: set per job but we have a bunch of commands
# we need to re-run for each build (meson && ninja && etc). YAML cannot merge
# arrays so we're screwed.
#
# So instead we use a default_build template and override everything with
# variables. The only two variables that matter:
# MESON_ARGS=-Denable-something=true
# NINJA_ARGS=dist ... to run 'ninja -C builddir dist'
# Note that you cannot use scripts: in any target if you expect default_build
# to work.
#
#
# All jobs must follow the naming scheme of
# <distribution>:<version>@activity:
# e.g. fedora:31@build-default
.templates_sha: &template_sha c6aeb16f86e32525fa630fb99c66c4f3e62fc3cb
include:
- project: 'freedesktop/ci-templates'
ref: *template_sha
file:
- '/templates/ci-fairy.yml'
{% for distro in distributions|sort(attribute="name") %}
# {{ distro.name.capitalize() }} container builder template
- '/templates/{{distro.name}}.yml'
{% endfor %}
workflow:
rules:
# do not duplicate pipelines on merge pipelines
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
# merge pipeline
- if: &is-merge-attempt $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64: priority:high
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM: priority:high-kvm
FDO_RUNNER_JOB_PRIORITY_TAG_AARCH64: priority:high-aarch64
# post-merge pipeline
- if: &is-post-merge $GITLAB_USER_LOGIN == "marge-bot" && $CI_PIPELINE_SOURCE == "push"
variables:
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64: priority:high
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM: priority:high-kvm
FDO_RUNNER_JOB_PRIORITY_TAG_AARCH64: priority:high-aarch64
# Pre-merge pipeline
- if: &is-pre-merge $CI_PIPELINE_SOURCE == "merge_request_event"
# Push to a branch on a fork
- if: $CI_COMMIT_BRANCH
stages:
- sanity check # CI/commit checks
- prep # prep work like rebuilding the container images if there is a change
- build # for actually building and testing things in a container
- test-suite # for running the test suite in a VM
- test-suite-no-libwacom # for running the test suite in a VM (libwacom disabled)
- valgrind # for running the test suite under valgrind in a VM
- distro # distribs test
- deploy # trigger wayland's website generation
- container_clean # clean up unused container images (scheduled jobs only)
variables:
###############################################################################
# This is the list of packages required to build libinput with the default #
# configuration. #
# #
# Run dnf install/apt-get install/.. with the list of packages for your #
# distribution #
# #
# See the documentation here: #
# https://wayland.freedesktop.org/libinput/doc/latest/building.html #
###############################################################################
{% for distro in distributions %}
{{"%-17s" | format(distro.name.upper() + '_PACKAGES:')}} '{{ distro.packages|join(' ')}}'
{% endfor %}
############################ end of package lists #############################
# these tags should be updated each time the list of packages is updated
# changing these will force rebuilding the associated image
# Note: these tags have no meaning and are not tied to a particular
# libinput version
{% for distro in distributions %}
{{"%-13s"| format(distro.name.upper() + '_TAG:')}}'{{distro.tag}}'
{% endfor %}
FDO_UPSTREAM_REPO: libinput/libinput
MESON_BUILDDIR: "build dir"
NINJA_ARGS: ''
MESON_ARGS: ''
MESON_TEST_ARGS: '--no-suite=hardware'
# udev isn't available/working properly in the containers
UDEV_NOT_AVAILABLE: 1
GIT_DEPTH: 1
# Default priority for non-merge pipelines
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64: "" # Empty tags are ignored by gitlab
FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM: kvm
FDO_RUNNER_JOB_PRIORITY_TAG_AARCH64: aarch64
.policy:
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
# cancel run when a newer version is pushed to the branch
interruptible: true
dependencies: []
.policy-retry-on-failure:
retry:
max: 1
when:
- runner_system_failure
- stuck_or_timeout_failure
# cancel run when a newer version is pushed to the branch
interruptible: true
dependencies: []
.default_artifacts:
artifacts:
name: "meson-logs-$CI_JOB_NAME"
when: always
expire_in: 1 week
paths:
- $MESON_BUILDDIR/meson-logs
- $MESON_BUILDDIR/valgrind.*.log
reports:
junit: $MESON_BUILDDIR/*junit*.xml
.fdo-runner-tags:
tags:
- $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64
#################################################################
# #
# sanity check stage #
# #
#################################################################
fail-if-fork-is-not-public:
extends:
- .fdo-runner-tags
stage: sanity check
script:
- |
if [ $CI_PROJECT_VISIBILITY != "public" ]; then
echo "*************************************************************************************"
echo "Project visibility must be set to 'public'"
echo "Change this in $CI_PROJECT_URL/edit under 'Visibility, project features, permissions'"
echo "*************************************************************************************"
exit 1
fi
except:
- main@libinput/libinput
# Re-generate the CI script and make sure it's the one currently checked in
# If this job fails, re-generate the gitlab-ci.yml script, see
# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
#
check-ci-script:
extends:
- .fdo.ci-fairy
- .fdo-runner-tags
stage: sanity check
script:
- ci-fairy generate-template --verify && exit 0 || true
- >
printf "%s\n" \
"Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" \
"https://wayland.freedesktop.org/libinput/doc/latest/contributing.html"
- exit 1
#
# Verify that commit messages are as expected, etc.
#
check-commit:
extends:
- .fdo.ci-fairy
- .fdo-runner-tags
stage: sanity check
script:
- ci-fairy -vv check-commits --junit-xml=results.xml && exit 0 || true
- >
printf "%s\n" \
"Error checking commit format. Please verify" \
"https://wayland.freedesktop.org/libinput/doc/latest/contributing.html"
- exit 1
except:
- main@libinput/libinput
variables:
GIT_DEPTH: 100
artifacts:
reports:
junit: results.xml
#
# Check for trailing whitespaces
#
check-whitespace:
extends:
- .fdo.ci-fairy
- .fdo-runner-tags
stage: sanity check
script:
- .gitlab-ci/whitespace-check.py $(git ls-files)
#
# pre-commit hooks
#
pre-commit-hooks:
extends:
- .fdo.ci-fairy
- .fdo-runner-tags
stage: sanity check
script:
- python3 -m venv venv
- source venv/bin/activate
- pip3 install pre-commit
- pre-commit run --all-files
- git diff --exit-code || (echo "ERROR - Code style errors found, please fix" && false)
#################################################################
# #
# prep stage #
# #
#################################################################
{% for distro in distributions %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@container-prep:
extends:
{% if distro.qemu_based %}
- .fdo.qemu-build@{{distro.name}}
{% else %}
- .fdo.container-build@{{distro.name}}
{% endif %}
- .policy
- .fdo-runner-tags
{% if distro.qemu_based %}
tags:
- $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM
{% endif %}
stage: prep
variables:
GIT_STRATEGY: none
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_PACKAGES: ${{distro.name.upper()}}_PACKAGES
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{% endfor %}
{% endfor %}
#################################################################
# #
# container clean stage #
# run during the clean stage #
# #
#################################################################
#
# This stage will look for the container images we currently have in
# the registry and will remove any that are not tagged with the provided
# $container_image:$tag
#
.container-clean:
extends:
- .policy
- .fdo.ci-fairy
- .fdo-runner-tags
stage: container_clean
script:
# Go to your Profile, Settings, Access Tokens
# Create a personal token with 'api' scope, copy the value.
# Go to CI/CD, Schedules, schedule a new monthly job (or edit the existing one)
# Define a variable of type File named AUTHFILE. Content is that token
# value.
- ci-fairy -v --authfile $AUTHFILE delete-image
--repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
--exclude-tag $FDO_DISTRIBUTION_TAG
allow_failure: true
only:
- schedules
{% for distro in distributions %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@container-clean:
extends:
- .policy
- .container-clean
variables:
GIT_STRATEGY: none
CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/{{distro.name}}/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{% endfor %}
{% endfor %}
#################################################################
# #
# build stage #
# #
#################################################################
.build@template:
extends:
- .policy
- .default_artifacts
- .fdo-runner-tags
stage: build
script:
- .gitlab-ci/meson-build.sh
# Run meson and meson test in the container image through qemu
.build-in-vng@template:
extends:
- .policy
- .default_artifacts
tags:
- $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM
variables:
MESON_BUILDDIR: build_dir
VNG_KERNEL: {{ vng.kernel }}
script:
# first build in the host container
- .gitlab-ci/meson-build.sh --skip-test
- mkdir -p $MESON_BUILDDIR
- curl -LO $VNG_KERNEL
- export -p > .vngenv
# runs the test suite only
- |
vng --run ./bzImage \
--user root \
--overlay-rwdir=$HOME \
--append HOME=$HOME \
--overlay-rwdir=$(pwd) \
--rwdir=$MESON_BUILDDIR \
--exec "source $PWD/.vngenv; rm $PWD/.vngenv; .gitlab-ci/meson-build.sh --skip-setup --skip-build --run-test"
#
# Fedora
#
.check_tainted: &check_tainted |
# make sure the kernel is not tainted
if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
then
echo tainted kernel ;
exit 1 ;
fi
# Run meson and meson test in the qemu image
.build-in-qemu@template:
extends:
- .policy
tags:
- $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM
variables:
MESON_BUILDDIR: build_dir
script:
# start our vm, no args required
- /app/vmctl start || (echo "Error - Failed to start the VM." && exit 1)
- *check_tainted
- "scp -r $PWD vm:"
- echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
- echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
- echo "MESON_ARGS=\"$MESON_ARGS\"" >> sshenv
- echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
- echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
- echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
- "scp sshenv vm:~/$CI_PROJECT_NAME/.meson_environment"
- /app/vmctl exec "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
# no matter the results of the tests, we want to fetch the logs
- scp -r vm:$CI_PROJECT_NAME/$MESON_BUILDDIR .
- *check_tainted
- /app/vmctl stop
- if [[ ! -e .success ]] ;
then
exit 1 ;
fi
artifacts:
name: "qemu-meson-logs-$CI_JOB_NAME"
when: always
expire_in: 1 week
paths:
- $MESON_BUILDDIR/meson-logs
- console.out
reports:
junit: $MESON_BUILDDIR/*junit*.xml
# Run in a test suite. Special variables:
# - SUITES: the meson test suites to run, or
# - SUITE_NAMES: all elements will be expanded to libinput-test-suite-$value
# Set one or the other, not both.
.test-suite-vm:
extends:
- .build-in-vng@template
stage: test-suite
variables:
# remove the global --no-suite=hardware
MESON_TEST_ARGS: ''
LITEST_JOBS: 4
before_script:
- if ! [[ -z $SUITE_NAMES ]]; then SUITES=$(echo $SUITE_NAMES | sed 's/\([^ ]*\)/libinput-test-suite-\1/g'); fi
- echo "Testing $SUITES"
- export MESON_TEST_ARGS="$MESON_TEST_ARGS $SUITES"
{# qemu tests are only done for the latest version of any distribution #}
{% for distro in distributions if distro.use_for_qemu_tests %}
{% set version = "{}".format(distro.versions|last()) %}
.{{distro.name}}:{{version}}@test-suite-vm:
extends:
- .fdo.distribution-image@{{distro.name}}
- .test-suite-vm
variables:
FDO_DISTRIBUTION_VERSION: {{version}}
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
needs:
- "{{distro.name}}:{{version}}@container-prep"
{% for suite in test_suites %}
vm-{{suite.name}}:
extends:
- .{{distro.name}}:{{version}}@test-suite-vm
variables:
SUITE_NAMES: '{{suite.suites|join(' ')}}'
vm-{{suite.name}}-no-libwacom:
extends:
- vm-{{suite.name}}
stage: test-suite-no-libwacom
variables:
MESON_ARGS: '-Dlibwacom=false'
{% endfor %}
{% for suite in test_suites %}
vm-valgrind-{{suite.name}}:
stage: valgrind
extends:
- vm-{{suite.name}}
- .policy-retry-on-failure
variables:
MESON_TEST_ARGS: '--setup=valgrind'
LITEST_JOBS: 0
retry:
max: 2
rules:
- if: $GITLAB_USER_LOGIN != "marge-bot"
{% endfor %}
{% endfor %}{# for if distro.use_for_qemu_tests #}
{% for distro in distributions if distro.use_for_custom_build_tests %}
{% set version = "{}".format(distro.versions|last()) %}
.{{distro.name}}-build@template:
extends:
- .fdo.distribution-image@{{distro.name}}
- .build@template
variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
needs:
- "{{distro.name}}:{{version}}@container-prep"
default-build-release@{{distro.name}}:{{version}}:
stage: distro
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dbuildtype=release"
CFLAGS: "-Werror"
clang-tidy@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
NINJA_ARGS: ''
MESON_TEST_ARGS: ''
CC: 'clang'
script:
- .gitlab-ci/meson-build.sh
- ninja -C "$MESON_BUILDDIR" clang-tidy
# Below jobs are build option combinations. We only
# run them on one image, they shouldn't fail on one distro
# when they succeed on another.
build-no-libwacom@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dlibwacom=false"
build-no-libwacom-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dlibwacom=false"
before_script:
- dnf remove -y libwacom libwacom-devel
build-no-mtdev@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dmtdev=false"
build-no-mtdev-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dmtdev=false"
before_script:
- dnf remove -y mtdev mtdev-devel
build-no-lua@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dlua-plugins=disabled"
build-no-lua-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dlua-plugins=disabled"
before_script:
- dnf remove -y lua lua-devel
build-docs@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Ddocumentation=true"
build-no-docs-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Ddocumentation=false"
before_script:
- dnf remove -y doxygen graphviz
build-no-debuggui@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Ddebug-gui=false"
build-no-debuggui-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Ddebug-gui=false"
before_script:
- dnf remove -y gtk3-devel gtk4-devel
build-no-tests@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dtests=false"
build-no-tests-nodeps@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_ARGS: "-Dtests=false"
before_script:
- dnf remove -y check-devel
valgrind@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
variables:
MESON_TEST_ARGS: '--suite=valgrind --no-suite=hardware --setup=valgrind'
# Python checks, only run on Fedora
usr-bin-env-python@{{distro.name}}:{{version}}:
extends:
- .{{distro.name}}-build@template
script:
- |
if git grep -l '^#!/usr/bin/python'; then
echo "Use '/usr/bin/env python3' in the above files";
/bin/false
fi
# A job to check we're actually running all test suites in the CI
check-test-suites:
extends:
- .{{distro.name}}-build@template
script:
- meson setup builddir
- meson introspect builddir --test | jq -r '.[].name' | grep 'libinput-test-suite' | sort > meson-testsuites
- |
cat <<EOF > ci-testsuites ;
{% for suite in test_suites %}
{% for name in suite.suites %}
libinput-test-suite-{{name}}
{% endfor %}
{% endfor %}
EOF
- sort -o ci-testsuites ci-testsuites
- diff -u8 -w ci-testsuites meson-testsuites || (echo "Some test suites are not run in the CI" && false)
only:
changes:
- "meson.build"
- ".gitlab-ci.yml"
{% endfor %}
#
# coverity run
#
# This requires the COVERITY_SCAN_TOKEN. Log into scan.coverity.com and get
# the token from the respective project settings page.
# Schedule a pipeline and set a variable COVERITY_SCAN_TOKEN with the token value.
# https://gitlab.freedesktop.org/$CI_PROJECT_PATH/-/pipeline_schedules
# Email from coverity will be sent to the GITLAB_USER_EMAIL that scheduled the
# job.
#
# Coverity ratelimits submissions and the coverity tools download is about
# 700M, do not run this too often.
#
coverity:
extends:
- .fdo.distribution-image@debian
- .policy
- .fdo-runner-tags
stage: build
variables:
FDO_DISTRIBUTION_VERSION: 'stable'
FDO_DISTRIBUTION_TAG: $DEBIAN_TAG
# so git-describe works, or should work
GIT_DEPTH: 200
only:
variables:
- $COVERITY_SCAN_TOKEN
script:
- curl https://scan.coverity.com/download/linux64
-o /tmp/cov-analysis-linux64.tgz
--form project=$CI_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN
- tar xfz /tmp/cov-analysis-linux64.tgz
# coverity has special build options in meson, make sure we enable those
- meson coverity-build -Ddocumentation=false -Dcoverity=true
- cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C coverity-build
- tar cfz cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$CI_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
--form file=@cov-int.tar.gz --form version="$(git describe --tags)"
--form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
artifacts:
name: "coverity-submit-data"
when: always
expire_in: 1 week
paths:
- cov-int.tar.gz
needs:
- "debian:stable@container-prep"
#################################################################
# #
# distro stage #
# #
#################################################################
{% for distro in distributions %}
{% if not distro.qemu_based %}
{% for version in distro.versions %}
{{distro.name}}:{{version}}@default-build:
stage: distro
extends:
- .build@template
- .fdo.distribution-image@{{distro.name}}
variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{# Where we have extra_variables defined, add them to the list #}
{% if distro.build is defined and distro.build.extra_variables is defined %}
{% for var in distro.build.extra_variables %}
{{var}}
{% endfor %}
{% endif %}
needs:
- "{{distro.name}}:{{version}}@container-prep"
{% endfor %}
{% else %}
{% set version = "{}".format(distro.versions|last()) %}
{{distro.name}}:{{version}}@default-build:
stage: distro
extends:
- .build-in-qemu@template
- .fdo.distribution-image@{{distro.name}}
variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: ${{distro.name.upper()}}_TAG
{# Where we have extra_variables defined, add them to the list #}
{% if distro.build is defined and distro.build.extra_variables is defined %}
{% for var in distro.build.extra_variables %}
{{var}}
{% endfor %}
{% endif %}
needs:
- "{{distro.name}}:{{version}}@container-prep"
{% endif %}
{% endfor %}
#################################################################
# #
# deploy stage #
# #
#################################################################
{% for distro in distributions if distro.name == "fedora" %}
{% set version = "{}".format(distro.versions|last()) %}
build rpm:
extends:
- .fdo.distribution-image@fedora
- .policy
- .fdo-runner-tags
stage: deploy
variables:
FDO_DISTRIBUTION_VERSION: '{{version}}'
FDO_DISTRIBUTION_TAG: $FEDORA_TAG
needs:
- "fedora:{{version}}@container-prep"
script:
- meson "$MESON_BUILDDIR"
- VERSION=$(meson introspect "$MESON_BUILDDIR" --projectinfo | jq -r .version)
- sed -e "s/@PIPELINEID@/${CI_PIPELINE_ID}/"
-e "s/@GITVERSION@/${CI_COMMIT_SHA}/"
-e "s/@VERSION@/${VERSION}/" .gitlab-ci/libinput.spec.in > libinput.spec
- git config --local user.name 'gitlab CI'
- git config --local user.email 'noreply@nowhere'
- git add libinput.spec && git commit -m 'Add libinput.spec for build testing' libinput.spec
- cd "$MESON_BUILDDIR"
- meson dist --no-test
- rpmbuild -ta meson-dist/libinput*.tar.xz
{% endfor %}
wayland-web:
stage: deploy
trigger: wayland/wayland.freedesktop.org
variables:
MESON_ARGS: '-Ddocumentation=true -Ddebug-gui=false -Dlibwacom=false -Dtests=false'
MESON_BUILDDIR: 'builddir'
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
- if: '$CI_COMMIT_BRANCH == "main" && $GITLAB_USER_LOGIN != "marge-bot" && $CI_PROJECT_PATH == $FDO_UPSTREAM_REPO'
when: on_success
- when: never

217
.gitlab-ci/config.yml Normal file
View file

@ -0,0 +1,217 @@
# This file contains the configuration for the gitlab ci.
# See the .gitlab-ci/generate-gitlab-ci.py file for more info
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2026-01-09.0'
distributions:
- name: fedora
tag: *default_tag
versions:
- '42'
- '43'
use_for_custom_build_tests: true
use_for_qemu_tests: true
packages:
- git-core
- gcc
- gcc-c++
- pkgconf-pkg-config
- meson
- check-devel
- libudev-devel
- libevdev-devel
- doxygen
- graphviz
- python3-sphinx
- python3-recommonmark
- python3-sphinx_rtd_theme
- python3-pytest-xdist
- libwacom-devel
- cairo-devel
- gtk4-devel
- glib2-devel
- mtdev-devel
- diffutils
- wayland-protocols-devel
- black # for the Python black job, optional
- clang # for the clang-tidy build, optional
- clang-tools-extra # for clang-tidy, optional
- jq # for the test suite check job, optional
- rpmdevtools # for the rpm build job, optional
- valgrind # for the valgrind run, optional
# below packages are for the qemu runs, so optional
- systemd-udev # for the qemu run
- qemu-img
- qemu-system-x86-core
- qemu-system-aarch64-core
- jq
- python3-click
- python3-rich
- virtme-ng
- lua-devel
- name: debian
tag: *default_tag
versions:
- 'stable'
packages:
- git
- gcc
- g++
- pkg-config
- meson
- check
- libudev-dev
- libevdev-dev
- doxygen
- graphviz
- python3-sphinx
- python3-recommonmark
- python3-sphinx-rtd-theme
- python3-pytest-xdist
- libwacom-dev
- libcairo2-dev
- libgtk-3-dev
- libglib2.0-dev
- libmtdev-dev
- curl # for the coverity job
- lua5.4-dev
- name: ubuntu
tag: *default_tag
versions:
- '25.10'
packages:
- git
- gcc
- g++
- pkg-config
- meson
- check
- libudev-dev
- libevdev-dev
- doxygen
- graphviz
- python3-sphinx
- python3-recommonmark
- python3-sphinx-rtd-theme
- python3-pytest-xdist
- libwacom-dev
- libcairo2-dev
- libgtk-3-dev
- libglib2.0-dev
- libmtdev-dev
- lua5.4-dev
- name: arch
tag: *default_tag
versions:
- 'rolling'
packages:
- git
- gcc
- pkgconfig
- meson
- check
- libsystemd
- libevdev
- python-pytest-xdist
- libwacom
- gtk4
- mtdev
- diffutils
- lua
build:
extra_variables:
- "MESON_ARGS: '-Ddocumentation=false'" # python-recommonmark is no longer in the repos
- name: alpine
tag: *default_tag
versions:
- 'latest'
packages:
- git
- gcc build-base
- pkgconfig
- meson
- check-dev
- eudev-dev
- libevdev-dev
- libwacom-dev
- cairo-dev
- gtk4.0-dev
- mtdev-dev
- bash
- lua5.4-dev
build:
extra_variables:
- "MESON_ARGS: '-Ddocumentation=false' # alpine does not have python-recommonmark"
# We don't run the tests on alpine. The litest-selftest fails
# for any tcase_add_exit_test/tcase_add_test_raise_signal
# but someone more invested in musl will have to figure that out.
- "MESON_TEST_ARGS: '' # litest-selftest fails on musl"
test_suites:
- name: touchpad
suites:
- touchpad
- name: touchpad_palm
suites:
- touchpad_palm
- name: touchpad_dwt
suites:
- touchpad_dwt
- name: tap
suites:
- touchpad_tap
- name: tap-drag
suites:
- touchpad_tap_drag
- name: tap-palm
suites:
- touchpad_tap_palm
- name: touchpad-buttons
suites:
- touchpad_buttons
- name: tablet
suites:
- tablet
- name: tablet_left_handed
suites:
- tablet_left_handed
- name: tablet_proximity_tip
suites:
- tablet_proximity
- tablet_tip
- name: tablet_eraser
suites:
- tablet_eraser
- name: gestures
suites:
- gestures
- name: backends
suites:
- path
- udev
- name: misc
suites:
- log
- misc
- quirks
- device
- name: other devices
suites:
- keyboard
- pad
- switch
- trackball
- trackpoint
- totem
- touch
- name: pointer
suites:
- pointer
- name: lua
suites:
- lua
vng:
kernel: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v6.14/bzImage

149
.gitlab-ci/libinput.spec.in Normal file
View file

@ -0,0 +1,149 @@
# This specfile should not be used outside the CI
# Its main purpose is to sound alarm if files disappear or are added that
# weren't intended.
%global udevdir %(pkg-config --variable=udevdir udev)
%global pipelineid @PIPELINEID@
%global gitversion @GITVERSION@
Name: libinput
Version: @VERSION@
Release: %{pipelineid}git%{gitversion}%{?dist}
Summary: Input device library
License: MIT
URL: http://www.freedesktop.org/wiki/Software/libinput/
Source0: %{name}-%{version}.tar.xz
# No BuildRequires, we rely on the container setup to have
# all the requires installed
%description
libinput is a library that handles input devices for display servers and other
applications that need to directly deal with input devices.
It provides device detection, device handling, input device event processing
and abstraction so minimize the amount of custom input code the user of
libinput need to provide the common set of functionality that users expect.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package utils
Summary: Utilities and tools for debugging %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-pyudev python3-libevdev
%description utils
The %{name}-utils package contains tools to debug hardware and analyze
%{name}.
%package test
Summary: libinput integration test suite
Requires: %{name}%{?_isa} = %{version}-%{release}
%description test
The %{name}-test package contains the libinput test suite. It is not
intended to be run by users.
%prep
%autosetup -S git -n %{name}-%{version}
%build
%meson -Dtests=true \
-Dinstall-tests=true \
-Dudev-dir=%{udevdir}
%meson_build
%install
%meson_install
%post
%{?ldconfig}
%ldconfig_postun
%files
%doc COPYING
%dir %{_sysconfdir}/libinput
%{_libdir}/libinput.so.*
%{udevdir}/libinput-device-group
%{udevdir}/libinput-fuzz-extract
%{udevdir}/libinput-fuzz-to-zero
%{udevdir}/rules.d/80-libinput-device-groups.rules
%{udevdir}/rules.d/90-libinput-fuzz-override.rules
%{_bindir}/libinput
%dir %{_libexecdir}/libinput/
%{_libexecdir}/libinput/libinput-debug-events
%{_libexecdir}/libinput/libinput-list-devices
%{_mandir}/man1/libinput.1*
%{_datadir}/libinput/*.quirks
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/*
%{_mandir}/man1/libinput-list-devices.1*
%{_mandir}/man1/libinput-debug-events.1*
%files devel
%{_includedir}/libinput.h
%{_libdir}/libinput.so
%{_libdir}/pkgconfig/libinput.pc
%files utils
%{_libexecdir}/libinput/libinput-debug-gui
%{_libexecdir}/libinput/libinput-debug-tablet
%{_libexecdir}/libinput/libinput-debug-tablet-pad
%{_libexecdir}/libinput/libinput-list-kernel-devices
%{_libexecdir}/libinput/libinput-measure
%{_libexecdir}/libinput/libinput-measure-fuzz
%{_libexecdir}/libinput/libinput-measure-touchpad-tap
%{_libexecdir}/libinput/libinput-measure-touchpad-pressure
%{_libexecdir}/libinput/libinput-measure-touch-size
%{_libexecdir}/libinput/libinput-measure-touchpad-size
%{_libexecdir}/libinput/libinput-quirks
%{_libexecdir}/libinput/libinput-record
%{_libexecdir}/libinput/libinput-replay
%{_libexecdir}/libinput/libinput-analyze
%{_libexecdir}/libinput/libinput-analyze-buttons
%{_libexecdir}/libinput/libinput-analyze-per-slot-delta
%{_libexecdir}/libinput/libinput-analyze-recording
%{_libexecdir}/libinput/libinput-analyze-touch-down-state
%{_mandir}/man1/libinput-debug-gui.1*
%{_mandir}/man1/libinput-debug-tablet.1*
%{_mandir}/man1/libinput-debug-tablet-pad.1*
%{_mandir}/man1/libinput-list-kernel-devices.1*
%{_mandir}/man1/libinput-measure.1*
%{_mandir}/man1/libinput-measure-fuzz.1*
%{_mandir}/man1/libinput-measure-touchpad-tap.1*
%{_mandir}/man1/libinput-measure-touch-size.1*
%{_mandir}/man1/libinput-measure-touchpad-size.1*
%{_mandir}/man1/libinput-measure-touchpad-pressure.1*
%{_mandir}/man1/libinput-quirks.1*
%{_mandir}/man1/libinput-quirks-list.1*
%{_mandir}/man1/libinput-quirks-validate.1*
%{_mandir}/man1/libinput-record.1*
%{_mandir}/man1/libinput-replay.1*
%{_mandir}/man1/libinput-analyze.1*
%{_mandir}/man1/libinput-analyze-buttons.1*
%{_mandir}/man1/libinput-analyze-per-slot-delta.1*
%{_mandir}/man1/libinput-analyze-recording.1*
%{_mandir}/man1/libinput-analyze-touch-down-state.1*
%files test
%{_libexecdir}/libinput/libinput-test
%{_libexecdir}/libinput/libinput-test-suite
%{_libexecdir}/libinput/libinput-test-utils
%{_mandir}/man1/libinput-test.1*
%{_mandir}/man1/libinput-test-suite.1*
%changelog
* Wed Jul 15 2020 Peter Hutterer <peter.hutterer@redhat.com>
- Add basic spec file for package build testing

88
.gitlab-ci/meson-build.sh Executable file
View file

@ -0,0 +1,88 @@
#!/usr/bin/env bash
#
# This script is sourced from here:
# https://gitlab.freedesktop.org/whot/meson-helper
#
# SPDX-License-Identifier: MIT
set -x
if [[ -f .meson_environment ]]; then
. .meson_environment
fi
# If test args are set, we assume we want to run the tests
MESON_RUN_TEST="$MESON_TEST_ARGS"
while [[ $# -gt 0 ]]; do
case $1 in
--skip-setup)
shift
MESON_SKIP_SETUP="1"
;;
--skip-build)
shift
MESON_SKIP_BUILD="1"
;;
--skip-test)
shift
MESON_RUN_TEST=""
;;
--run-test)
shift
MESON_RUN_TEST="1"
;;
*)
echo "Unknow commandline argument $1"
exit 1
;;
esac
done
if [[ -z "$MESON_BUILDDIR" ]]; then
echo "\$MESON_BUILDDIR undefined."
exit 1
fi
# emulate a few gitlab variables to make it easier to
# run and debug locally.
if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]]; then
echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME".
CI_PROJECT_NAME=$(basename "$PWD")
CI_JOB_ID=$(date +%s)
CI_JOB_NAME="$CI_PROJECT_NAME-job-local"
echo "Simulating gitlab environment: "
echo " CI_JOB_ID=$CI_JOB_ID"
echo " CI_JOB_NAME=$CI_JOB_NAME"
fi
if [[ -n "$FDO_CI_CONCURRENT" ]]; then
jobcount="-j$FDO_CI_CONCURRENT"
export MESON_TESTTHREADS="$FDO_CI_CONCURRENT"
fi
echo "*************************************************"
echo "builddir: $MESON_BUILDDIR"
echo "meson args: $MESON_ARGS"
echo "ninja args: $NINJA_ARGS"
echo "meson test args: $MESON_TEST_ARGS"
echo "job count: ${jobcount-0}"
echo "*************************************************"
set -e
if [[ -z "$MESON_SKIP_SETUP" ]]; then
rm -rf "$MESON_BUILDDIR"
meson setup "$MESON_BUILDDIR" $MESON_ARGS
fi
meson configure "$MESON_BUILDDIR"
if [[ -z "$MESON_SKIP_BUILD" ]]; then
if [[ -n "$NINJA_ARGS" ]]; then
ninja_args="--ninja-args $NINJA_ARGS"
fi
meson compile -v -C "$MESON_BUILDDIR" $jobcount $ninja_args
fi
if [[ -n "$MESON_RUN_TEST" ]]; then
meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs
fi

View file

@ -0,0 +1,2 @@
#!/bin/sh
scan-build -v --status-bugs -plist-html "$@"

View file

@ -1,13 +0,0 @@
#!/bin/bash
set -e
set -x
export DEBIAN_FRONTEND=noninteractive
apt-get install -y software-properties-common
add-apt-repository universe
apt-get update
apt-get -y upgrade
apt-get install -y $@

119
.gitlab-ci/whitespace-check.py Executable file
View file

@ -0,0 +1,119 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
from pathlib import Path
from dataclasses import dataclass
import argparse
import itertools
import os
import sys
@dataclass
class WhitespaceError:
message: str
lineno: int
nlines: int = 1
column: None | int = None
ncolumns: int = 1
def test_duplicate_empty_lines(lines: list[str]) -> list[WhitespaceError]:
errors = []
for idx, (l1, l2) in enumerate(itertools.pairwise(lines)):
if not l1 and not l2:
errors.append(WhitespaceError("Duplicated empty lines", idx, nlines=2))
return errors
def test_tab_after_space(lines: list[str]) -> list[WhitespaceError]:
errors = []
for idx, l in enumerate(lines):
index = l.find(" \t")
if index > -1:
errors.append(
WhitespaceError(
"Tab after space", idx, nlines=index, column=index, ncolumns=2
)
)
return errors
def test_trailing_whitespace(lines: list[str]) -> list[WhitespaceError]:
errors = []
for idx, l in enumerate(lines):
if l.rstrip() != l:
errors.append(WhitespaceError("Trailing whitespace", idx))
return errors
def test_empty_line_between_braces(lines: list[str]) -> list[WhitespaceError]:
errors = []
for idx in range(len(lines) - 3):
l1 = lines[idx]
l2 = lines[idx + 1]
l3 = lines[idx + 2]
if l1.strip() == "}" and l3.strip() == "}" and l2.strip() == "":
errors.append(WhitespaceError("Empty line between closing braces", idx + 1))
return errors
def main():
parser = argparse.ArgumentParser(description="Whitespace checker script")
parser.add_argument(
"files",
metavar="FILES",
type=Path,
nargs="+",
help="The files to check",
)
args = parser.parse_args()
have_errors: bool = False
if os.isatty(sys.stderr.fileno()):
red = "\x1b[0;31m"
reset = "\x1b[0m"
else:
red = ""
reset = ""
for file in args.files:
lines = [l.rstrip("\n") for l in file.open().readlines()]
errors = []
errors.extend(test_tab_after_space(lines))
errors.extend(test_trailing_whitespace(lines))
if any(file.name.endswith(suffix) for suffix in [".c", ".h"]):
if not file.parts[0] == "include":
errors.extend(test_duplicate_empty_lines(lines))
errors.extend(test_empty_line_between_braces(lines))
for e in errors:
print(f"{red}ERROR: {e.message} in {file}:{reset}", file=sys.stderr)
print(f"{'-' * 72}", file=sys.stderr)
lineno = max(0, e.lineno - 5)
for idx, l in enumerate(lines[lineno : lineno + 10]):
if e.lineno <= lineno + idx < e.lineno + e.nlines:
prefix = "->"
hl = red
nohl = reset
else:
prefix = " "
hl = ""
nohl = ""
print(f"{hl}{lineno + idx:3d}: {prefix} {l.rstrip()}{nohl}")
print(f"{'-' * 72}", file=sys.stderr)
if errors:
have_errors = True
if have_errors:
sys.exit(1)
if __name__ == "__main__":
main()

View file

@ -1,31 +0,0 @@
## Summary
<!--
Summarize the bug encountered concisely. See
https://wayland.freedesktop.org/libinput/doc/latest/reporting-bugs.html for
detailed instructions to report bugs
-->
## Steps to reproduce
<!-- How one can reproduce the issue - this is very important -->
## libinput version you encountered the bug on
<!-- Note: if your libinput version is older than the current stable version,
please reproduce with a current version instead -->
## Hardware information:
<!-- Model name/number and general hardware information if applicable -->
## Other log output:
- `libinput record` output: <!-- attach file here -->
- `libinput debug-events --verbose` output: <!-- attach file here -->
<!-- Paste any other relevant logs - please use code blocks (```) to format
console output, logs, and code as it's very hard to read otherwise.) -->
/label ~bug ~"needs triage"

View file

@ -0,0 +1,35 @@
## Summary
<!--
Summarize the bug encountered concisely. See
https://wayland.freedesktop.org/libinput/doc/latest/reporting-bugs.html for
detailed instructions to report bugs
-->
## Steps to reproduce
<!-- How to reproduce the issue on a developer machine - this is very important -->
## Required information
<!-- Note: if your libinput version is older than the current stable version,
please reproduce with a current version instead -->
- libinput version:
- hardware information:
- `libinput record` output: do not paste, **attach** the file
- `libinput debug-events --verbose` output: do not paste, **attach the file**
<!--
Paste any other relevant logs - please use code blocks (```) to format
console output, logs, and code as it's very hard to read otherwise.)
Do not paste logs longer than 10 lines, **attach** those instead.
If your libinput record is longer than 5-10s, we will not be able to process
it.
-->
/label ~"bug" ~"needs triage"

31
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: no-commit-to-branch
args: ['--branch', 'main']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
hooks:
- id: ruff-check
args: ['--ignore=E741,E501', '--extend-exclude=subprojects', '.']
- id: ruff-format
args: ['--check', '--diff']
- repo: https://gitlab.freedesktop.org/freedesktop/ci-templates.git
rev: e195d80f35b45cc73668be3767b923fd76c70ed5
hooks:
- id: check-commits
- id: generate-template
- repo: local
hooks:
- id: run-sed-script
name: Check for whitespace errors
entry: ./.gitlab-ci/whitespace-check.py
language: system
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.6
hooks:
- id: clang-format
types_or: [c]

244
.triage-policies.yml Normal file
View file

@ -0,0 +1,244 @@
# This is a set of bugbot commands for issues and merge requests - setting any of the
# bugbot::foo labels will trigger gitlab-triage to run with this ruleset (well, the
# one we have on the main branch at the time)
#
# Note that for adding labels, the label must first created in the project.
# Re-used in issues and mrs
.close_needinfo: &close_needinfo
name: "Close stale needinfo bugs"
conditions:
labels:
- "bugbot::needinfo-timeout"
actions:
remove_labels:
- "bugbot::needinfo-timeout"
comment: |
I'm closing this bug because some information we requested a while ago was never supplied and
we're not able to continue without this information.
Please feel free to re-open.
status: "close"
.remind_needinfo: &remind_needinfo
name: "Remind users of needinfo bugs"
conditions:
labels:
- "bugbot::needinfo-reminder"
actions:
labels:
- "waiting on reporter"
remove_labels:
- "bugbot::needinfo-reminder"
comment: |
Hi. This is a friendly reminder that the maintainers are waiting on some information by
you (or maybe someone cc'd on this bug). If the information is not provided we may not
be able to proceed with this issue or merge request. Please check the recent comments, thanks.
.help_needed: &help_needed
name: "Remind users help is needed"
conditions:
labels:
- "bugbot::help-needed"
actions:
labels:
- "help needed"
remove_labels:
- "bugbot::help-needed"
comment: |
Hi. This issue or merge request needs help. This simply means that for
the foreseeable future, the maintainers will not have time to work on
this.
If this is a request for a new feature, then the feature is unlikely to
be implemented unless you or another contributor files a merge request.
If a merge request already exists maybe it needs finishing which often
involves adding documentation or tests.
If this is an issue affecting a specific device then it is unlikely to be
fixed. This may be because it requires specific hardware to reproduce or
it may be that the use case is niche enough that the maintainers do not
have time to implement it.
In short, to resolve this issue or get this merge request into libinput
help is needed.
.libinput_record: &libinput_record
name: "Request libinput record output"
conditions:
labels:
- "bugbot::libinput-record"
actions:
remove_labels:
- "bugbot::libinput-record"
comment: |
Looks like we may need some extra information. Please **attach** (do not paste) the full output
of `libinput record` and `libinput debug-events --verbose` (if you haven't yet).
The [documentation](https://wayland.freedesktop.org/libinput/doc/latest/tools.html#libinput-record-and-libinput-replay)
has some information on what we're looking for to be able to triage bugs.
.hid_recorder: &hid_recorder
name: "Request hid-recorder output"
conditions:
labels:
- "bugbot::hid-recorder"
actions:
remove_labels:
- "bugbot::hid-recorder"
comment: |
Looks like we may need some extra information that isn't yet available in this issue.
Please **attach** (do not paste) the output of [`hid-recorder`](https://github.com/hidutils/hid-recorder/)
for this device (run `sudo hid-recorder` without argument and it will let you pick the device).
This should show the data the kernel receives from the device and may provide a hint on what's going on here.
.udev_hid_bpf: &udev_hid_bpf
name: "Punt to udev-hid-bpf"
conditions:
labels:
- "bugbot::udev-hid-bpf"
actions:
remove_labels:
- "bugbot::udev-hid-bpf"
comment: |
This issue looks like it could or should be fixed with [udev-hid-bpf](https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/).
udev-hid-bpf is a collection of BPF programs that modify the HID Report Descriptor and/or HID Reports from the device,
making it possible to change the properties of a device and/or the events to make them compatible with the
expectations the kernel and userspace has of such devices.
Please see the [udev-hid-bpf documentation](https://libevdev.pages.freedesktop.org/udev-hid-bpf/) for details
and/or in particular the [udev-hid-bpf tutorial](https://libevdev.pages.freedesktop.org/udev-hid-bpf/tutorial.html)
if you need to enable a new device.
status: "close"
resource_rules:
issues:
rules:
- name: "Close kernel bugs"
conditions:
labels:
- "bugbot::kernel"
actions:
labels:
- "kernel"
remove_labels:
- "bugbot::kernel"
comment: |
This bug looks like a kernel issue and it cannot be fixed
in libinput directly. I'm closing this bug but do feel free
to continue discussing the issue here.
Kernel bugs are usually best sent to the [`linux-input` list](https://lore.kernel.org/linux-input/).
status: "close"
- name: "Expect a merge request"
conditions:
labels:
- "bugbot::expect-mr"
actions:
remove_labels:
- "bugbot::expect-mr"
comment: |
I'm closing this bug in anticipation of a merge request that fixes this issue.
If you are a new contributor, please see
[the freedesktop.org wiki](https://gitlab.freedesktop.org/freedesktop/freedesktop/-/wikis/home)
on how to get permissions to fork a project and file a merge request.
The [libinput documentation](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html)
also has more details on how to get started.
status: "close"
- name: "Point to 60-evdev.hwdb"
conditions:
labels:
- "bugbot::evdev-hwdb"
actions:
remove_labels:
- "bugbot::evdev-hwdb"
comment: |
Looks like this issue may be solved with a device-specific entry in systemd's hwdb.
You should have a /usr/lib/udev/hwdb.d/60-evdev.hwdb file which includes those quirks. Please see
the top of the file for instructions and follow those. Once the quirk is confirmed working
this issue (or parts thereof) should be fixed and you can submit a pull request to the
[systemd](https://github.com/systemd/systemd/) repository to get that quirk included.
Please link to the systemd issue here, thanks.
I'm closing this issue now, if the hwdb entry does not fix this issue here, please re-open.
status: "close"
- name: "Close bug for reopening"
conditions:
labels:
- "bugbot::close"
actions:
remove_labels:
- "bugbot::close"
comment: |
I'm temporarily closing this bug. The bug may not be fixed yet (see any comments above)
and we **want you to reopen it when/if it becomes actionable again**.
This process may feel unfamiliar but unfortunately closing/re-opening is the only action
all GitLab users are permitted to do. So we close it, you re-open it when whatever
above has been addressed and then we know we need to look at it again.
This issue may be closed more than once in a similar fashion but I only leave this
comment once since now you understand how it works. :smile:
For a detailed explanation on the how and why of this process please see
the [Closed Issues wiki page](https://gitlab.freedesktop.org/libinput/libinput/-/wikis/Closed-Issues).
status: "close"
- name: "Re-close bug for reopening"
conditions:
labels:
- "bugbot::re-close"
actions:
remove_labels:
- "bugbot::re-close"
comment: |
I'm temporarily closing this bug again. This is not a final close, see my comments above for the open/close process.
status: "close"
- *udev_hid_bpf
- *libinput_record
- *hid_recorder
- *close_needinfo
- *remind_needinfo
- *help_needed
merge_requests:
rules:
- name: "Remind contributor of commit rules"
conditions:
labels:
- "bugbot::commit-rules"
actions:
remove_labels:
- "bugbot::commit-rules"
comment: |
Hi. Looks like the pipeline failed because one or more of the commits in this MR do not meet our requirements.
Most commonly this the format of the commit message itself. The "Test summary" above has the details.
Please see [our docs for commit messages](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html#commit-messages)
and [our docs for submitting code](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html#submitting-code)
that explain how to amend and force-push to this repo.
- name: "Remind contributor that info needs to be in commit messages"
conditions:
labels:
- "bugbot::info-in-commit-message"
actions:
remove_labels:
- "bugbot::info-in-commit-message"
comment: |
Hi. Thanks for the merge request. I'm here to request that you add
some documentation about this merge request to the
**commit message** (or messages). You may have already written some
in the merge request description and in many cases it's fine to
copy/paste that into the commit message(s).
The reason is simple: once merged, no-one really looks at this this
page here anymore. The git log on the other hand is what developers
will use to understand the code so the information must be quickly
accessible via git.
Please see [our docs for submitting code](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html#submitting-code)
that explain how to amend and force-push to this repo.
- *udev_hid_bpf
- *libinput_record
- *hid_recorder
- *close_needinfo
- *remind_needinfo
- *help_needed

View file

@ -1,3 +1,4 @@
# Coding style
- Indentation in tabs, 8 characters wide, spaces after the tabs where
vertical alignment is required (see below)
@ -51,51 +52,102 @@ somenamethatiswaytoolong(int a,
- if it generates a static checker warning, it needs to be fixed or
commented
- declare variables at the top, try to keep them as local as possible.
Exception: if the same variable is re-used in multiple blocks, declare it
at the top.
Exception: basic loop variables, e.g. for (int i = 0; ...)
- declare variables when they are used first and try to keep them as local as possible.
Exception: basic loop variables, e.g. for (int i = 0; ...) should always be
declared inside the loop even where multiple loops exist
```c
int a;
int c;
if (foo) {
int b;
int b = 10;
c = get_value();
usevalue(c);
a = get_value();
usevalue(a, b);
}
if (bar) {
c = get_value();
useit(c);
a = get_value();
useit(a);
}
int c = a * 100;
useit(c);
```
- do not mix function invocations and variable definitions.
- avoid uninitialized variables where possible, declare them late instead.
Note that most of libinput predates this style, try to stick with the code
around you if in doubt.
wrong:
```c
{
int a = foo();
int *a;
int b = 7;
}
... some code ...
a = zalloc(32);
```
right:
```c
int b = 7;
... some code ...
int *a = zalloc(32);
```
- avoid calling non-obvious functions inside declaration blocks for multiple
variables.
bad:
```c
{
int a;
int b = 7;
a = foo();
int a = 7;
int b = some_complicated_function();
int *c = zalloc(32);
}
```
There are exceptions here, e.g. `tp_libinput_context()`,
`litest_current_device()`
better:
```c
{
int a = 7;
int *c = zalloc(32);
int b = some_complicated_function();
}
```
There is a bit of gut-feeling involved with this, but the goal is to make
the variable values immediately recognizable.
- Where statements are near-identical and repeated, try to keep them
identical:
bad:
```c
int a = get_some_value(x++);
do_something(a);
a = get_some_value(x++);
do_something(a);
a = get_some_value(x++);
do_something(a);
```
better:
```c
int a;
a = = get_some_value(x++);
do_something(a);
a = get_some_value(x++);
do_something(a);
a = get_some_value(x++);
do_something(a);
```
- if/else: { on the same line, no curly braces if both blocks are a single
statement. If either if or else block are multiple statements, both must
@ -133,3 +185,60 @@ if (foo) {
- Use stdbool.h's bool for booleans within the library (instead of `int`).
Exception: the public API uses int, not bool.
# Git commit message requirements
Our CI will check the commit messages for a few requirements. Below is the
list of what we expect from a git commit.
## Commit message content
A [good commit message](http://who-t.blogspot.com/2009/12/on-commit-messages.html) needs to
answer three questions:
- Why is it necessary? It may fix a bug, it may add a feature, it may
improve performance, reliabilty, stability, or just be a change for the
sake of correctness.
- How does it address the issue? For short obvious patches this part can be
omitted, but it should be a high level description of what the approach
was.
- What effects does the patch have? (In addition to the obvious ones, this
may include benchmarks, side effects, etc.)
These three questions establish the context for the actual code changes, put
reviewers and others into the frame of mind to look at the diff and check if
the approach chosen was correct. A good commit message also helps
maintainers to decide if a given patch is suitable for stable branches or
inclusion in a distribution.
## Commit message format
The canonical git commit message format is:
```
one line as the subject line with a high-level note
full explanation of the patch follows after an empty line. This explanation
can be multiple paragraphs and is largely free-form. Markdown is not
supported.
You can include extra data where required like:
- benchmark one says 10s
- benchmark two says 12s
```
The subject line is the first thing everyone sees about this commit, so make
sure it's on point.
## Commit message technical requirements
- The commit message should use present tense (not past tense). Do write
"change foo to bar", not "changed foo to bar".
- The text width of the commit should be 78 chars or less, especially the
subject line.
- The author must be the name you usually identify as and email address. We do
not accept the default `@users.noreply` gitlab addresses.
```
git config --global user.name Your Name
git config --global user.email your@email
```

4
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,4 @@
Thank you for your interest in contributing to libinput.
Please find more information about how to contribute in
[the documentation](https://wayland.freedesktop.org/libinput/doc/latest/contributing.html).

View file

@ -31,4 +31,4 @@ This copy is provided to provide consistent behavior regardless which kernel
version libinput is compiled against. The header is used during compilation
only, libinput does not link against GPL libraries.
[1] https://gitlab.freedesktop.org/libinput/libinput/blob/master/include/linux/input.h
[1] https://gitlab.freedesktop.org/libinput/libinput/blob/main/include/linux/input.h

View file

@ -60,8 +60,8 @@ Examples of how to use libinput are the debugging tools in the libinput
repository. Developers are encouraged to look at those tools for a
real-world (yet simple) example on how to use libinput.
- A commandline debugging tool: https://gitlab.freedesktop.org/libinput/libinput/tree/master/tools/libinput-debug-events.c
- A GTK application that draws cursor/touch/tablet positions: https://gitlab.freedesktop.org/libinput/libinput/tree/master/tools/libinput-debug-gui.c
- A commandline debugging tool: https://gitlab.freedesktop.org/libinput/libinput/tree/main/tools/libinput-debug-events.c
- A GTK application that draws cursor/touch/tablet positions: https://gitlab.freedesktop.org/libinput/libinput/tree/main/tools/libinput-debug-gui.c
License
-------
@ -75,10 +75,10 @@ libinput is licensed under the MIT license.
> and/or sell copies of the Software, and to permit persons to whom the
> Software is furnished to do so, subject to the following conditions: [...]
See the [COPYING](https://gitlab.freedesktop.org/libinput/libinput/tree/master/COPYING)
See the [COPYING](https://gitlab.freedesktop.org/libinput/libinput/tree/main/COPYING)
file for the full license information.
About
-----
Documentation generated by from git commit [__GIT_VERSION__](https://gitlab.freedesktop.org/libinput/libinput/commit/__GIT_VERSION__)
Documentation generated from git commit [__GIT_VERSION__](https://gitlab.freedesktop.org/libinput/libinput/commit/__GIT_VERSION__)

View file

@ -7,7 +7,9 @@
"list-devices:List all devices recognized by libinput"
"debug-events:Print all events as seen by libinput"
"debug-gui:Show a GUI to visualize libinput's events"
"debug-tablet:Show tablet axis and button values"
"measure:Measure various properties of devices"
"analyze:Analyze device data"
"record:Record the events from a device"
"replay:Replay the events from a device"
)
@ -43,40 +45,61 @@ __all_seats()
'--verbose[Use verbose output]' \
'--show-keycodes[Make all keycodes visible]' \
'--grab[Exclusively grab all opened devices]' \
'--compress-motion-events[Compress repeated motion events on a TTY]' \
'--device=[Use the given device with the path backend]:device:_files -W /dev/input/ -P /dev/input/' \
'--udev=[Listen for notifications on the given seat]:seat:__all_seats' \
'--apply-to=[Apply configuration options where the device name matches the pattern]:pattern' \
'--disable-sendevents=[Disable send-events option for the devices matching the pattern]:pattern' \
'--set-area=[Set the desired area as "x1/y1 x2/y2" (within \[0.0, 1.0\]) ]' \
'--set-calibration=[Set the first 6 elements of the 3x3 calibration matrix ("1.0 0.0 0.0 0.0 1.0 0.0")]' \
'--set-click-method=[Set the desired click method]:click-method:(none clickfinger buttonareas)' \
'--set-scroll-method=[Set the desired scroll method]:scroll-method:(none twofinger edge button)' \
'--set-clickfinger-map=[Set button mapping for clickfinger]:tap-map:(( \
lrm\:2-fingers\ right-click\ /\ 3-fingers\ middle-click \
lmr\:2-fingers\ middle-click\ /\ 3-fingers\ right-click \
))' \
'--set-eraser-button-button=[Set button mapping for the eraser button]:eraser-button:(BTN_STYLUS BTN_STYLUS2 BTN_STYLUS3)' \
'--set-eraser-button-mode=[Set the eraser button mode]:eraser-mode:(default button)' \
'--set-pressure-range=[Set the tablet tool pressure range (within range \[0.0, 1.0\])]' \
'--set-profile=[Set pointer acceleration profile]:accel-profile:(adaptive flat custom)' \
'--set-rotation-angle=[Set the rotation angle in degrees]' \
'--set-scroll-button=[Set the button to the given button code]' \
'--set-profile=[Set pointer acceleration profile]:accel-profile:(adaptive flat)' \
'--set-scroll-method=[Set the desired scroll method]:scroll-method:(none twofinger edge button)' \
'--set-speed=[Set pointer acceleration speed (within range \[-1, 1\])]' \
'--set-tap-map=[Set button mapping for tapping]:tap-map:(( \
lrm\:2-fingers\ right-click\ /\ 3-fingers\ middle-click \
lmr\:2-fingers\ middle-click\ /\ 3-fingers\ right-click \
))' \
+ '(tap-to-click)' \
'--enable-tap[Enable tap-to-click]' \
'--disable-tap[Disable tap-to-click]' \
+ '(custom pointer acceleration)' \
'--set-custom-points=[Set n points defining a custom acceleration function]' \
'--set-custom-step=[Set the distance along the x axis between the custom points]' \
'--set-custom-type=[Set the type of the acceleration function]:custom-type:(fallback motion scroll)' \
+ '(drag)' \
'--enable-drag[Enable tap-and-drag]' \
'--disable-drag[Disable tap-and-drag]' \
+ '(drag-lock)' \
'--enable-drag-lock[Enable drag-lock]' \
'--disable-drag-lock[Disable drag-lock]' \
+ '(natural-scrolling)' \
'--enable-natural-scrolling[Enable natural scrolling]' \
'--disable-natural-scrolling[Disable natural scrolling]' \
+ '(dwt)' \
'--enable-dwt[Enable disable-while-typing]' \
'--disable-dwt[Disable disable-while-typing]' \
+ '(dwtp)' \
'--enable-dwtp[Enable disable-while-trackpointing]' \
'--disable-dwtp[Disable disable-while-trackpointing]' \
+ '(left-handed)' \
'--enable-left-handed[Enable left handed button configuration]' \
'--disable-left-handed[Disable left handed button configuration]' \
+ '(middlebutton)' \
'--enable-middlebutton[Enable middle button emulation]' \
'--disable-middlebutton[Disable middle button emulation]' \
+ '(dwt)' \
'--enable-dwt[Enable disable-while-typing]' \
'--disable-dwt[Disable enable-while-typing]'
+ '(natural-scrolling)' \
'--enable-natural-scrolling[Enable natural scrolling]' \
'--disable-natural-scrolling[Disable natural scrolling]' \
+ '(plugins)' \
'--enable-plugins[Enable plugins]' \
'--disable-plugins[Disable plugins]' \
+ '(tap-to-click)' \
'--enable-tap[Enable tap-to-click]' \
'--disable-tap[Disable tap-to-click]'
}
(( $+functions[_libinput_debug-gui] )) || _libinput_debug-gui()
@ -89,6 +112,15 @@ __all_seats()
'--udev=[Listen for notifications on the given seat]:seat:_libinput_all_seats'
}
(( $+functions[_libinput_debug-tablet] )) || _libinput_debug-tablet()
{
_arguments \
'--help[Show debug-tablet help and exit]' \
'--device=[Use the given device with the path backend]:device:_files -W /dev/input/ -P /dev/input/' \
'--udev=[Use the first tablet device on the given seat]:seat:_libinput_all_seats'
}
(( $+functions[_libinput_measure] )) || _libinput_measure()
{
local curcontext=$curcontext state line ret=1
@ -148,20 +180,71 @@ __all_seats()
{
_arguments \
'--help[Show help message and exit]' \
'--format=dat[Specify the data format to be printed. The default is "summary"]'
'--format=dat[Specify the data format to be printed. The default is "summary"]' \
':device:_files -W /dev/input/ -P /dev/input/'
}
(( $+functions[_libinput_analyze_per-slot-delta] )) || _libinput_analyze_per-slot-delta()
{
_arguments \
'--help[Show help message and exit]' \
':recording:_files'
}
(( $+functions[_libinput_analyze_touch-down-state] )) || _libinput_analyze_touch-down-state()
{
_arguments \
'--help[Show help message and exit]' \
':recording:_files'
}
(( $+functions[_libinput_analyze_recording] )) || _libinput_analyze_recording()
{
_arguments \
'--help[Show help message and exit]' \
':recording:_files'
}
(( $+functions[_libinput_analyze] )) || _libinput_analyze()
{
local curcontext=$curcontext state line ret=1
local features
features=(
"per-slot-delta:analyze relative movement per touch per slot"
"recording:analyze a recording by printing a pretty table"
"touch-down-state:analyze a recording for logical touch down states"
)
_arguments -C \
'--help[Print help and exit]' \
':feature:->feature' \
'*:: :->option-or-argument'
case $state in
(feature)
_describe -t features 'feature' features
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:libinput-analyze-$words[1]:
if ! _call_function ret _libinput_analyze_$words[1]; then
_message "unknown feature: $words[1]"
fi
;;
esac
return ret
}
(( $+functions[_libinput_record] )) || _libinput_record()
{
_arguments \
'--help[Show help message and exit]' \
'--all[Record all /dev/input/event* devices available on the system]' \
'--autorestart=[Terminate the current recording after s seconds of device inactivity]' \
{-o+,--output=}'[Speficy the output file to use]:file:_files -g "*.yml"' \
{-o+,--output=}'[Specify the output file to use]:file:_files -g "*.yml"' \
'--multiple[Record multiple devices at once]' \
'--show-keycodes[Show keycodes as-is in the recording]' \
'--with-libinput[Record libinput events alongside device events]' \
'--with-hidraw[Record hidraw events alongside device events]' \
'*::device:_files -W /dev/input/ -P /dev/input/'
}

View file

@ -1,6 +1,6 @@
zshcompletiondir = get_option('zshcompletiondir')
if zshcompletiondir == ''
zshcompletiondir = join_paths(get_option('datadir'), 'zsh', 'site-functions')
zshcompletiondir = get_option('datadir') / 'zsh' / 'site-functions'
endif
if zshcompletiondir != 'no'

View file

@ -10,10 +10,10 @@ MAX_INITIALIZER_LINES = 0
WARNINGS = YES
QUIET = YES
INPUT = "@builddir@"
FILTER_PATTERNS = *.h *.dox
IMAGE_PATH = "@builddir@"
OUTPUT_DIRECTORY = doc
GENERATE_HTML = YES
HTML_OUTPUT = api
HTML_OUTPUT = html
SEARCHENGINE = NO
USE_MATHJAX = YES
MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest
@ -25,6 +25,7 @@ PREDEFINED = LIBINPUT_ATTRIBUTE_PRINTF(f, a)= \
DOTFILE_DIRS = "@builddir@"
EXAMPLE_PATH = "@builddir@"
SHOW_NAMESPACES = NO
HAVE_DOT = YES
HTML_HEADER = "@builddir@/header.html"
HTML_FOOTER = "@builddir@/footer.html"

View file

@ -130,6 +130,6 @@ release.
@section About
Documentation generated by from git commit [__GIT_VERSION__](https://gitlab.freedesktop.org/libinput/libinput/commit/__GIT_VERSION__)
Documentation generated from git commit [__GIT_VERSION__](https://gitlab.freedesktop.org/libinput/libinput/commit/__GIT_VERSION__)
*/

View file

@ -9,26 +9,6 @@ if not dot.found()
error('Program "dot" not found or not executable. Try building with -Ddocumentation=false')
endif
doxygen_version_cmd = run_command(doxygen.path(), '--version')
if doxygen_version_cmd.returncode() != 0
error('Command "doxygen --version" failed.')
endif
doxygen_version = doxygen_version_cmd.stdout()
if doxygen_version.version_compare('< 1.8.3')
error('doxygen needs to be at least version 1.8.3 (have @0@)'.format(doxygen_version))
endif
grep = find_program('grep')
dot_version_cmd = run_command(dot.path(), '-V')
if dot_version_cmd.returncode() != 0
error('Command "dot -V" failed.')
endif
# dot -V output is (to stderr):
# dot - graphviz version 2.38.0 (20140413.2041)
dot_version = dot_version_cmd.stderr().split(' ')[4]
if dot_version.version_compare('< 2.26')
error('Graphviz dot needs to be at least version 2.26 (have @0@)'.format(dot_version))
endif
mainpage = vcs_tag(command : ['git', 'log', '-1', '--format=%h'],
fallback : 'unknown',
input : 'mainpage.dox',
@ -37,7 +17,7 @@ mainpage = vcs_tag(command : ['git', 'log', '-1', '--format=%h'],
src_doxygen = files(
# source files
join_paths(meson.source_root(), 'src', 'libinput.h'),
'../../src/libinput.h',
# style files
'style/header.html',
'style/footer.html',
@ -46,19 +26,11 @@ src_doxygen = files(
'style/libinputdoxygen.css',
)
config_noop = configuration_data()
# Set a dummy replacement to silence meson warnings:
# meson.build:487: WARNING: Got an empty configuration_data() object and
# found no substitutions in the input file 'foo'. If you
# want to copy a file to the build dir, use the 'copy:'
# keyword argument added in 0.47.0
config_noop.set('dummy', 'dummy')
doxyfiles = []
foreach f : src_doxygen
df = configure_file(input: f,
output: '@PLAINNAME@',
configuration : config_noop)
copy : true)
doxyfiles += [ df ]
endforeach
@ -73,7 +45,7 @@ doxyfile = configure_file(input : 'libinput.doxygen.in',
custom_target('doxygen',
input : [ doxyfiles, doxyfile, mainpage ] + src_doxygen,
output : [ '.' ],
output : [ 'html' ],
command : [ doxygen, doxyfile ],
install : false,
depends: [ mainpage ],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 97 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 147 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 181 KiB

View file

@ -33,59 +33,78 @@ Measuring and fixing touchpad ranges
To fix the touchpad you need to:
#. measure the physical size of your touchpad in mm
#. run touchpad-edge-detector
#. trim the udev match rule to something sensible
#. replace the resolution with the calculated resolution based on physical settings
#. run the ``libinput measure touchpad-size`` tool
#. verify the hwdb entry provided by this tool
#. test locally
#. send a patch to the systemd project
#. send a patch to the `systemd project <https://github.com/systemd/systemd>`_.
Detailed explanations are below.
`libevdev <http://freedesktop.org/wiki/Software/libevdev/>`_ provides a tool
called **touchpad-edge-detector** that allows measuring the touchpad's input
ranges. Run the tool as root against the device node of your touchpad device
and repeatedly move a finger around the whole outside area of the
touchpad. Then control+c the process and note the output.
An example output is below:
The ``libinput measure touchpad-size`` tool is an interactive tool. It must
be called with the physical dimensions of the touchpad in mm. In the example
below, we use 100mm wide and 55mm high. The tool will find the touchpad device
automatically.
::
$> sudo touchpad-edge-detector /dev/input/event4
Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event4
Move one finger around the touchpad to detect the actual edges
Kernel says: x [1024..3112], y [2024..4832]
Touchpad sends: x [2445..4252], y [3464..4071]
$> sudo libinput measure touchpad-size 100x55
Using "Touchpad SynPS/2 Synaptics TouchPad": /dev/input/event4
Touchpad size as listed by the kernel: 49x66mm
Calculate resolution as:
x axis: 2088/<width in mm>
y axis: 2808/<height in mm>
Kernel specified touchpad size: 99.7x75.9mm
User specified touchpad size: 100.0x55.0mm
Suggested udev rule:
# <Laptop model description goes here>
evdev:name:SynPS/2 Synaptics TouchPad:dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:*
EVDEV_ABS_00=2445:4252:<x resolution>
EVDEV_ABS_01=3464:4071:<y resolution>
EVDEV_ABS_35=2445:4252:<x resolution>
EVDEV_ABS_36=3464:4071:<y resolution>
Kernel axis range: x [1024..5112], y [2024..4832]
Detected axis range: x [ 0.. 0], y [ 0.. 0]
Move one finger along all edges of the touchpad
until the detected axis range stops changing.
...
Move the finger around until the detected axis range matches the data sent
by the device. ``Ctrl+C`` terminates the tool and prints a
suggested hwdb entry. ::
...
Kernel axis range: x [1024..5112], y [2024..4832]
^C
Detected axis range: x [2072..4880], y [2159..4832]
Resolutions calculated based on user-specified size: x 28, y 49 units/mm
Suggested hwdb entry:
Note: the dmi modalias match is a guess based on your machine's modalias:
dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:
Please verify that this is the most sensible match and adjust if necessary.
-8<--------------------------
# Laptop model description (e.g. Lenovo X1 Carbon 5th)
evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
EVDEV_ABS_00=2072:4880:28
EVDEV_ABS_01=2159:4832:49
EVDEV_ABS_35=2072:4880:28
EVDEV_ABS_36=2159:4832:49
-8<--------------------------
Instructions on what to do with this snippet are in /usr/lib/udev/hwdb.d/60-evdev.hwdb
Note the discrepancy between the coordinate range the kernels advertises vs.
what the touchpad sends.
To fix the advertised ranges, the udev rule should be taken and trimmed
before being sent to the `systemd project <https://github.com/systemd/systemd>`_.
If there are discrepancies between the coordinate range the kernels
advertises and what what the touchpad sends, the hwdb entry should be added to the
``60-evdev.hwdb`` file provided by the `systemd project <https://github.com/systemd/systemd>`_.
An example commit can be found
`here <https://github.com/systemd/systemd/commit/26f667eac1c5e89b689aa0a1daef6a80f473e045>`_.
In most cases the match can and should be trimmed to the system vendor (svn)
and the product version (pvr), with everything else replaced by a wildcard
(*). In this case, a Lenovo T440s, a suitable match string would be:
The ``libinput measure touchpad-size`` tool attempts to provide the correct
dmi match but it does require user verification.
In most cases the dmi match can and should be trimmed to the system vendor (``svn``)
and the product version (``pvr``) or product name (``pn``), with everything else
replaced by a wildcard (``*``). In the above case, the match string is:
::
evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
As a general rule: for Lenovo devices use ``pvr`` and for all others use
``pn``.
.. note:: hwdb match strings only allow for alphanumeric ascii characters. Use a
wildcard (* or ?, whichever appropriate) for special characters.
@ -95,19 +114,19 @@ The actual axis overrides are in the form:
::
# axis number=min:max:resolution
EVDEV_ABS_00=2445:4252:42
EVDEV_ABS_00=2072:4880:28
or, if the range is correct but the resolution is wrong
::
# axis number=::resolution
EVDEV_ABS_00=::42
EVDEV_ABS_00=::28
Note the leading single space. The axis numbers are in hex and can be found
in *linux/input-event-codes.h*. For touchpads ABS_X, ABS_Y,
ABS_MT_POSITION_X and ABS_MT_POSITION_Y are required.
in ``linux/input-event-codes.h``. For touchpads ``ABS_X``, ``ABS_Y``,
``ABS_MT_POSITION_X`` and ``ABS_MT_POSITION_Y`` are required.
.. note:: The touchpad's ranges and/or resolution should only be fixed when
there is a significant discrepancy. A few units do not make a
@ -116,7 +135,7 @@ ABS_MT_POSITION_X and ABS_MT_POSITION_Y are required.
Once a match and override rule has been found, follow the instructions at
the top of the
`60-evdev.hwdb <https://github.com/systemd/systemd/blob/master/hwdb/60-evdev.hwdb>`_
`60-evdev.hwdb <https://github.com/systemd/systemd/blob/main/hwdb.d/60-evdev.hwdb>`_
file to save it locally and trigger the udev hwdb reload. Rebooting is
always a good idea. If the match string is correct, the new properties will
show up in the

View file

@ -13,6 +13,10 @@ for almost all API calls. General device handling is in ``evdev.c`` with the
device-type-specific implementations in ``evdev-<type>.c``. It is not
necessary to understand all of libinput to contribute a patch.
As of libinput 1.29 libinput has an internal plugin pipeline that modifies
the event stream before libinput proper sees it, see
:ref:`architecture-plugins`.
:ref:`architecture-contexts` is the only user-visible implementation detail,
everything else is purely internal implementation and may change when
required.
@ -150,10 +154,8 @@ pointers to handle events. Four such dispatch methods are currently
implemented: touchpad, tablet, tablet pad, and the fallback dispatch which
handles mice, keyboards and touchscreens.
.. graphviz::
digraph context
{
compound=true;
@ -177,13 +179,15 @@ handles mice, keyboards and touchscreens.
}
Event dispatch is done per "evdev frame", a collection of events up until including
the ``SYN_REPORT``. One such ``struct evdev_frame`` represents all state **updates**
to the previous frame.
While ``evdev.c`` pulls the event out of libevdev, the actual handling of the
events is performed within the dispatch method.
.. graphviz::
digraph context
{
compound=true;
@ -194,22 +198,107 @@ events is performed within the dispatch method.
evdev [label="evdev_device_dispatch()"]
plugins [label="plugin pipline"]
fallback [label="fallback_interface_process()"];
touchpad [label="tp_interface_process()"]
tablet [label="tablet_process()"]
pad [label="pad_process()"]
evdev -> fallback;
evdev -> touchpad;
evdev -> tablet;
evdev -> pad;
evdev -> plugins;
plugins -> fallback;
plugins -> touchpad;
plugins -> tablet;
plugins -> pad;
}
The dispatch methods then look at the ``struct input_event`` and proceed to
update the state. Note: the serialized nature of the kernel evdev protocol
requires that the device updates the state with each event but to delay
processing until the ``SYN_REPORT`` event is received.
The dispatch methods then look at the ``struct evdev_frame`` and proceed to
update the state.
.. _architecture-plugins:
------------------------------------------------------------------------------
The Plugin Pipeline
------------------------------------------------------------------------------
As of libinput 1.29 libinput has an **internal** plugin pipeline. These plugins
logically sit between libevdev and the :ref:`architecture-dispatch` and modify
the device and/or event stream. The primary motivation of such plugins is that
modifying the event stream is often simpler than analyzing the state later.
Plugins are loaded on libinput context startup and are executed in-order. The last
plugin is the hardcoded `evdev-plugin.c` which takes the modified event stream and
passes the events to the dispatch.
.. graphviz::
digraph context
{
compound=true;
rankdir="LR";
node [
shape="box";
]
evdev [label="evdev_device_dispatch()"]
p1 [label="P1"]
p2 [label="P2"]
p3 [label="P3"]
ep [label="evdev-plugin"]
fallback [label="fallback_interface_process()"];
touchpad [label="tp_interface_process()"]
tablet [label="tablet_process()"]
pad [label="pad_process()"]
evdev -> p1;
p1 -> p2;
p2 -> p3;
p3 -> ep;
ep -> fallback;
ep -> touchpad;
ep -> tablet;
ep -> pad;
}
Each plugin may not only modify the current event frame (this includes adding/removing events
from the frame), it may also append or prepend additional event frames. For
example the tablet proximity-timer plugin adds proximity in/out events to the
event stream.
.. graphviz::
digraph context
{
compound=true;
rankdir="LR";
node [
shape="box";
]
n0 [label= "", shape=none,height=.0,width=.0]
n1 [label= "", shape=none,height=.0,width=.0]
p1 [label="P1"]
p2 [label="P2"]
p3 [label="P3"]
ep [label="evdev-plugin"]
n0 -> p1 [label="F1"];
p1 -> p2 [label="F1"];
p2 -> p3 [label="F1,F2"];
p3 -> ep [label="F3,F1,F2"];
ep -> n1 [label="F3,F1,F2"];
}
In the diagram above, the plugin ``P2`` *appends* a new frame (``F2``), the plugin ``P3``
*prepends* a new frame (``F3``). The original event frame ``F1`` thus becomes the event frame
sequence ``F3``, ``F1``, ``F2`` by the time it reaches the :ref:`architecture-dispatch`.
Note that each plugin only sees one event frame at a time, so ``P3`` would see ``F1`` first,
decides to prepend ``F3`` and passes ``F1`` through. It then sees ``F2`` but does nothing with
it (optionally modified in-place).
.. _architecture-configuration:

View file

@ -16,6 +16,29 @@ The build instruction on this page detail how to overwrite your
system-provided libinput with one from the git repository, see
see :ref:`reverting_install` to revert to the previous state.
.. _distribution_repos:
------------------------------------------------------------------------------
Distribution repositories for libinput from git
------------------------------------------------------------------------------
Some distributions provide package repositories for users that want to test
the latest libinput without building it manually.
.. note:: The list below is provided for convenience. The libinput community
cannot provide any guarantees that the packages in those repositories are
correct, up-to-date and/or unmodified from the git branch. Due dilligence
is recommended.
The following repositories provide an up-to-date package for libinput:
- **Arch:** https://aur.archlinux.org/packages/libinput-git/
- **Fedora:** https://copr.fedorainfracloud.org/coprs/whot/libinput-git/
Please follow the respective repositories for instructions on how to enable
the repository and install libinput.
.. _building:
------------------------------------------------------------------------------
@ -32,7 +55,7 @@ process below. A successful build requires the
$> git clone https://gitlab.freedesktop.org/libinput/libinput
$> cd libinput
$> meson --prefix=/usr builddir/
$> meson setup --prefix=/usr builddir/
$> ninja -C builddir/
$> sudo ninja -C builddir/ install
@ -48,7 +71,7 @@ Additional options may also be specified. For example:
::
$> meson --prefix=/usr -Ddocumentation=false builddir/
$> meson setup --prefix=/usr -Ddocumentation=false builddir/
We recommend that users disable the documentation, it's not usually required
@ -73,7 +96,7 @@ again:
::
$> rm -r builddir/
$> meson --prefix=....
$> meson setup --prefix=....
.. _verifying_install:
@ -87,12 +110,10 @@ the library path and that all symlinks point to the new library.
::
$> ls -l /usr/lib64/libinput.*
-rwxr-xr-x 1 root root 946 Apr 28 2015 /usr/lib64/libinput.la
lrwxrwxrwx 1 root root 19 Feb 1 15:12 /usr/lib64/libinput.so -> libinput.so.10.13.0
lrwxrwxrwx 1 root root 19 Feb 1 15:12 /usr/lib64/libinput.so.10 -> libinput.so.10.13.0
-rwxr-xr-x 1 root root 204992 Feb 1 15:12 /usr/lib64/libinput.so.10.13.0
$> ldconfig -p | grep libinput | awk '{print $NF}' | xargs ls -l
lrwxrwxrwx 1 root root 14 lug 22 13:06 /usr/lib/x86_64-linux-gnu/libinput.so -> libinput.so.10
lrwxrwxrwx 1 root root 19 lug 22 13:06 /usr/lib/x86_64-linux-gnu/libinput.so.10 -> libinput.so.10.13.0
-rwxr-xr-x 1 root root 1064144 lug 22 13:06 /usr/lib/x86_64-linux-gnu/libinput.so.10.13.0
.. _reverting_install:
@ -121,7 +142,7 @@ overwriting manually installed files.
- **Fedora 22** and later: ``sudo dnf reinstall libinput``
- **RHEL/CentOS/Fedora 21** and earlier: ``sudo yum reinstall libinput``
- **openSUSE**: ``sudo zypper install --force libinput10``
- **Arch**: ``sudo packman -S libinput``
- **Arch**: ``sudo pacman -S libinput``
.. _building_selinux:
@ -167,8 +188,8 @@ libinput has a few build-time dependencies that must be installed prior to
running meson.
.. hint:: The build dependencies for some distributions can be found in the
`GitLab Continuous Integration file <https://gitlab.freedesktop.org/libinput/libinput/blob/master/.gitlab-ci.yml>`_.
Search for **FEDORA_RPMS** in the **variables:** definition
`GitLab Continuous Integration file <https://gitlab.freedesktop.org/libinput/libinput/blob/main/.gitlab-ci.yml>`_.
Search for **FEDORA_PACKAGES** in the **variables:** definition
and check the list for an entry for your distribution.
In most cases, it is sufficient to install the dependencies that your
@ -201,6 +222,14 @@ found``. See
`this blog post here <https://who-t.blogspot.com/2018/07/meson-fails-with-native-dependency-not-found.html>`_
for instructions on how to fix it.
..............................................................................
Build dependencies per distribution
..............................................................................
.. include:: dependencies.rst
.. _building_conditional:
------------------------------------------------------------------------------
@ -213,7 +242,7 @@ available options. The default build enables most options and thus requires
more build dependencies. On systems where build dependencies are an issue,
options may be disabled with this meson command: ::
meson --prefix=/usr -Dsomefeature=false builddir
meson setup --prefix=/usr -Dsomefeature=false builddir
Where ``-Dsomefeature=false`` may be one of:
@ -253,6 +282,11 @@ Software that uses meson should use the ``dependency()`` function: ::
pkgconfig = import('pkgconfig')
dep_libinput = dependency('libinput')
Software that uses CMake should use: ::
find_package(Libinput)
target_link_libraries(myprogram PRIVATE Libinput::Libinput)
Otherwise, the most rudimentary way to compile and link a program against
libinput is:

View file

@ -102,11 +102,12 @@ ignores such button clicks, this behavior is intentional.
Clickfinger behavior
------------------------------------------------------------------------------
This is the default behavior on Apple touchpads.
Here, a left, right, middle button event is generated when one, two, or
three fingers are held down on the touchpad when a physical click is
generated. The location of the fingers does not matter and there are no
software-defined button areas.
This is the default behavior on Apple touchpads. Here, a left, right, middle
button event is generated when one, two, or three fingers are held down on the
touchpad when a physical click is generated, given the default mapping. The
location of the fingers does not matter and there are no software-defined
button areas. It is possible to swap right and middle buttons, the same way as
with :ref:`tapping <tapping>`.
.. figure:: clickfinger.svg
:align: center

View file

@ -0,0 +1,46 @@
.. _clickpads_with_right_buttons:
==============================================================================
Clickpads with a fake right button
==============================================================================
libinput relies on the kernel to label :ref:`Clickpads <touchpads_buttons_clickpads>`
with the ``INPUT_PROP_BUTTONPAD`` property so it can enable the correct
:ref:`clickpad_softbuttons`. Clickpads are not expected to have a right button
since the whole surface can be depressed.
A common bug encountered with :ref:`Clickpads <touchpads_buttons_clickpads>`
is that the device advertises a physical right button where no such button
exists. This is usually a bug in the firmware of the device and causes the
following warning to be emitted by libinput::
"<device name> clickpad advertising right button"
The user-visible effect of this is usually negligible since these devices
cannot actually trigger a right click and libinput's default behaviors for
clickpads work as expected.
However, we should nonetheless correct the device to get rid of this warning
and avoid potential issues with future features. The :ref:`device-quirks`
provide a simple way to disable the fake right button on the device. The
following quirk disables the right button on the MyModel laptop from the
MyVendor OEM::
[MyVendor MyModel Touchpad]
MatchName=Foo Bar Touchpad
MatchUdevtype=touchpad
MatchDMIModAlias=dmi:*:svnMyVendor:pnMyModel:*
AttrEventCode=-BTN_RIGHT
The name of the device can be obtained using :ref:`libinput record <libinput-record>`,
the modalias match is a shell-style glob against the value of ``/sys/class/dmi/id/modalias``.
In most cases, matching should be against ``svn`` (system vendor) and one of
``pn`` (product name) or ``pvr`` (product version), whichever provides a
useful description of the individual laptop model. See the
:ref:`device-quirks` documentation for details on testing local quirks.
For reference, some example commits that add such a quirk are:
- `bf61ab9bb0694d0ac3d60a7f815779abfe4886e6 <https://gitlab.freedesktop.org/libinput/libinput/-/commit/bf61ab9bb0694d0ac3d60a7f815779abfe4886e6>`__
- `74fac6d040ac62048882dfb6f73da567ace6a6f5 <https://gitlab.freedesktop.org/libinput/libinput/-/commit/74fac6d040ac62048882dfb6f73da567ace6a6f5>`__
- `89cd0f990e3bee9906754d6ca8484ed5aa392249 <https://gitlab.freedesktop.org/libinput/libinput/-/commit/89cd0f990e3bee9906754d6ca8484ed5aa392249>`__

View file

@ -21,7 +21,7 @@ sys.path.insert(0, os.path.abspath('@BUILDDIR@'))
# -- Project information -----------------------------------------------------
project = '@PROJECT_NAME@'
copyright = '2018, the libinput authors'
copyright = '2019, the libinput authors'
author = 'the libinput authors'
# The short X.Y version
@ -62,7 +62,7 @@ master_doc = 'index'
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -167,13 +167,9 @@ texinfo_documents = [
from recommonmark.parser import CommonMarkParser
source_parsers = {
'.md': CommonMarkParser,
}
extlinks = { 'commit' :
('https://gitlab.freedesktop.org/libinput/libinput/commit/%s',
'git commit ')
'git commit %s')
}
# -- git version hack -------------------------------------------------

View file

@ -6,15 +6,21 @@ Configuration options
Below is a list of configurable options exposed to the users.
.. contents::
:depth: 1
:local:
.. hint:: Not all configuration options are available on all devices. Use
:ref:`libinput list-devices <libinput-list-devices>` to show the
configuration options for local devices.
libinput's configuration interface is available to the caller only, not
directly to the user. Thus is is the responsibility of the caller to expose
directly to the user. Thus it is the responsibility of the caller to expose
the various options and how these options are exposed. For example, the
xf86-input-libinput driver exposes the options through X Input device
properties and xorg.conf.d options. See the `libinput(4)
`xf86-input-libinput driver <https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/>`_
exposes the options through X Input device properties and `xorg.conf.d
<https://linux.die.net/man/5/xorg.conf.d>`_ options. See the `libinput(4)
<https://www.mankier.com/4/libinput>`_ man page for more details.
@ -28,7 +34,7 @@ options exposed by libinput are:
- how many tapping fingers are supported by this device
- a toggle to enable/disable tapping
- a toggle to enable/disable tap-and-drag, see :ref:`tapndrag`.
- a toggle to enable/disable tap-and-drag drag lock see :ref:`tapndrag`
- a toggle to enable/disable tap-and-drag drag lock, see :ref:`tapndrag`
- The default order is 1, 2, 3 finger tap mapping to left, right, middle
click, respectively. This order can be changed to left, middle, right click,
respectively.
@ -37,6 +43,19 @@ Tapping is usually available on touchpads and the touchpad part of external
graphics tablets. Tapping is usually **not** available on touch screens,
for those devices it is expected to be implemented by the toolkit.
------------------------------------------------------------------------------
Three-finger drag
------------------------------------------------------------------------------
Three-finger drag allows emulates the mouse button down while three fingers
are down on a touchpad without the need to press a physical button or use
:ref:`tapndrag`. See :ref:`drag_3fg` for details on how this feature works.
Three-finger drag is usually available on touchpads and the touchpad part of
external graphics tablets. Three-finger drag is usually **not** available on
touch screens, for those devices it is expected to be implemented by the
toolkit.
------------------------------------------------------------------------------
Send Events Mode
------------------------------------------------------------------------------
@ -135,12 +154,25 @@ Disable while typing
------------------------------------------------------------------------------
DWT is the most generic form of palm detection on touchpad. While the user
is typing the touchpad is disabled, the touchpad is enabled after a timeout.
See :ref:`disable-while-typing` for more info.
is typing on an internal keyboard the touchpad is disabled, the touchpad
is enabled again after a timeout. See :ref:`disable-while-typing` for more
info.
Disable-while-typing can be enabled or disabled, it is enabled by default on
most touchpads.
------------------------------------------------------------------------------
Disable while trackpointing
------------------------------------------------------------------------------
DWTP is a form of palm detecion for devices that have a trackpoint (like
Thinkpads). While the user is using the trackpoint, the touchpad is disabled,
being enabled again after a timeout. See :ref:`disable-while-trackpointing` for
more info.
Disable-while-trackpointing can be enabled or disabled, it is enabled by
default.
------------------------------------------------------------------------------
Calibration
------------------------------------------------------------------------------
@ -155,8 +187,51 @@ environment should provide an interface for this.
Rotation
------------------------------------------------------------------------------
The device rotation applies a corrective angle to relative input events.
This is currently only available on trackpoints which may be used sideways
or upside-down. The angle can be freely chosen but not all devices support
rotation other than 0, 90, 180, or 270 degrees. Rotation is off (0 degrees)
by default.
The device rotation applies a corrective angle to relative input events,
allowing the device to be used e.g. sideways or upside-down. For example, a
trackball may be used in a 90° rotated position for accessibility reasons -
such a rotated position allows triggering the buttons with the thumb or
the non-dominant hand.
Note that where a device rotation is higher than 160 but less than 200 degrees,
the direction of wheels is also inverted. For all other angles, the wheel
direction is left as-is.
.. _config-tablet-pressure-range:
------------------------------------------------------------------------------
Tablet tool pressure range
------------------------------------------------------------------------------
The pressure range on a :ref:`Tablet tool <tablet-tools>` can be reduced
from the full available hardware range to a subset of that range. The effect
of this is that the tablet will not register pressure below the given
the given threshold is met, and will reach the maximum logical pressure
before the maximum hardware-supported pressure is reached.
See :ref:`tablet-pressure-range` for more info.
.. _config-tablet-eraser-buttons:
------------------------------------------------------------------------------
Tablet tool eraser buttons
------------------------------------------------------------------------------
On many contemporary :ref:`Tablet tools <tablet-tools>` one button is hardcoded
in firmware to emulate an eraser. This button can be remapped to provide
a normal stylus button instead.
See :ref:`tablet-eraser-button` for more info.
------------------------------------------------------------------------------
Area configuration
------------------------------------------------------------------------------
Area configuration is available for some indirect input devices such as
graphics tablets. This configuration allows reducing the active area of
such a device to a subset of the physically possible area.
An example use-case for this is to match the aspect ratio of the device to that
of the screen.
See :ref:`tablet-area` for more info.

View file

@ -5,18 +5,152 @@
Contributing to libinput
==============================================================================
Contributions to libinput are always welcome. Please see the steps below for
details on how to create merge requests, correct git formatting and other
topics:
So you want to contribute to libinput? Great! We'd love to help you be a part
of our community. Here is some important information to help you.
.. contents::
:local:
Questions regarding this process can be asked on ``#wayland-devel`` on
freenode or on the `wayland-devel@lists.freedesktop.org
------------------------------------------------------------------------------
Code of Conduct
------------------------------------------------------------------------------
As a freedesktop.org project, libinput follows the `freedesktop.org
Contributor Covenant <https://www.freedesktop.org/wiki/CodeOfConduct>`_.
Please conduct yourself in a respectful and civilised manner when
interacting with community members on mailing lists, IRC, or bug trackers.
The community represents the project as a whole, and abusive or bullying
behaviour is not tolerated by the project.
------------------------------------------------------------------------------
Contact
------------------------------------------------------------------------------
Questions can be asked on ``#wayland`` on oftc or on the
`wayland-devel@lists.freedesktop.org
<https://lists.freedesktop.org/mailman/listinfo/wayland-devel>`_ mailing
list.
For IRC, ping user ``whot`` (Peter Hutterer, the libinput maintainer) though
note that he lives on UTC+10 and thus the rest of the world is out of sync
by default ;)
For anything that appears to be device specific and/or related to a new
feature, just file `an issue in our issue tracker
<https://gitlab.freedesktop.org/libinput/libinput/issues>`_. It's usually the
most efficient way to get answers.
------------------------------------------------------------------------------
What to work on?
------------------------------------------------------------------------------
If you don't already know what you want to improve or fix with libinput,
then a good way of finding something is to search for the ``help needed``
tag in our `issue tracker <https://gitlab.freedesktop.org/libinput/libinput/issues?label_name%5B%5D=help+needed>`_.
These are issues that have been triaged to some degree and deemed to be a
possible future feature to libinput.
.. note:: Some of these issue may require specific hardware to reproduce.
Another good place to help out with is the documentation. For anything you
find in these pages that isn't clear enough please feel free to reword it
and add what is missing.
------------------------------------------------------------------------------
Getting the code
------------------------------------------------------------------------------
The :ref:`building_libinput` have all the details but the short solution
will be:
::
$> git clone https://gitlab.freedesktop.org/libinput/libinput
$> cd libinput
$> meson setup --prefix=/usr builddir/
$> ninja -C builddir/
$> sudo ninja -C builddir/ install
You can omit the last step if you only want to test locally.
------------------------------------------------------------------------------
Working on the code
------------------------------------------------------------------------------
If you are planning to send patches, it's a good idea to set up
`pre-commit <https://pre-commit.com/>`_ with these commands::
$> pre-commit install
$> pre-commit install --hook-type pre-push
This will check a few things before you commit and/or push to your repos to
reduce the turnaround time for some common mistakes.
libinput has a roughly three-parts architecture:
- the front-end code which handles the ``libinput_some_function()`` API calls in ``libinput.c``
- the generic evdev interface handling which maps those API calls to the
backend calls (``evdev.c``).
- there are device-specific backends which do most of the actual work -
``evdev-mt-touchpad.c`` is the one for touchpads for example.
In general, things that only affect the internal workings of a device only
get implemented in the device-specific backend. You only need to touch the
API when you are adding configuration options. For more details, please read
the :ref:`architecture` document. There's also a `blog post describing the
building blocks
<https://who-t.blogspot.com/2019/03/libinputs-internal-building-blocks.html>`_
that may help to understand how it all fits together.
Documentation is in ``/doc/api`` for the doxygen-generated API documentation.
These are extracted from the libinput source code directly. The
documentation you're reading right now is in ``/doc/user`` and generated with
sphinx. Simply running ``ninja -C builddir`` will rebuild it and the final
product ends up in ``builddir/Documentation``.
------------------------------------------------------------------------------
Testing the code
------------------------------------------------------------------------------
libinput provides a bunch of :ref:`tools` to debug any changes - without
having to install libinput.
The two most useful ones are :ref:`libinput debug-events
<libinput-debug-events>` and :ref:`libinput debug-gui <libinput-debug-gui>`.
Both tools can be run from the build directory directly and are great for
quick test iterations::
$> sudo ./builddir/libinput-debug-events --verbose
$> sudo ./builddir/libinput-debug-gui --verbose
The former provides purely textual output and is useful for verifying event
streams from buttons, etc. The latter is particularly useful when you are
trying to debug pointer movement or placement. ``libinput debug-gui`` will
also visualize the raw data from the device so you can compare pointer
behavior with what comes from the kernel.
These tools create a new libinput context and will not affect your session's
behavior. Only once you've installed libinput and restarted your session
will your changes affect the X server/Wayland compositor.
Once everything seems to be correct, it's time to run the
:ref:`test-suite`::
$> sudo ./builddir/libinput-test-suite
This test suite can take test names etc. as arguments, have a look at
:ref:`test-suite` for more info. There are a bunch of other tests that are
run by the CI on merge requests, you can run those locally with ::
$> sudo ninja -C builddir check
So it always pays to run that before submitting. This will also run the code
through valgrind and pick up any memory leaks.
.. _contributing_submitting_code:
------------------------------------------------------------------------------
Submitting Code
------------------------------------------------------------------------------
@ -26,32 +160,80 @@ Any patches should be sent via a Merge Request (see the `GitLab docs
in the `libinput GitLab instance hosted by freedesktop.org
<https://gitlab.freedesktop.org/libinput/libinput>`_.
To submit a merge request, you need to
.. note:: freedesktop.org's GitLab instance has restrictions to prevent Spam
and you cannot fork libinput until you have successfully
`applied for fork permissions <https://gitlab.freedesktop.org/freedesktop/freedesktop/-/wikis/home>`_.
Below are the steps required to submit a merge request. They do not
replace `learning git <https://git-scm.com/doc>`__ but they should be
sufficient to make some of the more confusing steps obvious.
- `Register an account <https://gitlab.freedesktop.org/users/sign_in>`_ in
the freedesktop.org GitLab instance.
- `Fork libinput <https://gitlab.freedesktop.org/libinput/libinput/forks/new>`_
into your username's namespace
- Get libinput's main repository: ::
the freedesktop.org GitLab instance and
`apply for fork permissions <https://gitlab.freedesktop.org/freedesktop/freedesktop/-/wikis/home>`_.
- `Fork libinput <https://gitlab.freedesktop.org/libinput/libinput/-/forks/new>`_
into your username's namespace. Select public visibility.
- Get libinput's main repository. git will call this repository ``origin``. ::
git clone https://gitlab.freedesktop.org/libinput/libinput.git
- Add the forked git repository to your remotes (replace ``USERNAME``
with your username): ::
with your username). git will call this repository ``gitlab``. ::
cd /path/to/libinput.git
git remote add gitlab git@gitlab.freedesktop.org:USERNAME/libinput.git
git remote add gitlab git@ssh.gitlab.freedesktop.org:USERNAME/libinput.git
git fetch gitlab
- Push your changes to your fork: ::
- Create a new branch and commit your changes to that branch. ::
git push gitlab BRANCHNAME
git switch -C mynewbranch
# edit files, make changes
git add file1 file2
git commit -s
# edit commit message in the editor
- Submit a merge request. The URL for a merge request is: ::
Replace ``mynewbranch`` (here and in the commands below) with a meaningful
name. See :ref:`contributing_commit_messages` for details on the commit
message format.
- Push your changes to your fork and submit a merge request ::
git push gitlab mynewbranch
This command will print the URL to file a merge request, you then only
have to click through. Alternatively you can go to:
https://gitlab.freedesktop.org/USERNAME/libinput/merge_requests
Select your branch name to merge and ``libinput/libinput`` ``master`` as target branch.
Select your branch name to merge and ``libinput/libinput`` ``main`` as target branch.
- Verify that the CI completes successfully by visiting the merge request
page. A successful pipeline shows only green ticks, failure is indicated
by a red cross or a yellow exclamation mark (see
the `GitLab Docs
<https://docs.gitlab.com/ee/ci/pipelines/#pipeline-mini-graphs>`__). For
details about the failures, click on the failed jobs in the pipelines
and/or click the ``Expand`` button in the box for the test summaries.
A merge request without a successful pipeline may never be looked at by a
maintainer.
- If changes are requested by the maintainers, please **amend** the
commit(s) and **force-push** the updated branch. ::
# edits in file foo.c
git add foo.c
git commit --amend
git push -f gitlab mynewbranch
A force-push will re-trigger the CI and notify the merge request that new
changes are available.
If the branch contains more than one commit, please look at
`git interactive rebases
<https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History>`__
to learn how to change multiple commits, or squash new changes into older
commits.
------------------------------------------------------------------------------
Commit History
@ -92,23 +274,12 @@ describes the change. For example: ::
If in doubt what prefix to use, look at other commits that change the
same file(s) as the patch being sent.
.. _contributing_commit_messages:
------------------------------------------------------------------------------
Commit Messages
------------------------------------------------------------------------------
Read `on commit messages <http://who-t.blogspot.de/2009/12/on-commit-messages.html>`_
as a general guideline on what commit messages should contain.
Commit messages **should** contain a **Signed-off-by** line with your name
and email address. If you're not the patch's original author, you should
also gather S-o-b's by them (and/or whomever gave the patch to you.) The
significance of this is that it certifies that you created the patch, that
it was created under an appropriate open source license, or provided to you
under those terms. This lets us indicate a chain of responsibility for the
copyright status of the code.
We won't reject patches that lack S-o-b, but it is strongly recommended.
When you re-send patches, revised or not, it would be very good to document the
changes compared to the previous revision in the commit message and/or the
merge request. If you have already received Reviewed-by or Acked-by tags, you
@ -116,12 +287,27 @@ should evaluate whether they still apply and include them in the respective
commit messages. Otherwise the tags may be lost, reviewers miss the credit they
deserve, and the patches may cause redundant review effort.
If your commit solves a GitLab issue, add a ``Closes:`` tag followed by the
issue number at the end of your commit message. For example: ::
Closes: #974
If your commit fixes an issue introduced by another commit, use a ``Fixes`` tag
followed by the first 12 characters of the SHA-1 ID and the commit one line
summary at the end of your commit message. For example: ::
Fixes: 123456789012 ("The commit that caused the issue")
For further reading, please see
`'on commit messages' <http://who-t.blogspot.de/2009/12/on-commit-messages.html>`_
as a general guideline on what commit messages should contain.
------------------------------------------------------------------------------
Coding Style
------------------------------------------------------------------------------
Please see the `CODING_STYLE.md
<https://gitlab.freedesktop.org/libinput/libinput/blob/master/CODING_STYLE.md>`_
<https://gitlab.freedesktop.org/libinput/libinput/blob/main/CODING_STYLE.md>`_
document in the source tree.
------------------------------------------------------------------------------
@ -161,13 +347,75 @@ process, even if you use other clients to track the list of available
patches.
------------------------------------------------------------------------------
Code of Conduct
Failed pipeline errors
------------------------------------------------------------------------------
As a freedesktop.org project, libinput follows the `freedesktop.org
Contributor Covenant <https://www.freedesktop.org/wiki/CodeOfConduct>`_.
After submitting your merge request to GitLab, you might receive an email
informing you that your pipeline failed.
Please conduct yourself in a respectful and civilised manner when
interacting with community members on mailing lists, IRC, or bug trackers.
The community represents the project as a whole, and abusive or bullying
behaviour is not tolerated by the project.
Visit your merge request page and check the `pipeline mini graph
<https://docs.gitlab.com/ee/ci/pipelines/#pipeline-mini-graphs>`_ to know which
step failed.
Follow the appropriate section to fix the errors.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When your merge request modifies the CI templates, you might see this error
mainly due two reasons: the wrong file was modified and/or
``ci-fairy generate-template`` wasn't run.
``.gitlab-ci.yaml`` is auto generated, changes should be made in:
- ``.gitlab-ci/ci.template``
- ``.gitlab-ci/config.yaml``
Once the changes are ready, run
`ci-fairy <https://freedesktop.pages.freedesktop.org/ci-templates/ci-fairy.html#templating-gitlab-ci-yml>`_
to update ``.gitlab-ci.yaml``: ::
ci-fairy generate-template
Finally, force-push you changes. See :ref:`contributing_submitting_code` for
more details.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Usually, checking the CI log is enough to catch this errors. However, your merge
request is built using different configurations you might have not tested.
In order to fix this kind of problems, you can compile libinput using the same
flags used by the CI.
For example, if an error is found in the ``build-no-libwacom`` step, open the
log and search the build options: ::
[...]
+ rm -rf 'build dir'
+ meson 'build dir' -Dlibwacom=false
The Meson build system
[...]
Use the same flags to fix the issue and force-push you changes. See
:ref:`contributing_submitting_code` for more details.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The test suite is run for your merge request to check for bugs, regressions and
memory leaks among other issues.
Open the CI error log and search for a message similar to: ::
:: Failure: ../test/test-touchpad.c:465: touchpad_2fg_scroll_slow_distance(synaptics-t440)
See :ref:`test-suite` to learn how to run the failing tests.
Once the tests are fixed, force-push you changes. See
:ref:`contributing_submitting_code` for more details.

21
doc/user/dependencies.rst Normal file
View file

@ -0,0 +1,21 @@
.. warning:: The package lists are autogenerated from the `CI <https://gitlab.freedesktop.org/libinput/libinput/-/tree/master/.gitlab-ci.yml>`_.
- Fedora: ::
dnf install @FEDORA_PACKAGES@
- Ubuntu: ::
apt install @UBUNTU_PACKAGES@
- Debian: ::
apt install @DEBIAN_PACKAGES@
- Arch: ::
pacman -S @ARCH_PACKAGES@
- Alpine: ::
apk add @ALPINE_PACKAGES@

View file

@ -36,6 +36,7 @@ Topics below explain some behaviors of libinput.
normalization-of-relative-motion.rst
seats.rst
timestamps.rst
wheel-api.rst
.. _hacking_on_libinput:
@ -46,7 +47,6 @@ Hacking on libinput
.. toctree::
:maxdepth: 1
contributing.rst
architecture
test-suite.rst
pointer-acceleration.rst

View file

@ -68,10 +68,13 @@ MOUSE_WHEEL_CLICK_ANGLE
Below is an example udev rule to assign "seat1" to a device from vendor
0x012a with the model ID of 0x034b. ::
``0x012a`` with the model ID of ``0x034b``. ::
ACTION=="add|change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", ENV{ID_SEAT}="seat1"
$ cat /etc/udev/rules.d/99-my-device-is-on-seat1.rules
ACTION!="remove", KERNEL=="event[0-9]*", \
ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", \
ENV{ID_SEAT}="seat1"
@ -96,37 +99,13 @@ handle some combinations for historical reasons.
Below is an example udev rule to remove an **ID_INPUT_TOUCHPAD** setting
and change it into an **ID_INPUT_TABLET** setting. This rule would apply
for a device with the vendor/model ID of 012a/034b. ::
for a device with the vendor/model ID of ``012a``/``034b``. ::
ACTION=="add|change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", ENV{ID_INPUT_TOUCHPAD}="", ENV{ID_INPUT_TABLET}="1"
.. _ignoring_devices:
------------------------------------------------------------------------------
Ignoring specific devices
------------------------------------------------------------------------------
If a device has the **LIBINPUT_IGNORE_DEVICE** udev property set to any
value but "0", that device is not initialized by libinput. For a context
created with **libinput_udev_create_context()**, the device is silently ignored
and never shows up. If the device is added with **libinput_path_add_device()**
to a context created with **libinput_path_create_context()**, adding the device
will fail and return NULL (see that function's documentation for more
information).
If the property value is exactly "0", then the property is considered unset
and libinput initializes the device normally.
This property should be used for devices that are correctly detected as
input devices (see :ref:`udev_device_type`) but that should not be used by
libinput. It is recommended that devices that should not be handled as input
devices at all unset the **ID_INPUT** and related properties instead. The
**LIBINPUT_IGNORE_DEVICE** property signals that only libinput should
ignore this property but other parts of the stack (if any) should continue
treating this device normally.
$ cat /etc/udev/rules.d/99-my-device-is-a-tablet.rules
ACTION!="remove", KERNEL=="event[0-9]*", \
ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", \
ENV{ID_INPUT_TOUCHPAD}="", ENV{ID_INPUT_TABLET}="1"
.. _model_specific_configuration:
@ -150,7 +129,7 @@ The property **LIBINPUT_MODEL_LENOVO_X220_TOUCHPAD_FW81** may be set by a
user in a local hwdb file. This property designates the touchpad on a Lenovo
x220 with a touchpad firmware version 8.1. When this firmware version is
installed, the touchpad is imprecise. The touchpad device does not send
continuos x/y axis position updates, a behavior also observed on its
continuous x/y axis position updates, a behavior also observed on its
successor model, the Lenovo x230 which has the same firmware version. If the
above property is set, libinput adjusts its behavior to better suit this
particular model.
@ -263,4 +242,4 @@ Modifying the hwdb
device-specific quirks must go in to the :ref:`device-quirks` system.
For information about older libinput versions, please see the documentation
for your version avaialable in: https://wayland.freedesktop.org/libinput/doc/
for your version available in: https://wayland.freedesktop.org/libinput/doc/

View file

@ -6,14 +6,14 @@ Device quirks
libinput requires extra information from devices that is not always readily
available. For example, some touchpads are known to have jumping cursors
under specific conditions. libinput ships a set of files containting the
under specific conditions. libinput ships a set of files containing the
so-called model quirks to provide that information. Model quirks are usually
installed under ``/usr/share/libinput/<filename>.quirks`` and are standard
``.ini`` files. A file may contain multiple section headers (``[some
identifier]``) followed by one or more ``MatchFoo=Bar`` directives, followed by
at least one of ``ModelFoo=1`` or ``AttrFoo=bar`` directive. See the
``quirks/README.md`` file in the libinput source repository for more details on
their contents.
identifier]``) followed by one or more :ref:`MatchFoo=Bar <device-quirks-matches>`
directives, followed by at least one of ``ModelFoo=1`` or ``AttrFoo=bar`` directive.
See the ``quirks/README.md`` file in the libinput source repository for more
details on their contents.
.. warning:: Model quirks are internal API and may change at any time. No
backwards-compatibility is guaranteed.
@ -71,7 +71,7 @@ devices. ::
$ libinput quirks list /dev/input/event19
$ libinput quirks list /dev/input/event0
AttrLidSwitchReliability=reliable
AttrLidSwitchReliability=unreliable
The device `event19` does not have any quirks assigned.
@ -112,11 +112,11 @@ output.
.. _device-quirks-list:
------------------------------------------------------------------------------
List of supported device quirks
List of currently available device quirks
------------------------------------------------------------------------------
This list is a guide for developers to ease the process of submitting
patches upstream. This section shows device quirks supported in
patches upstream. This section shows device quirks currently available in
|git_version|.
.. warning:: Quirks are internal API and may change at any time for any reason.
@ -147,6 +147,21 @@ ModelBouncingKeys
timestamps can not be relied upon.
ModelSynapticsSerialTouchpad
Reserved for touchpads made by Synaptics on the serial bus
ModelPressurePad
.. warning:: This quirk is no longer in use. Use
``AttrInputProp=+INPUT_PROP_PRESSUREPAD`` instead.
Unlike in traditional touchpads, whose pressure value equals contact size,
on pressure pads pressure is a real physical axis.
Indicates that the device is a pressure pad.
ModelTouchpadPhantomClicks
Some laptops are prone to registering touchpad clicks when the case is
bent. Indicates that clicks should be ignored if no fingers are on the
touchpad.
ModelScrollOnMiddleClick
Some mice can generate unwanted high-resolution scroll events when the wheel
is pressed. Increases the scroll threshold required to start scrolling to
avoid accidentally scrolling when middle clicking.
AttrSizeHint=NxM, AttrResolutionHint=N
Hints at the width x height of the device in mm, or the resolution
of the x/y axis in units/mm. These may only be used where they apply to
@ -157,15 +172,20 @@ AttrTouchSizeRange=N:M, AttrPalmSizeThreshold=O
Specifies the touch size required to trigger a press (N) and to trigger
a release (M). O > N > M. See :ref:`touchpad_touch_size_hwdb` for more
details.
AttrTouchPressureRange=N:M, AttrPalmPressureThreshold=O, AttrThumbPressureThreshold=P
An AttrPalmSizeThreshold of zero unsets any threshold that has been
inherited from another quirk.
AttrPressureRange=N:M, AttrPalmPressureThreshold=O, AttrThumbPressureThreshold=P
Specifies the touch pressure required to trigger a press (N) and to
trigger a release (M), when a palm touch is triggered (O) and when a
thumb touch is triggered (P). O > P > N > M. See
:ref:`touchpad_pressure_hwdb` for more details.
AttrLidSwitchReliability=reliable|write_open
Indicates the reliability of the lid switch. This is a string enum. Do not
use "reliable" for any specific device. Very few devices need this, if in
doubt do not set. See :ref:`switches_lid` for details.
An AttrPalmPressureThreshold of zero unsets any threshold that has been
inherited from another quirk.
AttrLidSwitchReliability=reliable|unreliable|write_open
Indicates the reliability of the lid switch. This is a string enum.
Very few devices need this, if in doubt do not set. See :ref:`switches_lid`
for details. libinput 1.21.0 changed the default from unreliable to
reliable, which may be removed from local overrides.
AttrKeyboardIntegration=internal|external
Indicates the integration of the keyboard. This is a string enum.
Generally only needed for USB keyboards.
@ -173,10 +193,52 @@ AttrTPKComboLayout=below
Indicates the position of the touchpad on an external touchpad+keyboard
combination device. This is a string enum. Don't specify it unless the
touchpad is below.
AttrEventCodeDisable=EV_ABS;BTN_STYLUS;EV_KEY:0x123;
Disables the evdev event type/code tuples on the device. Entries may be
AttrEventCode=+EV_ABS;-BTN_STYLUS;+EV_KEY:0x123;
Enables or disables the evdev event type/code tuples on the device. The prefix
for each entry is either '+' (enable) or '-' (disable). Entries may be
a named event type, or a named event code, or a named event type with a
hexadecimal event code, separated by a single colon.
AttrInputProp=+INPUT_PROP_BUTTONPAD;-INPUT_PROP_POINTER;
Enables or disables the evdev input property on the device. The prefix
for each entry is either '+' (enable) or '-' (disable). Entries may be
a named input property or the hexadecimal value of that property.
The most common use of this is ``AttrInputProp=+INPUT_PROP_PRESSUREPAD``
which marks a touchpad as a :ref:`forcepad or pressurepad <touchpads_buttons_forcepads>`.
AttrPointingStickIntegration=internal|external
Indicates the integration of the pointing stick. This is a string enum.
Only needed for external pointing sticks. These are rare.
AttrTabletSmoothing=1|0
Enables (1) or disables (0) input smoothing for tablet devices. Smoothing is enabled
by default, except on AES devices.
.. _device-quirks-matches:
------------------------------------------------------------------------------
List of currently available matches
------------------------------------------------------------------------------
``Match*`` statements are how quirks are assigned to a device. Quirks with multiple
match statements must match all of those to apply.
.. warning:: Quirks are internal API and may change at any time for any reason.
No guarantee is given that any ``Match`` statement below works on
your version of libinput.
MatchName, MatchUniq
Match on the ``NAME`` or ``UNIQ`` udev property on this device. These properties
are typically derived from the device's kernel name or uniq but may be overridden
by a udev rule. These matches use ``fnmatch()`` globs.
MatchBus
A lower-case bus name. Currently supported are ``usb``, ``bluetooth``, ``ps2``,
``rmi``, ``i2c``, and ``spi``.
MatchVendor, MatchProduct, MatchVersion
The hexadecimal 4-digit vendor ID, product ID or driver version as
exported, uppercase with a ``0x`` prefix, e.g. ``0x12AB```.
MatchDMIModalias, MatchDeviceTree
An ``fnmatch()`` glob for the DMI modalias or the DeviceTree ``compatible`` string.
See ``/sys/class/dmi/id/modalias`` and ``/sys/firmware/devicetree/base/compatible``.
MatchUdevType
One of ``touchpad``, ``mouse``, ``pointingstick``, ``keyboard``, ``joystick``,
``tablet``, ``tablet-pad``. Matches the corresponding ``ID_INPUT_*`` udev
property.

View file

@ -0,0 +1,36 @@
digraph stack
{
compound=true;
splines=line;
rankdir="LR";
node [
shape="box";
]
subgraph cluster_2 {
label="Kernel";
event0 [label="/dev/input/event0"];
event1 [label="/dev/input/event1"];
}
subgraph cluster_0 {
label="Compositor process";
libinput [label="libinput context 1"];
}
subgraph cluster_1 {
label="libinput debug-events";
libinput2 [label="libinput context 2"];
}
stdout;
client [label="Wayland client"];
event0:e -> libinput:w;
event1:e -> libinput:w;
event0:e -> libinput2:w;
event1:e -> libinput2:w;
libinput -> client [ltail=cluster_0 label="Wayland protocol"];
libinput2 -> stdout [ltail=cluster_1];
}

View file

@ -0,0 +1,31 @@
digraph stack
{
compound=true;
rankdir="LR";
node [
shape="box";
]
subgraph cluster_2 {
label="Kernel";
event0 [label="/dev/input/event0"]
}
subgraph cluster_1 {
label="libinput";
subgraph cluster_0 {
label="Plugin pipeline";
p1 [label="00-foo.lua"];
p2 [label="10-bar.lua"];
}
libinput [label="libinput core"];
}
compositor [label="Compositor"];
event0 -> p1;
p1 -> p2;
p2 -> libinput;
libinput -> compositor [ltail=cluster_1 label="libinput API"];
}

40
doc/user/drag-3fg.rst Normal file
View file

@ -0,0 +1,40 @@
.. _drag_3fg:
==============================================================================
Three-finger drag
==============================================================================
Three-finger drag is a feature available on touchpads that emulates logical
button presses if three fingers are moving on the touchpad.
Three-finger drag is independent from :ref:`tapping` though some specific
behaviors may change when both features are enabled. For example, with
tapping *disabled* a three-finger gesture will virtually always be a three-finger
drag. With tapping *enabled* a three finger gesture may be a three finger drag
and a short delay is required to disambiguate between the two.
The exact behavior of three-finger drag is implementation defined and may
subtly change. As a general rule, the following constraints can be expected:
- three fingers down and movement trigger a button down and subsequent motion
events (i.e. a drag)
- releasing one finger while keeping two fingers down will keep the drag
and *not* switch to :ref:`twofinger_scrolling`.
- releasing two fingers while keeping one finger down will end the drag
(and thus release the button) and switch to normal pointer motion
- releasing all three fingers and putting three fingers back on the touchpad
immediately will keep the drag (i.e. behave as if the fingers were
never lifted)
- if tapping is enabled: a three finger tap immediately after a three-finger
drag will *not* tap, the user needs to wait past the timeout to
three-finger tap
- releasing all three fingers and putting one or two fingers back on
the touchpad will end the drag (and thus release the button)
and proceed with pointer motion or two-finger scrolling, if applicable
- if tapping is enabled: a one or two finger tap immediately after a
three-finger drag will trigger a one or two finger tap. The user does
not have to wait past the drag release timeout

View file

@ -42,6 +42,18 @@ This is a symptom of an invalid trackpoint multiplier. These devices need
pointer acceleration accordingly. See :ref:`trackpoint_range` for a detailed
explanation.
.. _faq_pointer_acceleration:
------------------------------------------------------------------------------
Why is libinput's pointer acceleration worse than synaptics/evdev
------------------------------------------------------------------------------
This is a known problem affecting some devices and/or use-case but the exact
cause is still unknown. It may be a device-specific issue, it may be a bug
in libinput's acceleration code, it may be a disagreement about how pointer
acceleration should feel. Unfortunately this is something that affected
users need to investigate and analyze.
.. _faq_enable_tapping:
------------------------------------------------------------------------------
@ -206,7 +218,7 @@ Why don't synclient and syndaemon work with libinput?
Synclient and syndaemon rely on X input device properties that are specific
to the xf86-input-synaptics X.Org input driver. Both were written when the
synaptics driver was the only commmon touchpad driver in existence. They
synaptics driver was the only common touchpad driver in existence. They
assume that if the properties aren't available, no touchpad is available
either. The xf86-input-libinput X.Org input driver does not export these
driver-specific properties, synclient/syndaemon will thus not detect the
@ -275,28 +287,28 @@ details on the hwdb and how to modify it locally.
.. _faq_timer_offset:
------------------------------------------------------------------------------
What causes the "timer offset negative" warning?
What causes the "your system is too slow" warning?
------------------------------------------------------------------------------
libinput relies on the caller to call **libinput_dispatch()** whenever data is
available on the epoll-fd. Doing so will process the state of all devices
and can trigger some timers to be set (e.g. palm detection, tap-to-click,
disable-while-typing, etc.). Internally, libinput's time offsets are always
based on the event time of the triggering event.
available. **libinput_dispatch()** will process the state of all devices,
including some time-sensitive features (e.g. palm detection, tap-to-click,
disable-while-typing, etc.).
For example, a touch event with time T may trigger a timer for the time T +
180ms. When setting a timer, libinput checks the wall clock time to ensure
that this time T + offset is still in the future. If not, the warning is
logged.
If the time between the event and the call to **libinput_dispatch()**
is excessive, those features may not work correctly. For example, a delay in
touch event processing may cause wrong or missing tap-to-click events or
a palm may not be detected correctly.
When this warning appears, it simply means that too much time has passed
between the event occurring (and the epoll-fd triggering) and the current
time. In almost all cases this is an indication of the caller being
overloaded and not handling events as speedily as required.
between the event occurring and the current time. In almost all cases this
is an indication of the caller being overloaded and not handling events as
speedily as required.
The warning has no immediate effect on libinput's behavior but some of the
functionality that relies on the timer may be impeded (e.g. palms are not
detected as they should be).
functionality that relies on the timer may be impeded. This is not a bug in
libinput. libinput does not control how quickly **libinput_dispatch()** is
called.
.. _faq_wayland:
@ -312,15 +324,67 @@ direct connection. As a technical analogy, the question is similar to "is
glibc required for HTTP", or (stretching the analogy a bit further) "Is a
pen required to write English". No, it isn't.
You can use libinput without a Wayland compositor, you can
write a Wayland compositor without libinput. Until 2018 the most common use
of libinput is with the X.Org X server through the xf86-input-libinput
driver. As Wayland compositors become more commonplace they will eventually
overtake X.
You can use libinput without a Wayland compositor, you can write a Wayland
compositor without libinput. On most major distributions, libinput is the
standard input stack used with the X.Org X server through the
xf86-input-libinput driver.
So why "for your use-case - probably"? All general-purpose Wayland
compositors use libinput for their input stack. Wayland compositors that
compositors use libinput for their input stack. Wayland compositors that
are more specialized (e.g. in-vehicle infotainment or IVI) can handle input
devices directly but the compositor you want to use
on your desktop needs an input stack that is more complex. And right now,
libinput is the only input stack that exists for this use-case.
.. _faq_separate_contexts:
------------------------------------------------------------------------------
Can I write a program to make libinput do $FOO
------------------------------------------------------------------------------
A common question is whether it's possible to write a program that can change
libinput's behavior - specifically the libinput that is used inside the
compositor. This indicates a misunderstanding of how libinput works:
libinput is a library that converts kernel events into libinput events, much
like ``sed`` reads data in, modifies it, and provides it to stdout.
.. graphviz:: libinput-contexts.gv
A libinput context is private to the process and cannot be modified from the
outside. To use the ``sed`` analogy again: if ``sed`` is used by a
shell-script, that script has full control over how ``sed`` processes data. In
this analogy, ``sed`` is libinput and the shell script is the compositor. It is
not possible to write a program to modify the behavior of the ``sed`` instance
used inside that shell script.
Writing a program that uses libinput is akin to writing a new script that
invoke ``sed``. It will not have any effect on the original ``sed`` instance.
The only way to modify libinput's behavior is to use the configuration options
exposed by the respective compositor. Those affect the libinput context inside
the compositor and thus have an effect on the input device behavior.
.. _faq_debug_events_not_showing_configuration:
------------------------------------------------------------------------------
Why doesn't libinput debug-events show my configuration
------------------------------------------------------------------------------
See :ref:`faq_separate_contexts`.
------------------------------------------------------------------------------
Can I configure scroll speed?
------------------------------------------------------------------------------
No, or at least, not as a libinput option.
When using a mouse, libinput notifies callers about physical scroll wheel
movement. When using another device, libinput notifies scroll in scroll units.
It is up to the caller to transform those events into a number of pixels to
scroll and, if desired, provide a way to adjust scroll speed.
This transformation cannot be done in libinput because it may depend on context
only known by the caller. For example, a caller may want to scroll faster
depending on how many pages a document has or depending on the widget that
receives the scroll events.

View file

@ -5,7 +5,7 @@ libinput Features
==============================================================================
Below is a list of features supported by libinput. The availability of
features usually depends on the device type and a device's capabilties.
features usually depends on the device type and a device's capabilities.
Not all features are user-configurable, some rely on :ref:`device-quirks`
to be useful.
@ -22,6 +22,7 @@ to be useful.
scrolling.rst
t440-support.rst
tapping.rst
drag-3fg.rst
tablet-support.rst
switches.rst
touchpad-pressure.rst

View file

@ -20,9 +20,10 @@ finger belonging to this gesture is lifted.
A single gesture cannot change the finger count. For example, if a user
puts down a fourth finger during a three-finger swipe gesture, libinput will
end the three-finger gesture and, if applicable, start a four-finger swipe
gesture. A caller may however decide that those gestures are semantically
identical and continue the two gestures as one single gesture.
end (cancel) the three-finger gesture and, if applicable, start a
four-finger swipe gesture. A caller may however decide that those gestures
are semantically identical and continue the two gestures as one single
gesture.
.. _gestures_pinch:
@ -73,6 +74,227 @@ gesture into an action or limit a gesture to specific directions only.
The illustration above shows a vertical three-finger swipe. The coordinates
provided during the gesture are the movements of the logical center.
.. _gestures_hold:
------------------------------------------------------------------------------
Hold gestures
------------------------------------------------------------------------------
A hold gesture is one where the user places one or more fingers on the
device without significant movement. The exact conditions when a hold gesture
transitions to pointer motion, scrolling or other gestures
are implementation-defined.
The hold gesture is intended to allow for the implementation of two specific
features:
- where a two-finger scrolling starts kinetic scrolling in the caller, a
subsequent hold gesture can be used to stop that kinetic scroll motion,
and
- hold-to-trigger interactions where the interaction could be a click, a
context menu, or some other context-specific interaction.
Hold gestures have three potential logical states:
- **begin**: one or more fingers are placed on the device at the same time
- **end**: all fingers are removed and the device enters a neutral logical state
- **end(cancelled)**: all fingers are part of a known interaction and the
currenthold gesture is no longer active. This may also occurs when
switching between hold gestures with different finger counts.
.. note:: By definition, a hold gesture does not move and thus no coordinate
updates are available.
For example, a user that puts one finger, then a second finger down and
releases them later may trigger the following event sequence:
============= ============ ============
Action Event Finger count
============= ============ ============
Finger 1 down <no event>
Finger 2 down **begin** 2
Finger 2 up **end** 2
Finger 1 up <no event>
============= ============ ============
A hold gesture may by be **cancelled**. This occurs
when the hold gesture changes into some other interaction and should no
longer be considered the current hold gesture. A **end(cancelled)** event
applies to the whole gesture (all fingers). For example, a pointer motion on
a touchpad may trigger this sequence:
+-------------------+-----------------------+
| Action | Event |
+===================+=======================+
| | Finger 1 down | | **hold begin** |
+-------------------+-----------------------+
| | Finger 1 motion | | **hold cancel** |
| | | | **pointer motion** |
+-------------------+-----------------------+
| | Finger 1 motion | | **pointer motion** |
+-------------------+-----------------------+
| | Finger 1 up | | *no event* |
+-------------------+-----------------------+
.. note:: Many interactions with a touchpad will start with a hold
gesture that is then cancelled as that gesture turns into e.g.
pointer motion. A caller **must** handle hold gesture
cancellations correctly.
A two-finger scroll motion on a touchpad may trigger this sequence:
+------------------------+---------------------+--------------+
| Action | Event | Finger count |
+========================+=====================+==============+
| | Finger 1 down | | **hold begin** | | 1 |
+------------------------+---------------------+--------------+
| | Finger 2 down | | **hold cancel** | | 1 |
| | | | **hold begin** | | 2 |
+------------------------+---------------------+--------------+
| | Finger 1+2 motion | | **hold cancel** | | 2 |
| | | | **pointer axis** | | |
+------------------------+---------------------+--------------+
| | Finger 1+2 motion | | **pointer axis** | |
+------------------------+---------------------+--------------+
| | Finger 1 up | | **pointer axis** | |
| | Finger 2 up | | (scroll stop) | |
+------------------------+---------------------+--------------+
A three-finger-swipe on a touchpad may trigger this sequence:
+---------------------+---------------------+--------------+
| Action | Event | Finger count |
+=====================+=====================+==============+
| | Finger 1 down | | **hold begin** | | 1 |
+---------------------+---------------------+--------------+
| | Finger 2 down | | **hold cancel** | | 1 |
| | | | **hold begin** | | 2 |
+---------------------+---------------------+--------------+
| | Finger 3 down | | **hold cancel** | | 2 |
| | | | **hold begin** | | 3 |
+---------------------+---------------------+--------------+
| | Finger motion | | **hold cancel** | | 3 |
| | | | **swipe begin** | | 3 |
+---------------------+---------------------+--------------+
| | Finger motion | | **swipe update** | | 3 |
+---------------------+---------------------+--------------+
| | Finger 1 up | | **swipe end** | | 3 |
| | Finger 2 up | | | | |
| | Finger 3 up | | | | |
+---------------------+---------------------+--------------+
Single-finger hold gestures
...........................
libinput uses implementation-defined timeouts based on other interactions
to determine whether a single-finger hold gestures should start. In other
words, a caller **must not** rely on a hold gesture always being triggered
as soon as a single finger is placed on the touchpad. This is true for any
hold gesture but especially so for single-finger hold gestures.
Hold gestures with a single finger are prone to being extremely short-lived.
On many devices it is impossible to hold a finger still enough for there to
be no pointer motion events, even if those deltas are miniscule. Changing
movement thresholds to rely on hold gestures would reduce device
responsiveness.
It is thus the responsibility of the caller to determine where hold gestures
transition in and out of other interactions. For example, a two-finger hold
may produce a cancelled single-finger hold gesture first:
+--------------------+----------------------+--------------+--------------+
| Action | Event | Finger count | Notes |
+====================+======================+==============+==============+
| | Finger 1 down | | **hold begin** | | 1 | |
+--------------------+----------------------+--------------+--------------+
| | Finger 1 motion | | **hold cancel** | | 1 | | tiny deltas|
| | | | **pointer motion** | | | | |
+--------------------+----------------------+--------------+--------------+
| | Finger 2 down | | **hold begin** | | 2 | |
+--------------------+----------------------+--------------+--------------+
| | Finger 1 up | | **hold end** | | | |
| | Finger 2 up | | | | | |
+--------------------+----------------------+--------------+--------------+
Note how the second hold gesture started with a finger count of 2 - without
the user ever lifting the first finger. Cancellation of hold gesture does
not imply the user has lifted a finger.
A hold gesture may start after a previous gesture completed. For example, a
single finger move-and-hold may trigger different sequences for the same
user interaction:
+--------------------+---------------------+-------------------+--------------+
| Action | Device 1 | Device 2 | Notes |
+====================+=====================+===================+==============+
| | Finger 1 down | | **hold begin** | | **hold begin** | |
+--------------------+---------------------+-------------------+--------------+
| | Finger 1 motion | | **hold cancel** | | | tiny deltas|
| | | **pointer motion**| | | |
+--------------------+---------------------+-------------------+--------------+
| | | **hold begin** | | |
+--------------------+---------------------+-------------------+--------------+
| | Finger 1 up | | **hold end** | | **hold end** | |
+--------------------+---------------------+-------------------+--------------+
A caller that wants to use hold gestures must thus be able to infer the same
interaction based on a stream of pointer motion events with small deltas.
libinput may start a new hold begin gesture once the pointer stops moving.
The time between the last pointer motion event and the hold begin event is
implementation-defined.
Hold gestures and thumb/palm detection
......................................
Thumb and palm detection effectively remove touches from being counted
towards an interaction, see :ref:`thumb_detection` and
:ref:`palm_detection` for details.
In the context of hold gestures, thumbs and palms are treated by libinput as
if the finger was removed from the device. Where other non-thumb/non-palm
fingers remain on the device, an **hold update** event is sent. Otherwise,
the hold gesture terminates with a **hold cancel** event.
Notably, libinput's thumb and palm detection is not a simple boolean per
touch but specific to the state of that touch in the overall context. For
example, a touch may be a thumb for tapping but not for clickfinger
interactions. A caller must not infer the number of physical fingers from
the hold gesture.
Likewise, libinput may classify a finger as thumb in the same hardware event
as a new finger is placed on the touchpad. In that case, the hold gesture
**may** continue as one-finger gesture despite there being two physical
touch points.
Information to determine whether a touch is a thumb or a palm may not be
available until some time into an interaction. Thus very short brushes
of the touchpad by a palm may trigger a **hold begin** followed by an
immediate **hold end** as libinput lacks sufficient information to identify
the touch as thumb/palm and send the corresponding **hold cancel**
event. A caller must not assume that a hold gesture always represents a
valid finger down.
Hold gestures and tap-to-click
..............................
:ref:`tapping` is the feature that enables short-lived touches to trigger
button presses.
.. warning:: Summary: do not use hold gestures to do your own tap-to-click
implementation
In the context of hold gestures, tap-to-click cancels current hold gestures
and a finger dragging (see :ref:`tapndrag`) does not begin a hold
gesture. Where tap-to-click is disabled a tap-like gesture may create
**hold begin** followed by a **hold end** event. Callers **must not** use
hold gestures for their own tap-to-click implementation as the data is not
reliable enough. libinput may change internal timeouts and thresholds
depending on whether tap-to-click is enabled and the hold gesture event may
not match touch sequences that a user would expect to be a tap-to-click
interaction.
.. _gestures_touchscreens:
------------------------------------------------------------------------------

View file

@ -0,0 +1,36 @@
.. _ignoring_devices:
==============================================================================
Ignoring specific devices
==============================================================================
If a device has the **LIBINPUT_IGNORE_DEVICE** udev property set to any
value but "0", that device is not initialized by libinput.
For a context created with **libinput_udev_create_context()**, the device is
silently ignored and never shows up. If the device is added with
**libinput_path_add_device()** to a context created with
**libinput_path_create_context()**, adding the device will fail and return NULL
(see that function's documentation for more
information).
If the property value is exactly "0", then the property is considered unset
and libinput initializes the device normally.
This property should be used for devices that are correctly detected as
input devices (see :ref:`udev_device_type`) but that should not be used by
libinput. It is recommended that devices that should not be handled as input
devices at all unset the **ID_INPUT** and related properties instead. The
**LIBINPUT_IGNORE_DEVICE** property signals that only libinput should
ignore this property but other parts of the stack (if any) should continue
treating this device normally.
Below is an example udev rule to assign **LIBINPUT_IGNORE_DEVICE** to the
device with the vendor/model ID of ``012a``/``034b``. ::
$ cat /etc/udev/rules.d/99-ignore-my-device.rules
ACTION!="remove", KERNEL=="event[0-9]*", \
ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", \
ENV{LIBINPUT_IGNORE_DEVICE}="1"
See :ref:`udev_config` for more details on libinput's udev properties.

View file

@ -0,0 +1,62 @@
.. _incorrectly_enabled_hires:
==============================================================================
Incorrectly enabled high-resolution scroll
==============================================================================
Some devices might announce support for high-resolution scroll wheel by enabling
``REL_WHEEL_HI_RES`` and/or ``REL_HWHEEL_HI_RES`` but never send a
high-resolution scroll event.
When the first low-resolution scroll event is received without any previous
high-resolution event, libinput prints a bug warning with the text **"device
supports high-resolution scroll but only low-resolution events have been
received"** and a link to this page.
.. note:: This warning will be printed only once
In most cases this is a bug on the device firmware, the kernel driver or in a
software used to create user-space devices through uinput.
Once the bug is detected, libinput will start emulating high-resolution scroll
events.
------------------------------------------------------------------------------
Detecting and fixing the issue
------------------------------------------------------------------------------
Events sent by a buggy device can be shown in the
:ref:`libinput record <libinput-record>` output for the device. Notice that
``REL_WHEEL_HI_RES`` and ``REL_HWHEEL_HI_RES`` are set but only ``REL_WHEEL``
events are sent: ::
# Supported Events:
# Event type 0 (EV_SYN)
# Event type 1 (EV_KEY)
# Event code 272 (BTN_LEFT)
# Event type 2 (EV_REL)
# Event code 0 (REL_X)
# Event code 1 (REL_Y)
# Event code 6 (REL_HWHEEL)
# Event code 8 (REL_WHEEL)
# Event code 11 (REL_WHEEL_HI_RES)
# Event code 12 (REL_HWHEEL_HI_RES)
[...]
quirks:
events:
- evdev:
- [ 0, 0, 2, 8, 1] # EV_REL / REL_WHEEL 1
- [ 0, 0, 0, 0, 0] # ------------ SYN_REPORT (0) ---------- +0ms
- evdev:
- [ 0, 15126, 2, 8, 1] # EV_REL / REL_WHEEL 1
- [ 0, 15126, 0, 0, 0] # ------------ SYN_REPORT (0) ---------- +15ms
- evdev:
- [ 0, 30250, 2, 8, 1] # EV_REL / REL_WHEEL 1
- [ 0, 30250, 0, 0, 0] # ------------ SYN_REPORT (0) ---------- +15ms
The issue can be fixed by adding a quirk to unset the ``REL_WHEEL_HI_RES`` and
``REL_HWHEEL_HI_RES`` event codes: ::
AttrEventCode=-REL_WHEEL_HI_RES;-REL_HWHEEL_HI_RES;
Please see :ref:`device-quirks` for details.

View file

@ -10,7 +10,10 @@
faqs
reporting-bugs
troubleshooting
contributing
development
lua-plugins
API documentation <@HTTP_DOC_LINK@/api/>
++++++++++++++++++++++++++++++
@ -21,7 +24,7 @@ libinput is a library that provides a full input stack for display servers
and other applications that need to handle input devices provided by the
kernel.
libinput provides device detection, event handling and abstraction so
libinput provides device detection, event handling and abstraction to
minimize the amount of custom input code the user of libinput need to
provide the common set of functionality that users expect. Input event
processing includes scaling touch coordinates, generating
@ -34,14 +37,14 @@ driver than an application library. See :ref:`what_is_libinput` for more details
Users and Developers
--------------------
Please use the side-bar to nagivate through the various documentation items.
Please use the side-bar to navigate through the various documentation items.
-----------------
API documentation
-----------------
The API documentation is available here:
http://wayland.freedesktop.org/libinput/doc/latest/api/
https://wayland.freedesktop.org/libinput/doc/latest/api/
.. note:: This documentation is generally only needed by authors of Wayland
compositors or other developers dealing with input events directly.

661
doc/user/lua-plugins.rst Normal file
View file

@ -0,0 +1,661 @@
.. _lua_plugins:
==============================================================================
Lua Plugins
==============================================================================
libinput provides a plugin system that allows users to modify the behavior
of devices. For example, a plugin may add or remove axes and/or buttons on a
device and/or modify the event stream seen by this device before it is passed
to libinput.
Plugins are implemented in `Lua <https://www.lua.org/>`_ (version 5.4)
and are typically loaded from the following paths:
- ``/etc/libinput/plugins/*.lua``, and
- ``/usr/lib{64}/libinput/plugins/*.lua``
Plugins are loaded in alphabetical order and where
multiple plugins share the same file name, the one in the highest precedence
directory is used. Plugins in ``/etc`` take precedence over
plugins in ``/usr``.
.. note:: Plugins lookup paths and their order are decided by the compositor.
Some compositors may support more/fewer/other lookup paths than the
above defaults.
Plugins are run sequentially in ascending sort-order (i.e. ``00-foo.lua`` runs
before ``10-bar.lua``) and each plugin sees the state left by any previous
plugins. For example if ``00-foo.lua`` changes all left button events to right
button events, ``10-bar.lua`` only ever sees right button events.
See the `Lua Reference manual <https://www.lua.org/manual/5.4/manual.html>`_ for
details on the Lua language.
.. note:: Plugins are **not** loaded by default, it is up to the compositor
whether to allow plugins. An explicit call to
``libinput_plugin_system_load_plugins()`` is required.
------------------------------------------------------------------------------
Limitations
------------------------------------------------------------------------------
Each script runs in its own sandbox and cannot communicate or share state with
other scripts.
Tables that hold API methods are not writable, i.e. it is not possible
to overwrite the default functionality of those APIs.
The Lua API available to plugins is limited to the following calls::
assert error ipairs next pairs tonumber
pcall select print tostring type xpcall
table string math _VERSION
It is not possible to e.g. use the ``io`` module from a script.
To use methods on instantiated objects, the ``object:method`` method call
syntax must be used. For example:
.. code-block:: lua
libinput:register()
libinput.register() -- this will fail
------------------------------------------------------------------------------
When to use plugins
------------------------------------------------------------------------------
libinput plugins are a relatively niche use-case that typically need to
address either once-off issues (e.g. those caused by worn-out hardware) or
user preferences that libinput does not and will not cater for.
Plugins should not be used for issues that can be fixed generically, for
example via :ref:`device-quirks`.
As a rule of thumb: a plugin should be a once-off that only works for one
user's hardware. If a plugin can be shared with many users then the plugin
implements functionality that should be integrated into libinput proper.
------------------------------------------------------------------------------
Testing plugins
------------------------------------------------------------------------------
Our :ref:`tools` support plugins if passed the ``--enable-plugins`` commandline
option. For implementing and testing plugins the easiest commands to test are
- ``libinput debug-events --enable-plugins`` (see :ref:`libinput-debug-events` docs)
- ``libinput debug-gui --enable-plugins`` (see :ref:`libinput-debug-gui` docs)
Where libinput is built and run from git, the tools will also look for plugins
in the meson build directory. See the ``plugins/meson.build`` file for details.
.. _plugins_api_lua:
--------------------------------------------------------------------------------
Lua Plugin API
--------------------------------------------------------------------------------
Lua plugins sit effectively below libinput and the API is not a
representation of the libinput API. Plugins modify the evdev event stream
received from the kernel.
.. graphviz:: plugin-stack.gv
The API revolves around two types: ``libinput`` and ``EvdevDevice``. The
``libinput`` type is used to register a plugin from a script, the
``EvdevDevice`` represents one device that is present in the system (but may
not have yet been added by libinput).
Typically a script does the following steps:
- register with libinput via ``libinput:register({versions})``
- connect to the ``"new-evdev-device"`` event
- receive an ``EvdevDevice`` object in the ``"new-evdev-device"`` callback
- check and/or modify the evdev event codes on the device
- connect to the device's ``"evdev-frame"`` event
- receive an :ref:`evdev frame <plugins_api_evdev_frame>` in the device's
``"evdev-frame"`` callback
- check and/or modify the events in that frame
Where multiple plugins are active, the evdev frame passed to the callback is
the combined frame as processed by all previous plugins in ascending sort order.
For example, if one plugin discards all button events subsequent plugins will
never see those button events in the frame.
.. _plugins_api_version_stability:
..............................................................................
Plugin version stability
..............................................................................
Plugin API version stability is provided on a best effort basis. We aim to provide
stable plugin versions for as long as feasible but may need to retire some older
versions over time. For this reason a plugin can select multiple versions it
implements, libinput will pick one supported version and adjust the plugin
behavior to match that version. See the ``libinput:register()`` call for details.
--------------------------------------------------------------------------------
Lua Plugin API Reference
--------------------------------------------------------------------------------
libinput provides the following globals and types:
.. _plugins_api_evdev_usage:
................................................................................
Evdev Usages
................................................................................
Evdev usages are a libinput-specific wrapper around the ``linux/input-event-codes.h``
evdev types and codes. They are used by libinput internally and are a 32-bit
combination of ``type << 16 | code``. Each usage carries the type and code and
is thus simpler to pass around and less prone to type confusion.
The :ref:`evdev global <plugins_api_evdev_global>` attempts to provide all
available usages but for the niche cases where it does not provide a named constant
the value can be crafted manually:
.. code-block:: lua
evdev_type = 0x3 -- EV_REL
evdev_code = 0x1 -- REL_Y
evdev_usage = (evdev_type << 16) | evdev_code
assert(usage == evdev.REL_Y)
.. _plugins_api_evdev_global:
................................................................................
The ``evdev`` global
................................................................................
The ``evdev`` global represents all known :ref:`plugins_api_evdev_usage`,
effectively in the form:
.. code-block:: lua
evdev = {
ABS_X = (3 << 16) | 0,
ABS_Y = (3 << 16) | 1,
...
REL_X = (2 << 16) | 0,
REL_Y = (2 << 16) | 1,
...
}
This global is provided for convenience to improve readability in the code.
Note that the name uses the event code name only (e.g. ``evdev.ABS_Y``) but the
value is an :ref:`Evdev Usage <plugins_api_evdev_usage>` (type and code).
See the ``linux/input-event-codes.h`` header file provided by your kernel
for a list of all evdev types and codes.
The evdev global also provides the bus type constants, e.g. ``evdev.BUS_USB``.
See the ``linux/input.h`` header file provided by your kernel
for a list of bus types.
.. _plugins_api_evdev_frame:
................................................................................
Evdev frames
................................................................................
Evdev frames represent a single frame of evdev events for a device. A frame
is a group of events that occurred at the same time. The frame usually only
contains state that has changed compared to the previous frame.
In our API a frame is exposed as a nested table with the following structure:
.. code-block:: lua
frame1 = {
{ usage = evdev.ABS_X, value = 123 },
{ usage = evdev.ABS_Y, value = 456 },
{ usage = evdev.BTN_LEFT, value = 1 },
}
frame2 = {
{ usage = evdev.ABS_Y, value = 457 },
}
frame3 = {
{ usage = evdev.ABS_X, value = 124 },
{ usage = evdev.BTN_LEFT, value = 0 },
}
.. note:: This API does not use ``SYN_REPORT`` events, it is implied at the
end of the table. Where a plugin writes a ``SYN_REPORT`` into the
list of events, that ``SYN_REPORT`` terminates the event frame
(similar to writing a ``\0`` into the middle of a C string).
A frame containing only a ``SYN_REPORT`` is functionally equivalent
to an empty frame.
Events or frames do not have a timestamp. Where a timestamp is required, that
timestamp is passed as additional argument to the function or return value.
See :ref:`plugins_api_evdev_global` for a list of known usages.
.. warning:: Evdev frames have an implementation-defined size limit of how many
events can be added to a single frame. This limit should never be
hit by valid plugins.
.. _plugins_api_libinputglobal:
................................................................................
The ``libinput`` global object
................................................................................
The core of our plugin API is the ``libinput`` global object. A script must
immediately ``register()`` to be active, otherwise it is unloaded immediately.
All libinput-specific APIs can be accessed through the ``libinput`` object.
.. function:: libinput:register({1, 2, ...})
Register this plugin with the given table of supported version numbers and
returns the version number selected by libinput for this plugin. See
:ref:`plugins_api_version_stability` for details.
.. code-block:: lua
-- this plugin can support versions 1, 4 and 5
version = libinput:register({1, 4, 5})
if version == 1 then
...
This function must be the first function called.
If the plugin calls any other functions before ``register()``, those functions
return the default zero value for the return type (``nil``, ``0``, an empty
table, etc.).
If the plugin does not call ``register()`` it will be removed immediately.
Once registered, any connected callbacks will be invoked whenever libinput
detects new devices, removes devices, etc.
This function must only be called once.
.. function:: libinput:unregister()
Unregister this plugin. This removes the plugin from libinput and releases
any resources associated with this plugin. This call must be the last call
in your plugin, it is effectively equivalent to Lua's
`os.exit() <https://www.lua.org/manual/5.4/manual.html#pdf-os.exit>`_.
.. function:: libinput:log_debug(message)
Log a message at the libinput debug log priority. See
``libinput:log_error()`` for details.
.. function:: libinput:log_info(message)
Log a message at the libinput info log priority. See
``libinput:log_error()`` for details.
.. function:: libinput:log_error(message)
Log a message at the libinput error log priority. Whether a message is
displayed in the log depends on libinput's log priority, set by the caller.
A compositor may disable stdout and stderr. Log messages should be preferred
over Lua's ``print()`` function to ensure the messages end up in the same
location as other libinput log messages and are not discarded.
.. function:: libinput:now()
Returns the current time in microseconds in ``CLOCK_MONOTONIC``. This is
the timestamp libinput uses internally. This timestamp cannot be mapped
to any particular time of day, see the
`clock_gettime() man page <https://man7.org/linux/man-pages/man3/clock_gettime.3.html>`_
for details.
.. function:: libinput:version()
Returns the agreed-on version of the plugin, see ``libinput:register()``.
If called before ``libinput:register()`` this function returns ``0``.
.. function:: libinput:connect(name, function)
Set the callback to the given event name. Only one callback
may be set for an event name at any time, subsequent callbacks
will replace any earlier callbacks for the same name.
Version 1 of the plugin API supports the following events and callback arguments:
- ``"new-evdev-device"``: A new :ref:`EvdevDevice <plugins_api_evdevdevice>`
has been seen by libinput but not yet added.
.. code-block:: lua
libinput:connect("new-evdev-device", function (device) ... end)
- ``"timer-expired"``: The timer for this plugin has expired. This event is
only sent if the plugin has set a timer with ``timer_set()``.
.. code-block:: lua
libinput:connect("timer-expired", function (now) ... end)
The ``now`` argument is the current time in microseconds in
``CLOCK_MONOTONIC`` (see ``libinput:now()``).
.. function:: libinput:timer_cancel()
Cancel the timer for this plugin. This is a no-op if the timer
has not been set or has already expired.
.. function:: libinput:timer_set_absolute(time)
Set a timer for this plugin, with the given time in microseconds.
The timeout specifies an absolute time in microseconds (see
``libinput:now()``) The timer will expire once and then call the
``"timer-expired"`` event handler (if any).
See ``libinput:timer_set_relative()`` for a relative timer.
The following two lines of code are equivalent:
.. code-block:: lua
libinput:timer_set_relative(1000000) -- 1 second from now
libinput:timer_set_absolute(libinput:now() + 1000000) -- 1 second from now
Calling this function will cancel any existing (relative or absolute) timer.
.. function:: libinput:timer_set_relative(timeout)
Set a timer for this plugin, with the given timeout in microseconds from
the current time. The timer will expire once and then call the
``"timer-expired"`` event handler (if any).
See ``libinput:timer_set_absolute()`` for an absolute timer.
The following two lines of code are equivalent:
.. code-block:: lua
libinput:timer_set_relative(1000000) -- 1 second from now
libinput:timer_set_absolute(libinput:now() + 1000000) -- 1 second from now
Calling this function will cancel any existing (relative or absolute) timer.
.. _plugins_api_evdevdevice:
................................................................................
The ``EvdevDevice`` type
................................................................................
The ``EvdevDevice`` type represents a device available in the system
but not (yet) added by libinput. This device may be used to modify
a device's capabilities before the device is processed by libinput.
A plugin should always ``connect()`` to the ``"device-removed"`` callback
to be notified when a device is removed. If the plugin keeps a reference
to this device but the device is discarded by libinput, the device's query
methods will return zero values (e.g. ``nil``, ``0``, an empty table) and
methods will be noops.
.. function:: EvdevDevice:info()
A table containing static information about the device, e.g.
.. code-block:: lua
{
bustype = evdev.BUS_USB,
vid = 0x1234,
pid = 0x5678,
}
A plugin must ignore keys it does not know about.
Version 1 of the plugin API supports the following keys and values:
- ``bustype``: The numeric bustype of the device. See the
``BUS_*`` defines in ``linux/input.h`` for the list of possible values.
- ``vid``: The 16-bit vendor ID of the device
- ``pid``: The 16-bit product ID of the device
If the device has since been discarded by libinput, this function returns an
empty table.
.. function:: EvdevDevice:name()
The device name as set by the kernel
.. function:: EvdevDevice:usages()
Returns a table of all usages that are currently enabled for this
device. Any type that exists on the device has a table assigned and in this
table any code that exists on the device is a boolean true.
For example:
.. code-block:: lua
{
evdev.REL_X = true,
evdev.REL_Y = true,
evdev.BTN_LEFT = true,
}
All other usages are ``nil``, so that the following code is possible:
.. code-block:: lua
local usages = device:usages()
if usages[evdev.REL_X] then
-- do something
end
If the device has since been discarded by libinput, this function returns an
empty table.
.. function:: EvdevDevice:absinfos()
Returns a table of all ``EV_ABS`` codes that are currently enabled for this device.
The event code is the key, each value is a table containing the following keys:
``minimum``, ``maximum``, ``fuzz``, ``flat``, ``resolution``.
.. code-block:: lua
{
evdev.ABS_X = {
minimum = 0,
maximum = 1234,
fuzz = 0,
flat = 0,
resolution = 45,
},
}
If the device has since been discarded by libinput, this function returns an
empty table.
.. function:: EvdevDevice:udev_properties()
Returns a table containing a filtered list of udev properties available on this device
in the form ``{ property_name = property_value, ... }``.
udev properties used as a boolean (e.g. ``ID_INPUT``) are only present if their
value is a logical true.
Version 1 of the plugin API supports the following udev properties:
- ``ID_INPUT`` and all of ``ID_INPUT_*`` that denote the device type as assigned
by udev. This information is usually used by libinput to determine a
device type. Note that for historical reasons these properties have
varying rules - some properties may be mutually exclusive, others are
independent, others may only be set if another property is set. Refer to
the udev documentation (if any) for details. ``ID_INPUT_WIDTH_MM`` and
``ID_INPUT_HEIGHT_MM`` are excluded from this set.
If the device has since been discarded by libinput, this function returns an
empty table.
.. function:: EvdevDevice:enable_evdev_usage(usage)
Enable the given :ref:`evdev usage <plugins_api_evdev_usage>` for this device.
Use :ref:`plugins_api_evdev_global` for better readability,
e.g. ``device:enable_evdev_usage(evdev.REL_X)``.
This function must not be used for ``ABS_*`` events, use ``set_absinfo()``
instead.
Once a usage is enabled, events for that usage may be added to a device's
frame.
If the device has since been discarded by libinput, this function does nothing.
.. function:: EvdevDevice:disable_evdev_usage(usage)
Disable the given :ref:`evdev usage <plugins_api_evdev_usage>` for this device.
Use :ref:`plugins_api_evdev_global` for better readability,
e.g. ``device:disable_evdev_usage(evdev.REL_X)``.
Once a usage is disabled, events for that usage are discarded from any
device frame.
If the device has since been discarded by libinput, this function does nothing.
.. function:: EvdevDevice:set_absinfo(usage, absinfo)
Set the absolute axis information for the given :ref:`evdev usage <plugins_api_evdev_usage>`
and enable it if it does not yet exist on the device. The ``absinfo`` argument is a table
containing zero or more of the following keys: ``minimum``, ``maximum``, ``fuzz``,
``flat``, ``resolution``. Any missing key defaults the corresponding
value from the device if the device already has this event usage or zero otherwise.
For example, the following code changes the resolution but leaves everything
else as-is:
.. code-block:: lua
local absinfo = {
resolution = 40,
}
device:set_absinfo(evdev.ABS_X, absinfo)
device:set_absinfo(evdev.ABS_Y, absinfo)
Use :ref:`plugins_api_evdev_global` for better readability as shown in the
example above.
If the device has since been discarded by libinput, this function does nothing.
.. note:: Overriding the absinfo values often indicates buggy firmware. This should
typically be fixed with an entry in the
`60-evdev.hwdb <https://github.com/systemd/systemd/blob/main/hwdb.d/60-evdev.hwdb>`_
or :ref:`device-quirks` instead of a plugin so all users of that
device can benefit from the fix.
.. function:: EvdevDevice:connect(name, function)
Set the callback to the given event name. Only one callback
may be set for an event name at any time, subsequent callbacks
will overwrite any earlier callbacks for the same name.
If the device has since been discarded by libinput, this function does nothing.
Version 1 of the plugin API supports the following events and callback arguments:
- ``"evdev-frame"``: A new :ref:`evdev frame <plugins_api_evdev_frame>` has
started for this device. If the callback returns a value other than
``nil``, that value is the frame with any modified events.
An empty frame (``{}``) causes libinput to drop the current event frame.
.. code-block:: lua
device:connect("evdev-frame", function (device, frame, timestamp)
-- change any event into a movement left by 1 pixel
move_left = {
{ usage = evdev.REL_X, value = -1, },
}
return move_left
end
The timestamp of an event frame is in microseconds in ``CLOCK_MONOTONIC``, see
``libinput:now()`` for details.
For performance reasons plugins that do not modify the event frame should
return ``nil`` (or nothing) instead of the event frame that was passed
as argument.
- ``"device-removed"``: This device was removed by libinput. This may happen
without the device ever becoming a libinput device as seen by libinput's
public API (e.g. if the device does not meet the requirements to be
added). Once this callback is invoked, the plugin should remove any
references to this device and stop using it.
.. code-block:: lua
device:connect("device-removed", function (device) ... end)
Functions to query the device's capabilities (e.g. ``usages()``) will
return an empty table.
.. function:: EvdevDevice:disconnect(name)
Disconnect the existing callback (if any) for the given event name. See
``EvdevDevice:connect()`` for a list of supported names.
.. function:: EvdevDevice:prepend_frame(frame)
Prepend an :ref:`evdev frame <plugins_api_evdev_frame>` for this device
**before** the current frame (if any). The **next** plugin will see the
prepended frame first followed by the current frame.
This function can only be called from within a device's ``"evdev-frame"``
handler or from within the plugin's timer callback function.
For example, to change a single event into a drag, prepend a button
down and append a button up before each event:
.. code:: lua
function frame_handler(device, frame, timestamp)
device:prepend_frame({
{ usage = evdev.BTN_LEFT, value = 1}
})
device:append_frame({
{ usage = evdev.BTN_LEFT, value = 0}
})
return nil -- return the current frame unmodified
-- The next plugin sees the event sequence:
-- button down, frame, button up
end
If called from within the plugin's timer there is no current frame and this
function is identical to ``append_frame()``.
.. function:: EvdevDevice:append_frame(frame)
Appends an :ref:`evdev frame <plugins_api_evdev_frame>` for this device
**after** the current frame (if any). This function can only be called from
within a device's ``"evdev-frame"`` handler or from within the plugin's timer
callback function.
If called from within the plugin's timer there is no current frame and this
function is identical to ``prepend_frame()``.
See ``prepend_frame()`` for more details.
.. function:: EvdevDevice:disable_feature(feature_name)
Disable the given libinput-internal feature for this device. This should be used
by plugins that replace that feature with a custom implementation for this device.
libinput may have multiple internal implementations for any given feature, disabling
it via this API disables any and all of those implementations, causing the feature to
no longer work at all. It is up to the plugin implementation to re-implement that
feature to match the user's expectation.
Version 1 of the plugin API supports the following features:
- ``"button-debouncing"``: see :ref:`button_debouncing`
- ``"touchpad-hysteresis"``: see :ref:`touchpad_jitter`
- ``"touchpad-jump-detection"``: see :ref:`touchpad_jumping_cursor`
- ``"touchpad-palm-detection"``: see :ref:`palm_detection`
- ``"wheel-debouncing"``: some high-resolution mouse wheel movements inside libinput
are delayed and/or modified

View file

@ -4,10 +4,16 @@ if not sphinx.found()
error('Program "sphinx-build" not found or not executable. Try building with -Ddocumentation=false')
endif
yq = find_program('yq', required : false)
if not yq.found()
warning('Program "yq" not found or not executable. Dependency list will not be built.')
endif
sphinx_config = configuration_data()
sphinx_config.set('PROJECT_NAME', meson.project_name())
sphinx_config.set('PROJECT_VERSION', meson.project_version())
sphinx_config.set('BUILDDIR', meson.current_build_dir())
sphinx_config.set('HTTP_DOC_LINK', doc_url)
git_version_page = vcs_tag(command : ['git', 'log', '-1', '--format=%H'],
fallback : 'unknown',
@ -44,6 +50,7 @@ src_404s = [
[ 'faqs.rst', 'faq.html'],
[ 'features.rst', 'features.html'],
[ 'gestures.rst', 'gestures.html'],
[ 'incorrectly-enabled-hires.rst', 'incorrectly-enabled-hires.html'],
[ 'middle-button-emulation.rst', 'middle_button_emulation.html'],
[ 'normalization-of-relative-motion.rst', 'motion_normalization.html'],
[ 'palm-detection.rst', 'palm_detection.html'],
@ -88,11 +95,13 @@ src_rst = files(
# dot drawings
'dot/seats-sketch.gv',
'dot/seats-sketch-libinput.gv',
'dot/libinput-contexts.gv',
'dot/libinput-stack-wayland.gv',
'dot/libinput-stack-xorg.gv',
'dot/libinput-stack-gnome.gv',
'dot/evemu.gv',
'dot/libinput-record.gv',
'dot/plugin-stack.gv',
# svgs
'svg/button-debouncing-wave-diagram.svg',
'svg/button-scrolling.svg',
@ -103,6 +112,7 @@ src_rst = files(
'svg/palm-detection.svg',
'svg/pinch-gestures.svg',
'svg/pinch-gestures-softbuttons.svg',
'svg/ptraccel-custom.svg',
'svg/ptraccel-linear.svg',
'svg/ptraccel-low-dpi.svg',
'svg/ptraccel-touchpad.svg',
@ -112,8 +122,11 @@ src_rst = files(
'svg/software-buttons-thumbpress.svg',
'svg/software-buttons-visualized.svg',
'svg/swipe-gestures.svg',
'svg/tablet-area.svg',
'svg/tablet-axes.svg',
'svg/tablet-cintiq24hd-modes.svg',
'svg/tablet-eraser-invert.svg',
'svg/tablet-eraser-button.svg',
'svg/tablet-interfaces.svg',
'svg/tablet-intuos-modes.svg',
'svg/tablet-left-handed.svg',
@ -132,15 +145,19 @@ src_rst = files(
'building.rst',
'button-debouncing.rst',
'clickpad-softbuttons.rst',
'clickpad-with-right-button.rst',
'contributing.rst',
'device-configuration-via-udev.rst',
'device-quirks.rst',
'drag-3fg.rst',
'faqs.rst',
'gestures.rst',
'index.rst',
'incorrectly-enabled-hires.rst',
'ignoring-devices.rst',
'middle-button-emulation.rst',
'normalization-of-relative-motion.rst',
'palm-detection.rst',
'lua-plugins.rst',
'pointer-acceleration.rst',
'reporting-bugs.rst',
'scrolling.rst',
@ -162,27 +179,39 @@ src_rst = files(
'trackpoints.rst',
'trackpoint-configuration.rst',
'what-is-libinput.rst',
'wheel-api.rst',
'features.rst',
'development.rst',
'troubleshooting.rst',
'configuration.rst',
)
config_noop = configuration_data()
# Set a dummy replacement to silence meson warnings:
# meson.build:487: WARNING: Got an empty configuration_data() object and
# found no substitutions in the input file 'foo'. If you
# want to copy a file to the build dir, use the 'copy:'
# keyword argument added in 0.47.0
config_noop.set('dummy', 'dummy')
src_sphinx = []
foreach f : src_rst
sf = configure_file(input: f,
output: '@PLAINNAME@',
configuration : config_noop)
copy : true)
src_sphinx += [ sf ]
endforeach
configure_file(input: 'index.rst',
output: 'index.rst',
configuration: sphinx_config)
dependencies_config = configuration_data()
if yq.found()
distributions = ['fedora', 'ubuntu', 'debian', 'arch', 'alpine']
foreach distro : distributions
yq_filter = '.distributions[] | select(.name == "@0@") | .packages | join(" ")'.format(distro)
deps = run_command(yq, '-r', yq_filter,
dir_gitlab_ci / 'config.yml',
check: true).stdout()
dependencies_config.set('@0@_PACKAGES'.format(distro.to_upper()), deps)
endforeach
endif
configure_file(input: 'dependencies.rst',
output: 'dependencies.rst',
configuration: dependencies_config)
# do not use -j, it breaks on Ubuntu
sphinx_output_dir = 'Documentation'
@ -190,5 +219,6 @@ custom_target('sphinx',
input : [ sphinx_conf_py, git_version_page ] + src_sphinx + dst_404s,
output : [ sphinx_output_dir ],
command : [ sphinx, '-q', '-b', 'html',
'-d', meson.current_build_dir() / 'doctrees',
meson.current_build_dir(), sphinx_output_dir],
build_by_default : true)

View file

@ -27,6 +27,11 @@ libinput applies a dpi-dependent acceleration function. At low speeds, a
movement speed increases, acceleration is applied - at high speeds a low-dpi
device will roughly feel the same as a higher-dpi mouse.
The reason for the normalization is convenience: a caller can assume that a
delta of 1 should result in a movement of 1 pixel on a traditional
(low-dpi) screen. On screens with high resolutions, the caller must scale
according to the UI scale factors.
This normalization only applies to accelerated coordinates, unaccelerated
coordinates are left in device-units. It is up to the caller to interpret
those coordinates correctly.

View file

@ -27,6 +27,7 @@ hardware-specific capabilities.
- :ref:`palm_exclusion_zones`
- :ref:`trackpoint-disabling`
- :ref:`disable-while-typing`
- :ref:`disable-while-trackpointing`
- :ref:`stylus-touch-arbitration`
Palm detection is always enabled, with the exception of
@ -91,9 +92,8 @@ Another exclusion zone is defined on the top edge of the touchpad. As with
the edge zones, libinput detects vertical movements out of the edge zone and
avoids palm detection on such touch sequences.
Each side edge exclusion zone is divided into a top part and a bottom part.
A touch starting in the top part of the exclusion zone does not trigger a
tap (see :ref:`tapping`).
A touch starting in the exclusion zone does not trigger a tap (see
:ref:`tapping`).
In the diagram below, the exclusion zones are painted red.
Touch 'A' starts inside the exclusion zone and moves
@ -103,10 +103,8 @@ despite moving out of the exclusion zone.
Touch 'B' starts inside the exclusion zone but moves horizontally out of the
zone. It is considered a valid touch and controls the cursor.
Touch 'C' occurs in the top part of the exclusion zone. Despite being a
tapping motion, it does not generate an emulated button event. Touch 'D'
likewise occurs within the exclusion zone but in the bottom half. libinput
will generate a button event for this touch.
Touch 'C' occurs in the exclusion zone. Despite being a tapping motion, it does
not generate an emulated button event.
.. figure:: palm-detection.svg
:align: center
@ -157,10 +155,29 @@ Notable behaviors of libinput's disable-while-typing feature:
typing.
- Physical buttons work even while the touchpad is disabled. This includes
:ref:`software-emulated buttons <t440_support>`.
- libinput pairs touchpads and keyboards for the disable-while-typing
feature. In the most common case, the internal touchpad is paired only
with the internal keyboard. Typing on an external keyboard will thus not
disable the touchpad. Some devices require a :ref:`quirk <device-quirks>`
to be correctly paired.
Disable-while-typing can be enabled and disabled by calling
**libinput_device_config_dwt_set_enabled()**.
.. _disable-while-trackpointing:
------------------------------------------------------------------------------
Disable-while-trackpointing
------------------------------------------------------------------------------
libinput automatically disables the touchpad for a timeout after the trackpoint
is moved, a feature referred to as "disable while trackpointing". libinput does
not require an external command and the feature is currently enabled for all
touchpads.
Disable-while-trackpointing can be enabled and disabled by calling
**libinput_device_config_dwtp_set_enabled()**.
.. _stylus-touch-arbitration:
------------------------------------------------------------------------------

View file

@ -19,12 +19,18 @@ Pointer acceleration profiles
------------------------------------------------------------------------------
The profile decides the general method of pointer acceleration.
libinput currently supports two profiles: "adaptive" and "flat". The adaptive
profile is the default profile for all devices and takes the current speed
of the device into account when deciding on acceleration. The flat profile
is simply a constant factor applied to all device deltas, regardless of the
speed of motion (see :ref:`ptraccel-profile-flat`). Most of this document
describes the adaptive pointer acceleration.
libinput currently supports three profiles: **"adaptive"**, **"flat"** and
**"custom"**.
- The **adaptive** profile is the default profile for all devices and takes the
current speed of the device into account when deciding on acceleration.
- The **flat** profile is simply a constant factor applied to all device deltas,
regardless of the speed of motion (see :ref:`ptraccel-profile-flat`).
- The **custom** profile allows the user to define a custom acceleration
function, giving full control over accelerations behavior at different speed
(see :ref:`ptraccel-profile-custom`).
Most of this document describes the adaptive pointer acceleration.
.. _ptraccel-velocity:
@ -166,7 +172,7 @@ what is a unit again.
libinput attempts to normalize unit data to the best of its abilities, see
:ref:`trackpoint_multiplier`. Beyond this, it is not possible to have
consistent behavior across different touchpad devices.
consistent behavior across different trackpoint devices.
.. figure:: ptraccel-trackpoint.svg
:align: center
@ -196,3 +202,95 @@ Pointer acceleration on tablets
Pointer acceleration for relative motion on tablet devices is a flat
acceleration, with the speed setting slowing down or speeding up the pointer
motion by a constant factor. Tablets do not allow for switchable profiles.
.. _ptraccel-profile-custom:
------------------------------------------------------------------------------
The custom acceleration profile
------------------------------------------------------------------------------
libinput supports a user-defined custom acceleration profile, which can be
adjusted for different movement types supported by a device. Movement types
include pointer movement, scrolling, etc. but the set of supported
movement types depends on the device.
The custom pointer acceleration profile gives users full control over the
acceleration behavior at different speeds. libinput exposes
an acceleration function ``f(x)`` where the x axis is the device speed in
device units per millisecond and the y axis is the pointer speed. By
supplying the y axis values for this function, users can control the
behavior of the device.
The user should take into account the native device dpi and screen dpi in
order to achieve the desired behavior/feel.
The custom acceleration function is defined using ``n`` points which are spaced
uniformly along the x axis, starting from 0 and continuing in constant steps.
At least two points must be defined and there is an implementation-defined
limit on how many points may be added.
Thus the points defining the custom function are:
``(0 * step, f[0]), (1 * step, f[1]), ..., ((n-1) * step, f[n-1])``
where ``f`` is a list of ``n`` values defining the output velocity for each
input velocity.
The acceleration factor is defined by the ratio of the output velocity to the
input velocity.
When a velocity value does not lie exactly on those points, a linear
interpolation of the two closest points will be calculated.
When a velocity value is greater than the max point defined, a linear
extrapolation of the two biggest points will be calculated.
the calculation made by libinput: ::
input_delta = device delta units
delta_time = time in ms since last input_delta
input_speed = hypot(input_delta) / delta_time
output_speed = user_custom_function(input_speed)
acceleration_factor = output_speed / input_speed
output_delta = input_delta * acceleration_factor
An example is the curve of ``0.0, 1.0`` with a step of ``1.0``. This curve
is the equivalent of the flat acceleration profile with any input speed ``N``
mapped to the same pointer speed ``N``. The curve ``1.0, 1.0`` neutralizes
any input speed differences and results in a fixed pointer speed.
Another example is the custom acceleration function ``x**2``,
sampling the function at ``4`` points up to
a maximum input speed of ``9`` will give us a custom function with
a step of ``3`` and points ``[0.0, 9.0, 36.0, 81.0]``:
.. figure:: ptraccel-custom.svg
:align: center
More sampled points can be added to improve the accuracy of the user custom
function.
Supported Movement types:
+---------------+---------------------------------+----------------------+
| Movement type | Uses | supported by |
+===============+=================================+======================+
| Fallback | Catch-all default movement type | All devices |
+---------------+---------------------------------+----------------------+
| Motion | Used for pointer motion | All devices |
+---------------+---------------------------------+----------------------+
| Scroll | Used for scroll movement | Mouse, Touchpad |
+---------------+---------------------------------+----------------------+
If a user does not provide the fallback custom acceleration function, a
flat acceleration function is used, i.e. no acceleration.
The fallback acceleration may be used for different types of movements, it is
strongly recommended that this acceleration function is a constant function.
For example, a touchpad has multiple movement types: pointer
movement, scroll movement, zoom movement (pinch), etc. As there is no separate
movement type for zoom yet, zoom movement is accelerated using the Fallback
acceleration function. Pointer movement is accelerated using the Motion
acceleration function, and Scroll movement is accelerated using the Scroll
acceleration function. If no Motion/Scroll acceleration function is set, the
Fallback acceleration function is used.
When using custom acceleration profile, any calls to set the speed have no
effect on the behavior of the custom acceleration function, but any future calls to
get the speed will reflect the requested speed setting.

View file

@ -64,7 +64,11 @@ For the vast majority of bugs you should not take longer than 5 seconds or
three interactions (clicks, touches, taps, ...) with the device to
reproduce. If it takes longer than that, you can narrow it down further.
Once you can reproduce it, use the :ref:`libinput-debug-events` helper tool.
Once you can reproduce it, use the :ref:`libinput-debug-events` helper
tool::
$> libinput debug-events --verbose
The output is textual and can help identify whether the bug is in libinput
at all. Note that any configuration options you have set must be specified
on the commandline, see the :ref:`libinput-debug-events`
@ -109,8 +113,8 @@ When you file a bug, please attach the following information:
- the output from udevadm info, see :ref:`udev_info`.
- the vendor model number of your laptop (e.g. "Lenovo Thinkpad T440s")
- and the content of ``/sys/class/dmi/id/modalias``.
- run the ``touchpad-edge-detector`` tool (provided by libevdev) and verify
that the ranges and sizes it prints match the touchpad (up to 5mm
- run ``libinput measure touchpad-size`` tool (see :ref:`absolute_coordinate_ranges_fix`)
and verify that the ranges and sizes it prints match the touchpad (up to 5mm
difference is ok)
If you are reporting a bug related to button event generation:
@ -166,8 +170,7 @@ When you file a bug, please attach the following information:
This is the most important piece of information, do not forget it!
- the vendor model number of the device (e.g. "Logitech M325")
- the output from udevadm info, see :ref:`udev_info`.
- the output of ``libinput measure trackpoint-range``
- the sensitivity of the trackpoint (adjust the event node number as needed): ::
- the sensitivity of the trackpoint if it exists (adjust the event node number as needed): ::
$ cat /sys/class/input/event17/device/device/sensitivity
@ -301,7 +304,7 @@ updated its package accordingly.
Whether the bug fix ends up in your distribution depends on a number of
things. Any given bug fix **may** be cherry-picked into the current stable
branch, depending on its severity, impact, and likelyhood to cause
branch, depending on its severity, impact, and likelihood to cause
regressions. Once cherry-picked it will land in the next stable branch
release. These are usually a few weeks apart.
@ -342,3 +345,51 @@ However, if the regression is in behavior unrelated to the fix itself it is
usually better to file a new bug to reduce the noise. For example, if a fix
to improve tapping breaks two-finger scrolling behavior, you should file a
new bug but reference the original bug.
.. _reporting_bugs_tags:
------------------------------------------------------------------------------
Gitlab issue tracker tags
------------------------------------------------------------------------------
The gitlab issue tracker allows developers to add tags to bugs to classify
them.
- **being worked on**: someone is currently working on this feature. This
tag is used for features that will take a long time to implement fully and
prevents others from having to duplicate the work. Do reach out and ask if
help and/or further testing is needed.
- **bug**: issue is confirmed to be a bug
- **cantfix**: for technical reasons, this bug cannot be fixed, or at least
it cannot be fixed in libinput.
- **enhancement**: this issue describes a future feature, not a bug.
- **help needed**: this issue requires someone outside the libinput core
developer team to implement it. It is unlikely to be implemented
without someone stepping up to do the work. If you do see this tag, do ask
for guidance on how to implement it.
- **hw issue**: an issue that affects a specific device and is a hardware
bug, not a software bug. Often these needs to be worked around in libinput
but there are cases where a hw issue ends up as *cantfix*.
- **janitor**: a cleanup task that does not substantially affect how
libinput works. These are usually good bugs for newcomers to start on.
- **kernel**: this issue is a kernel bug, not a libinput bug. Often closed
as *cantfix* of *wontfix* as we wait for the kernel to address the issue
instead.
- **needs triage**: bug has not yet been confirmed by a core developer.
- **not our bug**: the issue is in some other component of the stack and
needs to be addressed there.
- **please test**: a fix is available but not yet merged and should be
tested by the reporter or others affected by the issue.
- **quirk**: this is issue needs :ref:`device-quirks` to be fixed
- **regression**: the issue is a regression to previous versions of
libinput. These issues get priorities.
- **waiting on reporter**: some more information is required from the
reporter and the issue cannot be fixed until the issue has been provided.
Where a bug is left in this state for too long, the bug will be closed as
*cantfix*.
- **wontfix**: this issue will not get fixed. This tag is usually assigned
to feature requests that are outside the scope of libinput or would put an
unreasonable maintenance burdern on the maintainers.
These tags are high-level categories only, always look for the comments in
the issue to get further details.

View file

@ -52,9 +52,9 @@ vertically or horizontally.
Vertical and horizontal two-finger scrolling
For scrolling to trigger, a built-in distance threshold has to be met but once
engaged any movement will scroll. In other words, to start scrolling a
sufficiently large movement is required, once scrolling tiny amounts of
For scrolling to trigger, a built-in distance threshold has to be met, but once
engaged, any movement will scroll. In other words: to start scrolling, a
sufficiently large movement is required; once scrolling, tiny amounts of
movements will translate into tiny scroll movements.
Scrolling in both directions at once is possible by meeting the required
distance thresholds to enable each direction separately.
@ -117,12 +117,28 @@ the motion events. Cross-device scrolling is not supported but
for one exception: libinput's :ref:`t440_support` enables the use of the middle
button for button scrolling (even when the touchpad is disabled).
If the scroll button lock is enabled (see
**libinput_device_config_scroll_set_button_lock()**), the button does not
need to be held down. Pressing and releasing the button once enables the
button lock, the button is now considered logically held down. Pressing and
releasing the button a second time logically releases the button. While the
button is logically held down, motion events are converted to scroll events.
If the button is held and used to scroll for longer than a short grace
period, releasing the button does not engage the lock. This allows
hold-to-scroll for short, precise adjustments without accidentally toggling
the lock. A quick click or a brief scroll within the grace period still
engages the lock as normal.
.. _scroll_sources:
------------------------------------------------------------------------------
Scroll sources
------------------------------------------------------------------------------
.. note:: Scroll sources are deprecated with libinput 1.19. The scroll
source is now encoded in the event type.
libinput provides a pointer axis *source* for each scroll event. The
source can be obtained with the **libinput_event_pointer_get_axis_source()**
function and is one of **wheel**, **finger**, or **continuous**. The source
@ -140,3 +156,23 @@ See the **libinput_event_pointer_get_axis_source()** for details on the
behavior of each scroll source.
See also http://who-t.blogspot.com.au/2015/03/libinput-scroll-sources.html
.. _natural_scrolling:
------------------------------------------------------------------------------
Natural scrolling vs. traditional scrolling
------------------------------------------------------------------------------
Natural scrolling is the term (probably) coined by Apple for matching
the motion of the scroll device with the direction of the **content**.
In traditional scrolling, moving the wheel down causes the scroll bar
indicators to move down and the content to move up. In natural scrolling,
moving the wheel down causes the content to move down and the scroll bar
indicators to move up. This method of scrolling matches the interaction
with content on touch screens where a movement down also moves the content
down.
libinput supports natural scrolling for all its scroll methods; it can
be enabled with the
**libinput_device_config_scroll_set_natural_scroll_enabled()** function.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

View file

@ -138,13 +138,6 @@
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:6, 1;stroke-dashoffset:0;stroke-opacity:1;marker-mid:none;marker-end:url(#Arrow1Lend-2)"
id="path13492"
d="m 38.928571,67.914286 c 0,0 3.508205,24.810617 9.642857,57.857144 6.134651,33.04652 23.277202,79.68584 89.642852,90.35714" />
<rect
style="fill:#000000;fill-opacity:0.3559322;fill-rule:evenodd;stroke:none;stroke-width:3.30510259px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect3490"
width="65.310997"
height="136.12065"
x="7.0411549"
y="7.1355872" />
<text
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:0%;font-family:Utopia;-inkscape-font-specification:Utopia;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"
@ -155,13 +148,6 @@
id="tspan13876"
y="63.628628"
x="33.214291">A</tspan></text>
<rect
style="fill:#000000;fill-opacity:0.3559322;fill-rule:evenodd;stroke:none;stroke-width:3.30527353px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect3490-2"
width="65.272476"
height="136.21509"
x="321.22849"
y="6.8830237" />
<text
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:0%;font-family:Utopia;-inkscape-font-specification:Utopia;text-align:start;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"
@ -191,16 +177,6 @@
id="tspan13876-7-9"
y="46.009491"
x="342.27759">C</tspan></text>
<text
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;line-height:0%;font-family:Utopia;-inkscape-font-specification:Utopia;text-align:start;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"
id="text13874-8-1-4"
y="215.65927"
x="37.970726"><tspan
style="font-size:18px;font-family:Arial;-inkscape-font-specification:Arial"
id="tspan13876-7-9-5"
y="215.65927"
x="37.970726">D</tspan></text>
<circle
style="fill:#000000;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path4401"
@ -208,13 +184,6 @@
cy="24.53549"
r="4.0658817"
transform="scale(-1,1)" />
<circle
style="fill:#000000;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path4401-9"
cx="-36.452721"
cy="194.8819"
r="4.0658817"
transform="scale(-1,1)" />
<rect
width="248.87633"
height="6.8111157"

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg
<svg
width="600" height="480"
viewBox="0 0 600 480"
xmlns="http://www.w3.org/2000/svg"
@ -208,4 +208,3 @@
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="229.5488mm"
height="86.66362mm"
viewBox="0 0 813.36188 307.07582"
id="svg2"
version="1.1"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
sodipodi:docname="tablet-area.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4294"
id="linearGradient4300"
x1="465.81339"
y1="666.13727"
x2="454.82117"
y2="658.65521"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4294">
<stop
style="stop-color:#1a1a1a;stop-opacity:1;"
offset="0"
id="stop4296" />
<stop
style="stop-color:#808080;stop-opacity:1"
offset="1"
id="stop4298" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="410.53571"
inkscape:cy="188.39286"
inkscape:document-units="px"
inkscape:current-layer="layer3"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="3072"
inkscape:window-height="1659"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="tablet"
inkscape:groupmode="layer"
id="layer1"
style="display:inline"
transform="translate(67.109152,-133.63374)">
<g
id="g4309"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
transform="translate(0,1.0715222)">
<rect
y="134.15933"
x="75.787216"
height="306.02466"
width="522.19733"
id="rect4136"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:1.05118;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:4.20473, 1.05118;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.748138;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2.99255, 0.748138;stroke-dashoffset:0;stroke-opacity:1"
id="rect4140"
width="357.34042"
height="226.52563"
x="199.33878"
y="175.42407" />
<rect
y="175.72914"
x="103.10225"
height="22.142857"
width="65"
id="rect4142"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1"
id="rect4148"
width="65"
height="22.142857"
x="103.10225"
y="203.72914" />
<rect
y="231.72913"
x="103.10225"
height="22.142857"
width="65"
id="rect4150"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
<rect
y="323.72913"
x="103.10225"
height="22.142857"
width="65"
id="rect4154"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
<rect
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1"
id="rect4156"
width="65"
height="22.142857"
x="103.10225"
y="351.72913" />
<circle
r="22.98097"
cy="287.06125"
cx="135.61298"
id="path4158"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
<ellipse
ry="12.608653"
rx="11.5985"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.520431;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:2.08172, 0.520431;stroke-dashoffset:0;stroke-opacity:1"
id="circle4160"
cx="135.61298"
cy="287.06125" />
<rect
y="379.72913"
x="103.10225"
height="22.142857"
width="65"
id="rect4162"
style="opacity:0.92;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.989;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:3.956, 0.989;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="area">
<rect
style="display:inline;fill:#a44d4d;fill-opacity:1;stroke:none;stroke-width:0.675728"
id="rect1"
width="131.51813"
height="126.57689"
x="326.15009"
y="97.775696" />
<text
xml:space="preserve"
style="display:inline;font-size:11.25px;fill:#a44d4d;fill-opacity:1;stroke:none;stroke-width:0.9375"
x="261.92404"
y="244.01244"
id="text1"
transform="translate(67.109152,-133.63374)"><tspan
sodipodi:role="line"
id="tspan1"
style="fill:#000000;stroke-width:0.9375"
x="261.92404"
y="244.01244">0/0</tspan></text>
<path
style="display:inline;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.9375;stroke-linecap:round;stroke-dasharray:none"
d="m 259.17629,227.63135 v 7.63349"
id="path1"
transform="translate(67.109152,-133.63374)" />
<path
style="display:inline;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.9375;stroke-linecap:round;stroke-dasharray:none"
d="m 262.99304,231.44809 h -7.63349"
id="path2"
transform="translate(67.109152,-133.63374)" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="stylus"
style="display:inline"
transform="translate(67.109152,-133.63374)">
<g
id="g4304"
transform="matrix(0.37129971,0.09948946,-0.09618892,0.35898192,319.19555,24.123239)"
style="display:inline">
<path
sodipodi:nodetypes="czcc"
inkscape:connector-curvature="0"
id="path4286"
d="m 387.83544,799.76093 c -1.1128,3.61694 -3.2211,13.05163 -1.08543,14.07769 2.13567,1.02606 7.81039,-3.72162 10.99756,-6.69095 z"
style="display:inline;fill:#cccccc;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
sodipodi:nodetypes="ssssccssscsssssssssssssssssss"
inkscape:connector-curvature="0"
id="path4283"
d="m 392.64431,804.79039 c -8.52094,-5.90399 -8.49394,-11.01546 0.22879,-43.30647 1.03999,-3.85 2.46829,-9.67602 3.17399,-12.9467 0.99731,-4.62219 2.39455,-7.29497 6.27321,-12 2.74456,-3.32932 5.25157,-6.2783 5.57113,-6.5533 40.78433,-60.97488 80.48307,-125.1652 118.27253,-184 9.86283,-15.675 26.59424,-42.225 37.18089,-59 10.58666,-16.775 34.01422,-53.9 52.06125,-82.5 18.04703,-28.6 35.04505,-55.31677 37.77338,-59.37059 l 4.9606,-7.3706 4.1828,0.57332 c 4.16371,0.5707 4.19706,0.54958 7.30887,-4.62941 3.75631,-6.2516 8.82067,-11.57582 12.2516,-12.88026 5.99391,-2.27888 14.03303,2.9506 14.03303,9.12854 0,3.90203 -2.51704,10.62127 -6.02878,16.09385 -1.63417,2.54664 -2.97122,4.85949 -2.97122,5.13969 0,0.28019 0.9,1.54715 2,2.81546 2.28453,2.63408 2.47267,4.21918 0.86833,7.31574 -1.28218,2.47476 -26.61383,45.18798 -55.85724,94.18426 -10.83283,18.15 -25.72943,43.1137 -33.10357,55.47489 -7.37413,12.3612 -13.69273,23.17153 -14.04131,24.02297 -0.34859,0.85144 -7.50972,12.78774 -15.91363,26.52511 -15.54138,25.40455 -32.24417,52.9052 -70.74345,116.47703 -40.26028,66.47968 -43.66308,72.46026 -49.21634,86.5 -1.74036,4.4 -3.92035,8.675 -4.8444,9.5 -0.92405,0.825 -4.36246,3.75 -7.6409,6.5 -3.27845,2.75 -9.57132,8.3067 -13.98415,12.34823 -10.62726,9.73304 -16.99729,13.87361 -22.52334,14.64034 -3.99187,0.55386 -5.03885,0.251 -9.27207,-2.6821 z"
style="display:inline;fill:#000000" />
<path
sodipodi:nodetypes="scccs"
inkscape:connector-curvature="0"
id="path4292"
d="m 450.89044,688.88586 c 8.71518,5.62513 45.74035,-59.18436 43.57923,-75.43494 l -7.07107,-6.56599 c -29.93081,25.86352 -47.78438,74.72281 -47.78438,74.72281 z"
style="fill:url(#linearGradient4300);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.8 KiB

View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="104.05109mm"
height="64.88131mm"
viewBox="0 0 368.68495 229.89441"
id="svg4321"
version="1.1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="tablet-eraser-button.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs4323">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4294"
id="linearGradient4300"
x1="465.81339"
y1="666.13727"
x2="454.82117"
y2="658.65521"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4294">
<stop
style="stop-color:#1a1a1a;stop-opacity:1;"
offset="0"
id="stop4296" />
<stop
style="stop-color:#808080;stop-opacity:1"
offset="1"
id="stop4298" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4294"
id="linearGradient3"
gradientUnits="userSpaceOnUse"
x1="465.81339"
y1="666.13727"
x2="454.82117"
y2="658.65521" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="330.71429"
inkscape:cy="144.28571"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="3072"
inkscape:window-height="1659"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata4326">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-67.741956,-463.35919)">
<g
transform="matrix(0.35596319,-0.1450925,0.14027908,0.34415419,-98.897559,452.82709)"
id="g4304"
style="display:inline">
<path
style="display:inline;fill:#cccccc;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 387.83544,799.76093 c -1.1128,3.61694 -3.2211,13.05163 -1.08543,14.07769 2.13567,1.02606 7.81039,-3.72162 10.99756,-6.69095 z"
id="path4286"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czcc" />
<path
style="display:inline;fill:#000000"
d="m 392.64431,804.79039 c -8.52094,-5.90399 -8.49394,-11.01546 0.22879,-43.30647 1.03999,-3.85 2.46829,-9.67602 3.17399,-12.9467 0.99731,-4.62219 2.39455,-7.29497 6.27321,-12 2.74456,-3.32932 5.25157,-6.2783 5.57113,-6.5533 40.78433,-60.97488 80.48307,-125.1652 118.27253,-184 9.86283,-15.675 26.59424,-42.225 37.18089,-59 10.58666,-16.775 34.01422,-53.9 52.06125,-82.5 18.04703,-28.6 35.04505,-55.31677 37.77338,-59.37059 l 4.9606,-7.3706 4.1828,0.57332 c 4.16371,0.5707 4.19706,0.54958 7.30887,-4.62941 3.75631,-6.2516 8.82067,-11.57582 12.2516,-12.88026 5.99391,-2.27888 14.03303,2.9506 14.03303,9.12854 0,3.90203 -2.51704,10.62127 -6.02878,16.09385 -1.63417,2.54664 -2.97122,4.85949 -2.97122,5.13969 0,0.28019 0.9,1.54715 2,2.81546 2.28453,2.63408 2.47267,4.21918 0.86833,7.31574 -1.28218,2.47476 -26.61383,45.18798 -55.85724,94.18426 -10.83283,18.15 -25.72943,43.1137 -33.10357,55.47489 -7.37413,12.3612 -13.69273,23.17153 -14.04131,24.02297 -0.34859,0.85144 -7.50972,12.78774 -15.91363,26.52511 -15.54138,25.40455 -32.24417,52.9052 -70.74345,116.47703 -40.26028,66.47968 -43.66308,72.46026 -49.21634,86.5 -1.74036,4.4 -3.92035,8.675 -4.8444,9.5 -0.92405,0.825 -4.36246,3.75 -7.6409,6.5 -3.27845,2.75 -9.57132,8.3067 -13.98415,12.34823 -10.62726,9.73304 -16.99729,13.87361 -22.52334,14.64034 -3.99187,0.55386 -5.03885,0.251 -9.27207,-2.6821 z"
id="path4283"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ssssccssscsssssssssssssssssss" />
<path
style="fill:url(#linearGradient4300);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 450.89044,688.88586 c 8.71518,5.62513 45.74035,-59.18436 43.57923,-75.43494 l -7.07107,-6.56599 c -29.93081,25.86352 -47.78438,74.72281 -47.78438,74.72281 z"
id="path4292"
inkscape:connector-curvature="0"
sodipodi:nodetypes="scccs" />
</g>
<rect
transform="scale(1,-1)"
y="-693.18524"
x="67.81031"
height="16.036251"
width="168.54825"
id="rect4136"
style="fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.136709;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:0.546834, 0.136709;stroke-dashoffset:0;stroke-opacity:1" />
<rect
transform="scale(1,-1)"
y="-693.18524"
x="267.8103"
height="16.036251"
width="168.54825"
id="rect5709"
style="opacity:1;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.136709;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:0.546834, 0.136709;stroke-dashoffset:0;stroke-opacity:1" />
<text
id="text5713"
y="559.10828"
x="296.20877"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="559.10828"
x="296.20877"
id="tspan5715"
sodipodi:role="line"
style="font-size:15px;line-height:1.25;font-family:sans-serif">Eraser</tspan></text>
<text
id="text1"
y="559.10828"
x="109.0436"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="559.10828"
x="109.0436"
id="tspan1"
sodipodi:role="line"
style="font-size:15px;line-height:1.25;font-family:sans-serif">Pen</tspan></text>
<g
transform="matrix(0.35596319,-0.1450925,0.14027908,0.34415419,117.39708,452.82709)"
id="g3"
style="display:inline">
<path
style="display:inline;fill:#cccccc;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 387.83544,799.76093 c -1.1128,3.61694 -3.2211,13.05163 -1.08543,14.07769 2.13567,1.02606 7.81039,-3.72162 10.99756,-6.69095 z"
id="path1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czcc" />
<path
style="display:inline;fill:#000000"
d="m 392.64431,804.79039 c -8.52094,-5.90399 -8.49394,-11.01546 0.22879,-43.30647 1.03999,-3.85 2.46829,-9.67602 3.17399,-12.9467 0.99731,-4.62219 2.39455,-7.29497 6.27321,-12 2.74456,-3.32932 5.25157,-6.2783 5.57113,-6.5533 40.78433,-60.97488 80.48307,-125.1652 118.27253,-184 9.86283,-15.675 26.59424,-42.225 37.18089,-59 10.58666,-16.775 34.01422,-53.9 52.06125,-82.5 18.04703,-28.6 35.04505,-55.31677 37.77338,-59.37059 l 4.9606,-7.3706 4.1828,0.57332 c 4.16371,0.5707 4.19706,0.54958 7.30887,-4.62941 3.75631,-6.2516 8.82067,-11.57582 12.2516,-12.88026 5.99391,-2.27888 14.03303,2.9506 14.03303,9.12854 0,3.90203 -2.51704,10.62127 -6.02878,16.09385 -1.63417,2.54664 -2.97122,4.85949 -2.97122,5.13969 0,0.28019 0.9,1.54715 2,2.81546 2.28453,2.63408 2.47267,4.21918 0.86833,7.31574 -1.28218,2.47476 -26.61383,45.18798 -55.85724,94.18426 -10.83283,18.15 -25.72943,43.1137 -33.10357,55.47489 -7.37413,12.3612 -13.69273,23.17153 -14.04131,24.02297 -0.34859,0.85144 -7.50972,12.78774 -15.91363,26.52511 -15.54138,25.40455 -32.24417,52.9052 -70.74345,116.47703 -40.26028,66.47968 -43.66308,72.46026 -49.21634,86.5 -1.74036,4.4 -3.92035,8.675 -4.8444,9.5 -0.92405,0.825 -4.36246,3.75 -7.6409,6.5 -3.27845,2.75 -9.57132,8.3067 -13.98415,12.34823 -10.62726,9.73304 -16.99729,13.87361 -22.52334,14.64034 -3.99187,0.55386 -5.03885,0.251 -9.27207,-2.6821 z"
id="path2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ssssccssscsssssssssssssssssss" />
<path
style="fill:url(#linearGradient3);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 450.89044,688.88586 c 8.71518,5.62513 45.74035,-59.18436 43.57923,-75.43494 l -7.07107,-6.56599 c -29.93081,25.86352 -47.78438,74.72281 -47.78438,74.72281 z"
id="path3"
inkscape:connector-curvature="0"
sodipodi:nodetypes="scccs" />
</g>
<g
transform="matrix(-0.21797128,-0.07136846,0.05329769,-0.25512499,403.9107,823.07273)"
id="g3663-9-8">
<path
d="m 388.57143,893.79076 -57.14285,-130 c 0,0 -30.0247,-58.84827 4.28571,-70.00001 27.07438,-8.79984 37.32196,9.59496 40,14.64286 27.54455,51.91936 84.64285,173.21429 84.64285,173.21429 h -0.71428 z"
id="path2820-6-7"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
d="m 360.32021,827.78041 c -15.74169,-35.7991 -29.44655,-66.92657 -30.45523,-69.17214 -7.08929,-15.78239 -10.8761,-32.88254 -9.6176,-43.43026 1.39575,-11.69796 7.19746,-18.50389 18.22574,-21.38044 5.18218,-1.35169 8.54724,-1.76827 12.41155,-1.53649 4.43642,0.26609 6.95929,0.93715 11.03011,2.93391 3.93491,1.9301 8.0085,5.56248 10.68932,9.53159 3.68818,5.46055 26.56068,50.9623 49.57778,98.62829 16.60192,34.38082 37.06388,77.41994 36.89013,77.59369 -0.13286,0.13286 -69.01932,11.92114 -69.66286,11.92114 -0.27909,0 -12.00972,-26.24842 -29.08894,-65.08929 z"
id="path2824-1-6"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffccaa;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.002;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate"
inkscape:connector-curvature="0" />
<path
d="m 334.75785,756.75053 c -7.08929,-15.78239 -10.28437,-26.89033 -9.02587,-37.43805 1.39575,-11.69796 5.8085,-16.73613 16.83678,-19.61268 12.44766,-3.59459 20.03902,-1.91353 27.39013,8.75815 11.42622,25.66382 13.40166,29.05484 15.06365,35.48866 -0.13286,0.13286 -42.89663,15.49027 -44.57776,16.18518 -1.72922,0.71479 -4.94789,-2.09377 -5.68693,-3.38126 z"
id="path2824-7-1-7"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.92;fill:#ffe6d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.2;marker:none;enable-background:accumulate"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="104.05109mm"
height="64.88131mm"
viewBox="0 0 368.68495 229.89441"
id="svg4321"
version="1.1"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
sodipodi:docname="tablet-eraser-invert.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs4323">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4294"
id="linearGradient4300"
x1="465.81339"
y1="666.13727"
x2="454.82117"
y2="658.65521"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4294">
<stop
style="stop-color:#1a1a1a;stop-opacity:1;"
offset="0"
id="stop4296" />
<stop
style="stop-color:#808080;stop-opacity:1"
offset="1"
id="stop4298" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4294"
id="linearGradient5721"
gradientUnits="userSpaceOnUse"
x1="465.81339"
y1="666.13727"
x2="454.82117"
y2="658.65521" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="330.71429"
inkscape:cy="144.28571"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="3072"
inkscape:window-height="1659"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata4326">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-67.741956,-463.35919)">
<g
transform="matrix(0.35596319,-0.1450925,0.14027908,0.34415419,-98.897559,452.82709)"
id="g4304"
style="display:inline">
<path
style="display:inline;fill:#cccccc;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 387.83544,799.76093 c -1.1128,3.61694 -3.2211,13.05163 -1.08543,14.07769 2.13567,1.02606 7.81039,-3.72162 10.99756,-6.69095 z"
id="path4286"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czcc" />
<path
style="display:inline;fill:#000000"
d="m 392.64431,804.79039 c -8.52094,-5.90399 -8.49394,-11.01546 0.22879,-43.30647 1.03999,-3.85 2.46829,-9.67602 3.17399,-12.9467 0.99731,-4.62219 2.39455,-7.29497 6.27321,-12 2.74456,-3.32932 5.25157,-6.2783 5.57113,-6.5533 40.78433,-60.97488 80.48307,-125.1652 118.27253,-184 9.86283,-15.675 26.59424,-42.225 37.18089,-59 10.58666,-16.775 34.01422,-53.9 52.06125,-82.5 18.04703,-28.6 35.04505,-55.31677 37.77338,-59.37059 l 4.9606,-7.3706 4.1828,0.57332 c 4.16371,0.5707 4.19706,0.54958 7.30887,-4.62941 3.75631,-6.2516 8.82067,-11.57582 12.2516,-12.88026 5.99391,-2.27888 14.03303,2.9506 14.03303,9.12854 0,3.90203 -2.51704,10.62127 -6.02878,16.09385 -1.63417,2.54664 -2.97122,4.85949 -2.97122,5.13969 0,0.28019 0.9,1.54715 2,2.81546 2.28453,2.63408 2.47267,4.21918 0.86833,7.31574 -1.28218,2.47476 -26.61383,45.18798 -55.85724,94.18426 -10.83283,18.15 -25.72943,43.1137 -33.10357,55.47489 -7.37413,12.3612 -13.69273,23.17153 -14.04131,24.02297 -0.34859,0.85144 -7.50972,12.78774 -15.91363,26.52511 -15.54138,25.40455 -32.24417,52.9052 -70.74345,116.47703 -40.26028,66.47968 -43.66308,72.46026 -49.21634,86.5 -1.74036,4.4 -3.92035,8.675 -4.8444,9.5 -0.92405,0.825 -4.36246,3.75 -7.6409,6.5 -3.27845,2.75 -9.57132,8.3067 -13.98415,12.34823 -10.62726,9.73304 -16.99729,13.87361 -22.52334,14.64034 -3.99187,0.55386 -5.03885,0.251 -9.27207,-2.6821 z"
id="path4283"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ssssccssscsssssssssssssssssss" />
<path
style="fill:url(#linearGradient4300);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 450.89044,688.88586 c 8.71518,5.62513 45.74035,-59.18436 43.57923,-75.43494 l -7.07107,-6.56599 c -29.93081,25.86352 -47.78438,74.72281 -47.78438,74.72281 z"
id="path4292"
inkscape:connector-curvature="0"
sodipodi:nodetypes="scccs" />
</g>
<rect
transform="scale(1,-1)"
y="-693.18524"
x="67.81031"
height="16.036251"
width="168.54825"
id="rect4136"
style="fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.136709;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:0.546834, 0.136709;stroke-dashoffset:0;stroke-opacity:1" />
<g
transform="matrix(-0.36104723,0.13193379,-0.12755691,-0.34906957,644.73068,698.04111)"
id="g5701"
style="display:inline">
<path
style="display:inline;fill:#cccccc;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 387.83544,799.76093 c -1.1128,3.61694 -3.2211,13.05163 -1.08543,14.07769 2.13567,1.02606 7.81039,-3.72162 10.99756,-6.69095 z"
id="path5703"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czcc" />
<path
style="display:inline;fill:#000000"
d="m 392.64431,804.79039 c -8.52094,-5.90399 -8.49394,-11.01546 0.22879,-43.30647 1.03999,-3.85 2.46829,-9.67602 3.17399,-12.9467 0.99731,-4.62219 2.39455,-7.29497 6.27321,-12 2.74456,-3.32932 5.25157,-6.2783 5.57113,-6.5533 40.78433,-60.97488 80.48307,-125.1652 118.27253,-184 9.86283,-15.675 26.59424,-42.225 37.18089,-59 10.58666,-16.775 34.01422,-53.9 52.06125,-82.5 18.04703,-28.6 35.04505,-55.31677 37.77338,-59.37059 l 4.9606,-7.3706 4.1828,0.57332 c 4.16371,0.5707 4.19706,0.54958 7.30887,-4.62941 3.75631,-6.2516 8.82067,-11.57582 12.2516,-12.88026 5.99391,-2.27888 14.03303,2.9506 14.03303,9.12854 0,3.90203 -2.51704,10.62127 -6.02878,16.09385 -1.63417,2.54664 -2.97122,4.85949 -2.97122,5.13969 0,0.28019 0.9,1.54715 2,2.81546 2.28453,2.63408 2.47267,4.21918 0.86833,7.31574 -1.28218,2.47476 -26.61383,45.18798 -55.85724,94.18426 -10.83283,18.15 -25.72943,43.1137 -33.10357,55.47489 -7.37413,12.3612 -13.69273,23.17153 -14.04131,24.02297 -0.34859,0.85144 -7.50972,12.78774 -15.91363,26.52511 -15.54138,25.40455 -32.24417,52.9052 -70.74345,116.47703 -40.26028,66.47968 -43.66308,72.46026 -49.21634,86.5 -1.74036,4.4 -3.92035,8.675 -4.8444,9.5 -0.92405,0.825 -4.36246,3.75 -7.6409,6.5 -3.27845,2.75 -9.57132,8.3067 -13.98415,12.34823 -10.62726,9.73304 -16.99729,13.87361 -22.52334,14.64034 -3.99187,0.55386 -5.03885,0.251 -9.27207,-2.6821 z"
id="path5705"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ssssccssscsssssssssssssssssss" />
<path
style="fill:url(#linearGradient5721);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 450.89044,688.88586 c 8.71518,5.62513 45.74035,-59.18436 43.57923,-75.43494 l -7.07107,-6.56599 c -29.93081,25.86352 -47.78438,74.72281 -47.78438,74.72281 z"
id="path5707"
inkscape:connector-curvature="0"
sodipodi:nodetypes="scccs" />
</g>
<rect
transform="scale(1,-1)"
y="-693.18524"
x="267.8103"
height="16.036251"
width="168.54825"
id="rect5709"
style="opacity:1;fill:#4d4d4d;fill-opacity:1;stroke:#4d4d4d;stroke-width:0.136709;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:0.546834, 0.136709;stroke-dashoffset:0;stroke-opacity:1" />
<text
id="text5713"
y="559.10828"
x="296.20877"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="559.10828"
x="296.20877"
id="tspan5715"
sodipodi:role="line"
style="font-size:15px;line-height:1.25;font-family:sans-serif">Eraser</tspan></text>
<text
id="text1"
y="559.10828"
x="109.0436"
style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="559.10828"
x="109.0436"
id="tspan1"
sodipodi:role="line"
style="font-size:15px;line-height:1.25;font-family:sans-serif">Pen</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -4,9 +4,9 @@
Switches
==============================================================================
libinput supports the lid and tablet-mode switches. Unlike button events
that come in press and release pairs, switches are usually toggled once and
left at the setting for an extended period of time.
libinput supports the lid, tablet-mode, and keypad slide switches. Unlike
button events that come in press and release pairs, switches are usually
toggled once and left at the setting for an extended period of time.
Only some switches are handled by libinput, see **libinput_switch** for a
list of supported switches. Switch events are exposed to the caller, but
@ -28,15 +28,17 @@ The evdev event code ``EV_SW`` ``SW_LID`` is provided as
the device is disabled while the lid is logically closed. This is to avoid
ghost touches that can be caused by interference with touchpads and the
closed lid. The touchpad is automatically re-enabled whenever the lid is
openend.
opened.
This handling of lid switches is transparent to the user, no notifications
are sent and the device appears as enabled at all times.
On some devices, the device's lid state does not always reflect the physical
state and the lid state may report as closed even when the lid is physicall
open. libinput employs some heuristics to detect user input (specificially
typing) to re-enable the touchpad on those devices.
state and the lid state may report as closed even when the lid is physically
open. libinput employs some heuristics to detect user input (specifically
typing) to re-enable the touchpad on those devices. Where input is detected,
libinput updates the lid status of the kernel device so other consumers of
the kernel events also get the accurate state.
.. _switches_tablet_mode:
@ -57,3 +59,20 @@ tablet mode is disengaged.
This handling of tablet mode switches is transparent to the user, no
notifications are sent and the device appears as enabled at all times.
.. _switches_keypad_slide:
------------------------------------------------------------------------------
Keypad slide switch handling
------------------------------------------------------------------------------
Where available, libinput listens to devices providing a keypad slide switch.
This is usually available on devices that have an always-attached physical
keyboard which can slide under the screen. An example of such a device is the
Nokia N900.
The event sent by the kernel is ``EV_SW`` ``SW_KEYPAD_SLIDE`` and is provided
as **LIBINPUT_SWITCH_KEYPAD_SLIDE**. The keypad slide switch does not cause any
other input devices to be enabled nor disabled in response, since on some
devices the kernel event is sent while the keyboard is partially visible and
thus usable.

View file

@ -39,6 +39,6 @@ the ``libinput record`` tool.
- **resolution** indicates that the device does not have a resolution set
for the x and y axes. This can be fixed with a hwdb entry, locate and read
the `60-evdev.hwdb
<https://github.com/systemd/systemd/tree/master/hwdb/60-evdev.hwdb>`__ file
<https://github.com/systemd/systemd/blob/main/hwdb.d/60-evdev.hwdb>`__ file
on your machine and file a pull request with the fixes against
`systemd <https://github.com/systemd/systemd/>`__.

View file

@ -180,8 +180,8 @@ specifically:
capable of detection distances,
- pressure offset is only detected if the distance between the tool and the
tablet is high enough,
- pressure offset is only used if it is 20% or less of the pressure range
available to the tool. A pressure offset higher than 20% indicates either
- pressure offset is only used if it is 50% or less of the pressure range
available to the tool. A pressure offset higher than 50% indicates either
a misdetection or a tool that should be replaced, and
- if a pressure value less than the current pressure offset is seen, the
offset resets to that value.
@ -189,6 +189,52 @@ specifically:
Pressure offsets are not detected on **LIBINPUT_TABLET_TOOL_TYPE_MOUSE**
and **LIBINPUT_TABLET_TOOL_TYPE_LENS** tools.
.. _tablet-pressure-range:
------------------------------------------------------------------------------
Custom tablet tool pressure ranges
------------------------------------------------------------------------------
On tablets supporting pressure, libinput provides that hardware pressure as
a logical range of ``0.0`` up to ``1.0`` for the maximum supported pressure.
By default, the hardware range thus maps into the following logical range::
hw minimum hw maximum
hw range: |------|-----------------------------------|
logical range: |----|-----------------------------------|
0.0 | 1.0
Tip
Note that libinput always has some built-in thresholds to filter out erroneous
touches with near-zero pressure but otherwise the hardware range maps as-is
into the logical range. The :ref:`tip event <tablet-tip>` threshold is defined
within this range.
For some use-cases the full hardware range is not suitable, it may require either
too light a pressure for the user to interact or it may require too hard a
pressure before the logical maximum is reached. libinput provides
the **libinput_tablet_tool_config_pressure_range_set()** function that allows
reducing the usable range of the tablet::
hw minimum hw maximum
hw range: |----------|-------------------------------|
adjusted range: |------|---------------------|
logical range: |----|---------------------|
0.0 | 1.0
Tip
A reduced range as shown above will result in
- all hw pressure below the new minimum to register as logical pressure ``0.0``
- all hw pressure above the new maximum to register as logical pressure ``1.0``
- the tip event threshold to be relative to the new minimum
In other words, adjusting the pressure range of a tablet tool is equivalent to
reducing the hardware range of said tool. Note that where a custom pressure
range is set, detection of :ref:`tablet-pressure-offset` is disabled.
.. _tablet-serial-numbers:
------------------------------------------------------------------------------
@ -422,3 +468,77 @@ libinput uses the **libinput_device_group** to decide on touch arbitration
and automatically discards touch events whenever a tool is in proximity.
The exact behavior is device-dependent.
.. _tablet-area:
------------------------------------------------------------------------------
Tablet area
------------------------------------------------------------------------------
External tablet devices such as e.g. the Wacom Intuos series can be configured
to reduce the available logical input area. Typically the logical input area
is equivalent to the physical input area but it can be reduced with the
**libinput_device_config_area_set_rectangle()** call. Once reduced, input
events outside the logical input area are ignored and the logical input area
acts as if it represented the extents of the physical tablet.
.. figure:: tablet-area.svg
:align: center
Tablet area configuration example
In the image above, the area is set to the rectangle 0.25/0.25 to 0.5/0.75.
Even though the tool is roughly at the physical position ``0.5 * width`` and
``0.75 * height``, the return values of
**libinput_event_tablet_tool_get_x_transformed()** and
**libinput_event_tablet_tool_get_y_transformed()** would be close to the
maximum provided in this call.
The size of the tablet reported by **libinput_device_get_size()** always reflects
the physical area, not the logical area.
.. _tablet-eraser-button:
------------------------------------------------------------------------------
Tablet eraser buttons
------------------------------------------------------------------------------
Tablet tools come in a variety of forms but the most common one is a
pen-like tool. Some of these pen-like tools have a virtual eraser at the
tip of the tool - inverting the tool brings the eraser into proximity.
.. figure:: tablet-eraser-invert.svg
:align: center
An pen-like tool used as pen and as eraser by inverting it
Having an eraser as a separate tool is beneficial in many applications as the
eraser tool can be assigned different functionality (colors, paint tools, etc.)
that is easily available.
However, a large proportion of tablet pens have an "eraser button". By
pressing the button the pen switches to be an eraser tool.
On the data level this is not done via a button event, instead the firmware
will pretend the pen tool going out of proximity and the eraser coming
into proximity immediately after - as if the tool was physically inverted.
.. figure:: tablet-eraser-button.svg
:align: center
An pen-like tool used as pen and as eraser by pressing the eraser button
Microsoft mandates this behavior (see
`Windows Pen States <https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-pen-states>`_
for details) and thus the overwhelming majority of devices will have
an eraser button that virtually inverts the pen.
Enforcing an eraser button means that users have one button less on the
stylus that they would have otherwise. For some users the eraser button
is in an inconvenient location, others don't want an eraser button at all.
libinput provides an eraser button configuration that allows disabling the
eraser button and turning it into a normal button event. If the eraser button
is disabled, pressing that button will generate a normal tablet tool button
event.
This configuration is only available on pens with an eraser button, not on
with an invert-type eraser.

View file

@ -8,12 +8,13 @@ Tap-to-click behaviour
finger touch down/up sequence maps into a button click. This is most
commonly used on touchpads, but may be available on other devices.
libinput implements tapping for one, two, and three fingers, where supported
by the hardware, and maps those taps into a left, right, and middle button
click, respectively. Not all devices support three fingers, libinput will
support tapping up to whatever is supported by the hardware. libinput does
not support four-finger taps or any tapping with more than four fingers,
even though some hardware can distinguish between that many fingers.
libinput implements tapping for one, two, and three fingers, where supported by
the hardware, and maps those taps into a left, right, and middle button click,
respectively. This mapping can be switched to left, middle and right through
configuration. Not all devices support three fingers, libinput will support
tapping up to whatever is supported by the hardware. libinput does not support
four-finger taps or any tapping with more than four fingers, even though some
hardware can distinguish between that many fingers.
.. _tapping_default:
@ -33,6 +34,10 @@ Tapping is **enabled** by default on devices where tapping is the only
method to trigger button clicks. This includes devices without physical
buttons such as touch-capable graphics tablets.
.. note:: Unfortunately due to the current API design, devices that require
tapping effectively prevent us from changing this default. For details see
`this comment <https://gitlab.freedesktop.org/libinput/libinput/-/issues/926#note_2056476>`_.
Tapping can be enabled/disabled on a per-device basis. See
**libinput_device_config_tap_set_enabled()** for details.
@ -49,12 +54,19 @@ Tap-and-drag is optional and can be enabled or disabled with
**libinput_device_config_tap_set_drag_enabled()**. Most devices have
tap-and-drag enabled by default.
.. note:: Dragging is always done with one finger. The number of fingers on
the initial tap decide the type of button click. For example, to
middle-click drag, tap with three fingers followed by a
single-finger drag.
Also optional is a feature called "drag lock". With drag lock disabled, lifting
the finger will stop any drag process. When enabled, libinput will ignore a
finger up event during a drag process, provided the finger is set down again
within a implementation-specific timeout. Drag lock can be enabled and
disabled with **libinput_device_config_tap_set_drag_lock_enabled()**.
Note that drag lock only applies if tap-and-drag is be enabled.
the finger will stop any drag process. When enabled, the drag
process continues even after lifting a finger but can be ended
with an additional tap. If timeout-based drag-locks are enabled
the drag process will also automatically end once the finger has
been lifted for an implementation-specific timeout. Drag lock can be
enabled and disabled with **libinput_device_config_tap_set_drag_lock_enabled()**.
Note that drag lock only applies if tap-and-drag is enabled.
.. figure:: tap-n-drag.svg
:align: center
@ -72,6 +84,9 @@ If drag lock is enabled, the release of the mouse buttons after the finger
release (e) is triggered by a timeout. To release the button immediately,
simply tap again (f).
If drag lock is enabled in sticky mode there is no timeout after
releasing a finger and an extra tap is required to release the button.
If two fingers are supported by the hardware, a second finger can be used to
drag while the first is held in-place.

View file

@ -27,8 +27,7 @@ must pass for any merge request. These tests are invoked by calling
``meson test -C builddir`` (or ``ninja test``). The ``libinput-test-suite`` is
part of that test set by default.
The upstream CI runs all these tests but not the ``libinput-test-suite``.
This CI is run for every merge request.
The upstream CI runs all these tests and is run for every merge request.
.. _test-job-control:
@ -208,7 +207,7 @@ verification of distribution composes.
To configure libinput to install the tests, use the ``-Dinstall-tests=true``
meson option::
$ meson builddir -Dtests=true -Dinstall-tests=true <other options>
$ meson setup builddir -Dtests=true -Dinstall-tests=true <other options>
.. _test-meson-suites:

View file

@ -42,3 +42,5 @@ Once the timeout expires at t4, libinput generates an event of
Thus, the caller gets events with timestamps in the order t3, t1, t2,
despite t3 > t2 > t1.
libinput timestamps use **CLOCK_MONOTONIC**.

View file

@ -11,8 +11,10 @@ available in the **libinput(1)** man page.
The most common tools used are:
- ``libinput list-devices``: to list locally available devices,
- ``libinput list-devices``: to list locally available devices as seen by libinput,
see :ref:`here <libinput-list-devices>`
- ``libinput list-kernel-devices``: to list locally available devices as seen by the kernel,
see :ref:`here <libinput-list-kernel-devices>`
- ``libinput debug-events``: to monitor and debug events,
see :ref:`here <libinput-debug-events>`
- ``libinput debug-gui``: to visualize events,
@ -21,6 +23,8 @@ The most common tools used are:
see :ref:`here <libinput-record>`
- ``libinput measure``: measure properties on a kernel device,
see :ref:`here <libinput-measure>`
- ``libinput analyze``: analyse event recordings from a kernel device,
see :ref:`here <libinput-analyze>`
- ``libinput quirks``: show quirks assigned to a device, see
:ref:`here <libinput-quirks>`
@ -71,6 +75,55 @@ binary state all available options are listed, with the default one prefixed
with an asterisk (``*``). In the example above, the default click method is
button-areas but clickfinger is available.
.. note:: This tool is intended for human-consumption and may change its output
at any time.
.. _libinput-list-kernel-devices:
------------------------------------------------------------------------------
libinput list-kernel-devices
------------------------------------------------------------------------------
The ``libinput list-kernel-devices`` command shows the devices known by **the
kernel**. This command can help identify issues when a device is not handled by
libinput.
::
$ libinput list-kernel-devices
/dev/input/event0: Sleep Button
/dev/input/event1: Power Button
/dev/input/event2: Power Button
/dev/input/event3: Microsoft Microsoft® 2.4GHz Transceiver v9.0
/dev/input/event4: Microsoft Microsoft® 2.4GHz Transceiver v9.0 Mouse
[...]
In some cases, knowing about the HID devices behind the kernel's event nodes
can be useful. To list HID devices, supply the ``--hid`` commandline flag:
::
$ libinput list-kernel-devices --hid
hid:
- name: 'Logitech Gaming Mouse G303'
id: '046d:c080'
driver: 'hid-generic'
hidraw: ['/dev/hidraw6']
evdev: ['/dev/input/event13']
- name: 'Logitech Gaming Mouse G303'
id: '046d:c080'
driver: 'hid-generic'
hidraw: ['/dev/hidraw7']
evdev: ['/dev/input/event14']
- name: 'Microsoft Microsoft® 2.4GHz Transceiver v9.0'
id: '045e:07a5'
driver: 'hid-generic'
hidraw: ['/dev/hidraw0']
evdev: ['/dev/input/event3']
.. note:: This tool is intended for human-consumption and may change its output
at any time.
@ -302,6 +355,19 @@ thing and one thing only and their usage is highly specific to the tool.
Please see the **libinput-measure(1)** man page for information about what
tools are available and the man page for each respective tool.
.. _libinput-analyze:
------------------------------------------------------------------------------
Analyzing device events with libinput analyze
------------------------------------------------------------------------------
The ``libinput analyze`` tool is a multiplexer for various sub-tools that
can analyze input events previously recorded from a device.
Please see the **libinput-analyze(1)** man page for information about what
tools are available and the man page for each respective too.
.. _libinput-quirks:
------------------------------------------------------------------------------
@ -311,7 +377,7 @@ Listing quirks assigned to a device
The ``libinput quirks`` tool can show quirks applied for any given device. ::
$ libinput quirks list /dev/input/event0
AttrLidSwitchReliability=reliable
AttrLidSwitchReliability=unreliable
If the tool's output is empty, no quirk is applied. See :ref:`device-quirks`
for more information.

View file

@ -14,10 +14,13 @@ position.
When libinput detects a cursor jump it prints a bug warning to the log with
the text **"Touch jump detected and discarded."** and a link to this page.
In most cases, this is a bug in the kernel driver and to libinput it appears
that the touch point moves from its previous position. The pointer jump can
usually be seen in the :ref:`libinput record <libinput-record>` output for the device:
.. note:: This warning is ratelimited and will stop appearing after a few
times, even if the touchpad jumps continue.
In most cases, this is a bug in the firmware (or kernel driver) and to
libinput it appears that the touch point moves from its previous position.
The pointer jump can usually be seen in the :ref:`libinput record
<libinput-record>` output for the device:
::
@ -50,9 +53,28 @@ usually be seen in the :ref:`libinput record <libinput-record>` output for the d
In this recording, the pointer jumps from its position 3752/2216 to
1640/4681 within a single frame. On this particular touchpad, this would
represent a physical move of almost 50mm. libinput detects some of these
jumps and discards the movement but otherwise continues as usual. However,
the bug should be fixed at the kernel level.
jumps and discards the movement but otherwise continues as usual.
If your only encounter with these jumps is the warning printed to the log,
libinput functions as intended.
When you encounter the warning in the log, please generate a recording of
your touchpad with :ref:`libinput record <libinput-record>` and file a bug.
See :ref:`reporting_bugs` for more details.
Note that it most cases, libinput cannot actually fix the issue. Filing a
bug is useful to figure out if there are other factors at play or whether
there are heuristics we can employ to reduce the impact.
------------------------------------------------------------------------------
AlpsPS/2 ALPS DualPoint TouchPad jumping to 4095/0
------------------------------------------------------------------------------
A special case of pointer jumps happens on ``AlpsPS/2 ALPS DualPoint TouchPad``
devices found in the Lenovo ThinkPad E465 and E550 and likely others with
the same touchpad hardware. On those devices, the touchpad occasionally
sends an event for the second finger to move to position 4095/0 before
moving back to the original position. libinput detects this movement and
removes it but depending on the interaction this may cause a smaller jump
later when the coordinates reset to the new position of the finger.
Some more information is available in `Gitlab Issue #492 <https://gitlab.freedesktop.org/libinput/libinput/-/issues/492>`__.

View file

@ -38,30 +38,53 @@ statistics, including whether a touch is/was considered logically down.
Example output of the tool is below: ::
$ sudo libinput measure touchpad-pressure
Ready for recording data.
Pressure range used: 8:10
Palm pressure range used: 65535
Place a single finger on the touchpad to measure pressure values.
Ctrl+C to exit
&nbsp;
Sequence 1190 pressure: min: 39 max: 48 avg: 43 median: 44 tags: down
Sequence 1191 pressure: min: 49 max: 65 avg: 62 median: 64 tags: down
Sequence 1192 pressure: min: 40 max: 78 avg: 64 median: 66 tags: down
Sequence 1193 pressure: min: 36 max: 83 avg: 70 median: 73 tags: down
Sequence 1194 pressure: min: 43 max: 76 avg: 72 median: 74 tags: down
Touchpad pressure: 47 min: 47 max: 86 tags: down
$ sudo libinput measure touchpad-pressure
Using Synaptics TM2668-002: /dev/input/event21
This is an interactive tool
Place a single finger on the touchpad to measure pressure values.
Check that:
- touches subjectively perceived as down are tagged as down
- touches with a thumb are tagged as thumb
- touches with a palm are tagged as palm
If the touch states do not match the interaction, re-run
with --touch-thresholds=down:up using observed pressure values.
See --help for more options.
Interactive keys:
q/a - decrease/increase down threshold
w/s - decrease/increase up threshold
e/d - decrease/increase palm threshold
r/f - decrease/increase thumb threshold
Press Ctrl+C to exit
┌───────────────────────────────────────────────────────────────────────────────┐
│ Touch │ down │ up │ palm │ thumb │ min │ max │ p │ avg │ median │
├───────────────────────────────────────────────────────────────────────────────┤
│ 178 │ x │ x │ │ │ 75 │ 75 │ 0 │ 75 │ 75 │
│ 179 │ x │ x │ │ │ 35 │ 88 │ 0 │ 77 │ 81 │
│ 180 │ x │ x │ │ x │ 65 │ 113 │ 0 │ 98 │ 98 │
│ 181 │ x │ x │ │ x │ 50 │ 101 │ 0 │ 86 │ 90 │
│ 182 │ x │ x │ │ │ 40 │ 80 │ 0 │ 66 │ 70 │
│ 183 │ x │ │ │ │ 43 │ 78 │ 78 │ │
│ Thresh │ 70 │ 60 │ 130 │ 100 │
...
The example output shows five completed touch sequences and one ongoing one.
For each, the respective minimum and maximum pressure values are printed as
well as some statistics. The ``tags`` show that sequence was considered
logically down at some point. This is an interactive tool and its output may
change frequently. Refer to the <i>libinput-measure-touchpad-pressure(1)</i> man
page for more details.
well as some statistics. The ``down`` column show that each sequence was
considered logically down at some point (see the threholds in the last line),
two of the sequences were considered thumbs. This is an interactive tool and
its output may change frequently. Refer to the
**libinput-measure-touchpad-pressure(1)** man page for more details.
By default, this tool uses the :ref:`device-quirks` for the pressure range. To
narrow down on the best values for your device, specify the 'logically down'
narrow down on the best values for your device, adjust the thresholds using
the keys q/a, w/s, e/d and r/f or specify the 'logically down'
and 'logically up' pressure thresholds with the ``--touch-thresholds``
argument: ::
@ -84,8 +107,10 @@ Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with
[Touchpad pressure override]
MatchUdevType=touchpad
MatchName=*SynPS/2 Synaptics TouchPad
MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPadX230*
MatchDMIModalias=dmi:*:svnLENOVO:*:pvrThinkPadX230:*
AttrPressureRange=10:8
AttrPalmPressureThreshold=150
AttrThumbPressureThreshold=100
The file name **must** be ``/etc/libinput/local-overrides.quirks``. The
The first line is the section name and can be free-form. The ``Match``
@ -99,7 +124,7 @@ and product name (pn).
Once in place, run the following command to verify the quirk is valid and
works for your device: ::
$ sudo libinput list-quirks /dev/input/event10
$ sudo libinput quirks list /dev/input/event10
AttrPressureRange=10:8
Replace the event node with the one from your device. If the
@ -157,7 +182,7 @@ The example output shows five completed touch sequences. For each, the
respective minimum and maximum pressure values are printed as well as some
statistics. The ``down`` and ``palm`` tags show that sequence was considered
logically down or a palm at some point. This is an interactive tool and its
output may change frequently. Refer to the <i>libinput-measure-touch-size(1)</i> man
output may change frequently. Refer to the **libinput-measure-touch-size(1)** man
page for more details.
By default, this tool uses the :ref:`device-quirks` for the touch size range. To
@ -181,7 +206,7 @@ Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with
[Touchpad touch size override]
MatchUdevType=touchpad
MatchName=*SynPS/2 Synaptics TouchPad
MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPadX230*
MatchDMIModalias=dmi:*:svnLENOVO:*:pvrThinkPadX230:*
AttrTouchSizeRange=10:8
The first line is the match line and should be adjusted for the device name
@ -193,7 +218,7 @@ and product name (pn).
Once in place, run the following command to verify the quirk is valid and
works for your device: ::
$ sudo libinput list-quirks /dev/input/event10
$ sudo libinput quirks list /dev/input/event10
AttrTouchSizeRange=10:8
Replace the event node with the one from your device. If the
@ -207,4 +232,3 @@ the need for a restart.
Once the touch size ranges are deemed correct, :ref:`reporting_bugs` "report a
bug" to get the thresholds into the repository.

View file

@ -56,4 +56,3 @@ these axes are supposed to be mapped, few devices forward reliable
information. libinput uses these values together with a device-specific
:ref:`device-quirks` entry. In other words, touch size detection does not work
unless a device quirk is present for the device.

View file

@ -17,7 +17,7 @@ other properties.
Number of buttons
------------------------------------------------------------------------------
.. _touchapds_buttons_phys:
.. _touchpads_buttons_phys:
..............................................................................
Physically separate buttons
@ -57,7 +57,7 @@ property.
.. _touchpads_buttons_forcepads:
..............................................................................
Forcepads
Forcepads/Pressurepads
..............................................................................
Forcepads are Clickpads without a physical button underneath the hardware.
@ -65,6 +65,7 @@ They provide pressure and may have a vibration element that is
software-controlled. This element can simulate the feel of a physical
click or be co-opted for other tasks.
Forcepads are also called pressurepads or haptic touchpads.
.. _touchpads_touch:
@ -79,7 +80,7 @@ device can **track**, i.e. provide reliable positional information for.
In the kernel each finger is tracked in a so-called "slot", the number of
slots thus equals the number of simultaneous touches a device can track.
.. _touchapds_touch_st:
.. _touchpads_touch_st:
..............................................................................
Single-touch touchpads

View file

@ -20,7 +20,7 @@ User-specific preferences can be adjusted with the
The magic trackpoint multiplier
------------------------------------------------------------------------------
To accomodate for the wildly different input data on trackpoint, libinput
To accommodate for the wildly different input data on trackpoint, libinput
uses a multiplier that is applied to input deltas. Trackpoints that send
comparatively high deltas can be "slowed down", trackpoints that send low
deltas can be "sped up" to match the expected range. The actual acceleration
@ -78,7 +78,7 @@ installed.
$ cd path/to/libinput.git
# Use an approximate multiplier in the quirks file
$ cat > quirks/99-trackpont-override.quirks <<EOF
$ cat > quirks/99-trackpoint-override.quirks <<EOF
[Trackpoint Override]
MatchUdevType=pointingstick
AttrTrackpointMultiplier=1.0
@ -131,7 +131,7 @@ variation of the following is sufficient:
[Trackpoint Override]
MatchUdevType=pointingstick
MatchName=*TPPS/2 IBM TrackPoint*
MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPadT440p*
MatchDMIModalias=dmi:*:svnLENOVO:*:pvrThinkPadT440p:*
AttrTrackpointMultiplier=1.0
@ -152,4 +152,3 @@ has been removed. See :ref:`trackpoint_multiplier` for versions 1.12.x and later
If using libinput version 1.11.x or earlier, please see
`the 1.11.0 documentation <https://wayland.freedesktop.org/libinput/doc/1.11.0/trackpoints.html#trackpoint_range_measure>`_

View file

@ -5,7 +5,7 @@ Trackpoints and Pointing Sticks
==============================================================================
This page provides an overview of trackpoint handling in libinput, also
refered to as Pointing Stick or Trackstick. The device itself is usually a
referred to as Pointing Stick or Trackstick. The device itself is usually a
round plastic stick between the G, H and B keys with a set of buttons below
the space bar.
@ -50,7 +50,7 @@ decreases, the delta decrease first, then the reporting rate until the
trackpoint is in a neutral state and no events are reported. Trackpoint data
is hard to generalize, see
`Observations on trackpoint input data
<a href="https://who-t.blogspot.com/2018/06/observations-on-trackpoint-input-data.html">`_
<https://who-t.blogspot.com/2018/06/observations-on-trackpoint-input-data.html>`_
for more details.
.. figure:: trackpoint-delta-illustration.svg
@ -65,4 +65,3 @@ sufficient pressure to even get close to the maximum ranges.
libinput provides a :ref:`Magic Trackpoint Multiplier
<trackpoint_multiplier>` to normalize the trackpoint input data.

View file

@ -14,3 +14,6 @@ Troubleshooting
touchpad-pressure-debugging.rst
trackpoint-configuration.rst
tablet-debugging.rst
incorrectly-enabled-hires.rst
clickpad-with-right-button.rst
ignoring-devices.rst

View file

@ -131,7 +131,7 @@ Handled device types
- Mice
- Keyboards
- Virtual absolute pointing devices such as those used by QEMU or VirtualBox
- Switches (Lid Switch and Tablet Mode switch)
- Switches (Lid Switch, Tablet Mode switch, and Keypad Slide switch)
- Graphics tablets
- :ref:`Trackpoints`

183
doc/user/wheel-api.rst Normal file
View file

@ -0,0 +1,183 @@
.. _wheel_scrolling:
==============================================================================
Wheel scrolling
==============================================================================
libinput provides two events to handle wheel scrolling:
- ``LIBINPUT_EVENT_POINTER_AXIS`` events are sent for regular wheel clicks,
usually those representing one detent on the device. These wheel clicks
usually require a rotation of 15 or 20 degrees.
**This event is deprecated as of libinput 1.19.**
- ``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL`` events are sent for regular and/or
high resolution wheel movements. High-resolution events are often 4 or 8
times more frequent than wheel clicks and require the device to be switched
into high-resolution mode (Linux kernel 5.0 and later). Where
high-resolution wheels are not provided by the kernel, libinput emulates
these events for regular wheel clicks.
**This event is available since libinput 1.19.**
The events are separate for historical reasons. Both events are
generated for the same device but are independent event streams. Callers
must not assume any relation between the two, i.e. there is no guarantee
that an axis event is sent before or after any specific high-resolution
event and vice versa. Callers should not handle both events.
.. warning:: do not handle both ``LIBINPUT_EVENT_POINTER_AXIS`` and
``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL``. Always use the latter where
possible, otherwise only use the former.
Both events have their own set of APIs to access the data within:
- ``LIBINPUT_EVENT_POINTER_AXIS``: Deprecated as of libinput 1.19, where
possible it is recommended to handle **only**
``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL``.
* ``libinput_event_pointer_get_axis_value()`` returns the angle of movement
in degrees.
* ``libinput_event_pointer_get_axis_source()`` returns the source of the
event: wheel, finger or continuous.
* ``libinput_event_pointer_get_axis_value_discrete()`` returns the number of
logical wheel clicks.
- ``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL`` available since libinput 1.19.
* ``libinput_event_pointer_get_scroll_value_v120()`` returns a value
normalized into the 0..120 range, see below. Any multiple of 120 should
be treated as one full wheel click.
.. note:: Where possible, the ``libinput_event_pointer_get_axis_value()``,
``libinput_event_pointer_get_axis_source()`` and
``libinput_event_pointer_get_axis_value_discrete()`` API should be
avoided.
------------------------------------------------------------------------------
The v120 Wheel API
------------------------------------------------------------------------------
The ``v120`` value matches the Windows API for wheel scrolling. Wheel
movements are normalized into multiples (or fractions) of 120 with each
multiple of 120 representing one detent of movement. The ``v120`` API is the
recommended API for callers that do not care about the exact physical
motion and is the simplest API to handle high-resolution scrolling.
Most wheels provide 24 detents per 360 degree rotation (click angle of 15),
others provide 18 detents per 360 degree rotation (click angle 20). Mice
falling outside these two are rare but do exist. Below is a table showing
the various values for a single event, depending on the click angle of the
wheel:
+-------------+------------+---------------+------+
| Click angle | Axis value | Discrete value| v120 |
+=============+============+===============+======+
| 15 | 15 | 1 | 120 |
+-------------+------------+---------------+------+
| 20 | 20 | 1 | 120 |
+-------------+------------+---------------+------+
Fast scrolling may trigger cover than one detent per event and thus each
event may contain multiples of the value, discrete or v120 value:
+-------------+------------+---------------+------+
| Click angle | Axis value | Discrete value| v120 |
+=============+============+===============+======+
| 15 | 30 | 2 | 240 |
+-------------+------------+---------------+------+
| 20 | 60 | 3 | 360 |
+-------------+------------+---------------+------+
Scrolling on high-resolution wheels will produce fractions of 120, depending
on the resolution of the wheel. The example below shows a mouse with click
angle 15 and a resolution of 3 events per wheel click and a mouse with click
angle 20 and a resolution of 2 events per wheel click.
+-------------+------------+---------------+------+
| Click angle | Axis value | Discrete value| v120 |
+=============+============+===============+======+
| 15 | 5 | 0 | 40 |
+-------------+------------+---------------+------+
| 20 | 10 | 0 | 60 |
+-------------+------------+---------------+------+
------------------------------------------------------------------------------
Event sequences for high-resolution wheel mice
------------------------------------------------------------------------------
High-resolution scroll wheels provide multiple events for each detent is
hit. For those mice, an event sequence covering two detents may look like
this:
+--------------+---------+------------+---------------+------+
| Event number | Type | Axis value | Discrete value| v120 |
+==============+=========+============+===============+======+
| 1 | WHEEL | 5 | n/a | 40 |
+--------------+---------+------------+---------------+------+
| 2 | WHEEL | 5 | n/a | 40 |
+--------------+---------+------------+---------------+------+
| 3 | WHEEL | 5 | n/a | 40 |
+--------------+---------+------------+---------------+------+
| 4 | AXIS | 15 | 1 | 120 |
+--------------+---------+------------+---------------+------+
| 5 | WHEEL | 5 | n/a | 40 |
+--------------+---------+------------+---------------+------+
| 6 | WHEEL | 5 | n/a | 40 |
+--------------+---------+------------+---------------+------+
| 7 | AXIS | 15 | 1 | 120 |
+--------------+---------+------------+---------------+------+
The above assumes a click angle of 15 for the physical detents. Note how the
second set of high-resolution events do **not** add up to a multiple of
120 before the low-resolution event. A caller must not assume any relation
between ``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL`` and
``LIBINPUT_EVENT_POINTER_AXIS``.
Fast-scrolling on a high-resolution mouse may trigger multiple fractions per
hardware scanout cycle and result in an event sequence like this:
+---------------+---------+------------+---------------+------+
| Event number | Type | Axis value | Discrete value| v120 |
+===============+=========+============+===============+======+
| 1 | WHEEL | 5 | n/a | 40 |
+---------------+---------+------------+---------------+------+
| 2 | WHEEL | 10 | n/a | 80 |
+---------------+---------+------------+---------------+------+
| 3 | AXIS | 15 | 1 | 120 |
+---------------+---------+------------+---------------+------+
| 4 | WHEEL | 10 | n/a | 80 |
+---------------+---------+------------+---------------+------+
| 5 | WHEEL | 10 | n/a | 80 |
+---------------+---------+------------+---------------+------+
| 6 | AXIS | 15 | 1 | 120 |
+---------------+---------+------------+---------------+------+
| 7 | WHEEL | 5 | n/a | 40 |
+---------------+---------+------------+---------------+------+
Note how the first low-resolution event is sent at an accumulated 15
degrees, the second at an accumulated 20 degrees. The libinput API does not
specify the smallest fraction a wheel supports.
------------------------------------------------------------------------------
Event sequences for regular wheel mice
------------------------------------------------------------------------------
``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL`` for low-resolution mice are virtually
identical to ``LIBINPUT_EVENT_POINTER_AXIS`` events. Note that the discrete
value is always 0 for ``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL``.
+--------------+---------+------------+---------------+------+
| Event number | Type | Axis value | Discrete value| v120 |
+==============+=========+============+===============+======+
| 1 | AXIS | 15 | 1 | 120 |
+--------------+---------+------------+---------------+------+
| 2 | WHEEL | 15 | n/a | 120 |
+--------------+---------+------------+---------------+------+
| 3 | WHEEL | 15 | n/a | 120 |
+--------------+---------+------------+---------------+------+
| 4 | AXIS | 15 | 1 | 120 |
+--------------+---------+------------+---------------+------+
Note that the order of ``LIBINPUT_EVENT_POINTER_AXIS`` vs
``LIBINPUT_EVENT_POINTER_SCROLL_WHEEL`` events is not guaranteed, as shown in
the example above.

View file

@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Input event codes
*
@ -27,6 +27,7 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -278,7 +279,8 @@
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */
#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
#define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207
@ -439,10 +441,12 @@
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
#define KEY_ZOOM KEY_FULL_SCREEN
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
#define KEY_SCREEN KEY_ASPECT_RATIO
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
@ -513,6 +517,10 @@
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@ -540,6 +548,7 @@
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
#define KEY_FN_RIGHT_SHIFT 0x1e5
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
@ -593,8 +602,14 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@ -604,10 +619,30 @@
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -646,6 +681,110 @@
*/
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
/* Electronic privacy screen control */
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
/* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a
/* Move the focus to the next or previous user controllable element within a UI container */
#define KEY_NEXT_ELEMENT 0x27b
#define KEY_PREVIOUS_ELEMENT 0x27c
/* Toggle Autopilot engagement */
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
/* Shortcut Keys */
#define KEY_MARK_WAYPOINT 0x27e
#define KEY_SOS 0x27f
#define KEY_NAV_CHART 0x280
#define KEY_FISHING_CHART 0x281
#define KEY_SINGLE_RANGE_RADAR 0x282
#define KEY_DUAL_RANGE_RADAR 0x283
#define KEY_RADAR_OVERLAY 0x284
#define KEY_TRADITIONAL_SONAR 0x285
#define KEY_CLEARVU_SONAR 0x286
#define KEY_SIDEVU_SONAR 0x287
#define KEY_NAV_INFO 0x288
#define KEY_BRIGHTNESS_MENU 0x289
/*
* Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most
* keyboards with these macro-keys the key-sequence to inject, or action to
* take, is all handled by software on the host side. So from the kernel's
* point of view these are just normal keys.
*
* The KEY_MACRO# codes below are intended for such keys, which may be labeled
* e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys
* where the marking on the key does indicate a defined meaning / purpose.
*
* The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing
* KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO
* define MUST be added.
*/
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
#define KEY_MACRO4 0x293
#define KEY_MACRO5 0x294
#define KEY_MACRO6 0x295
#define KEY_MACRO7 0x296
#define KEY_MACRO8 0x297
#define KEY_MACRO9 0x298
#define KEY_MACRO10 0x299
#define KEY_MACRO11 0x29a
#define KEY_MACRO12 0x29b
#define KEY_MACRO13 0x29c
#define KEY_MACRO14 0x29d
#define KEY_MACRO15 0x29e
#define KEY_MACRO16 0x29f
#define KEY_MACRO17 0x2a0
#define KEY_MACRO18 0x2a1
#define KEY_MACRO19 0x2a2
#define KEY_MACRO20 0x2a3
#define KEY_MACRO21 0x2a4
#define KEY_MACRO22 0x2a5
#define KEY_MACRO23 0x2a6
#define KEY_MACRO24 0x2a7
#define KEY_MACRO25 0x2a8
#define KEY_MACRO26 0x2a9
#define KEY_MACRO27 0x2aa
#define KEY_MACRO28 0x2ab
#define KEY_MACRO29 0x2ac
#define KEY_MACRO30 0x2ad
/*
* Some keyboards with the macro-keys described above have some extra keys
* for controlling the host-side software responsible for the macro handling:
* -A macro recording start/stop key. Note that not all keyboards which emit
* KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if
* KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START
* should be interpreted as a recording start/stop toggle;
* -Keys for switching between different macro (pre)sets, either a key for
* cycling through the configured presets or keys to directly select a preset.
*/
#define KEY_MACRO_RECORD_START 0x2b0
#define KEY_MACRO_RECORD_STOP 0x2b1
#define KEY_MACRO_PRESET_CYCLE 0x2b2
#define KEY_MACRO_PRESET1 0x2b3
#define KEY_MACRO_PRESET2 0x2b4
#define KEY_MACRO_PRESET3 0x2b5
/*
* Some keyboards have a buildin LCD panel where the contents are controlled
* by the host. Often these have a number of keys directly below the LCD
* intended for controlling a menu shown on the LCD. These keys often don't
* have any labeling so we just name them KEY_KBD_LCD_MENU#
*/
#define KEY_KBD_LCD_MENU1 0x2b8
#define KEY_KBD_LCD_MENU2 0x2b9
#define KEY_KBD_LCD_MENU3 0x2ba
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
@ -751,6 +890,7 @@
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
#define ABS_MISC 0x28
@ -805,7 +945,9 @@
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MAX 0x0f
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_CNT (SW_MAX+1)
/*

View file

@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Input event codes
*
@ -27,6 +27,7 @@
#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */
#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */
#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */
#define INPUT_PROP_PRESSUREPAD 0x07 /* pressure triggers clicks */
#define INPUT_PROP_MAX 0x1f
#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
@ -278,7 +279,8 @@
#define KEY_PAUSECD 201
#define KEY_PROG3 202
#define KEY_PROG4 203
#define KEY_DASHBOARD 204 /* AL Dashboard */
#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
#define KEY_SUSPEND 205
#define KEY_CLOSE 206 /* AC Close */
#define KEY_PLAY 207
@ -439,10 +441,12 @@
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
#define KEY_ZOOM KEY_FULL_SCREEN
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
#define KEY_SCREEN KEY_ASPECT_RATIO
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
@ -513,6 +517,10 @@
#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
#define KEY_IMAGES 0x1ba /* AL Image Browser */
#define KEY_NOTIFICATION_CENTER 0x1bc /* Show/hide the notification center */
#define KEY_PICKUP_PHONE 0x1bd /* Answer incoming call */
#define KEY_HANGUP_PHONE 0x1be /* Decline incoming call */
#define KEY_LINK_PHONE 0x1bf /* AL Phone Syncing */
#define KEY_DEL_EOL 0x1c0
#define KEY_DEL_EOS 0x1c1
@ -540,6 +548,7 @@
#define KEY_FN_F 0x1e2
#define KEY_FN_S 0x1e3
#define KEY_FN_B 0x1e4
#define KEY_FN_RIGHT_SHIFT 0x1e5
#define KEY_BRL_DOT1 0x1f1
#define KEY_BRL_DOT2 0x1f2
@ -593,8 +602,14 @@
#define BTN_DPAD_LEFT 0x222
#define BTN_DPAD_RIGHT 0x223
#define BTN_GRIPL 0x224
#define BTN_GRIPR 0x225
#define BTN_GRIPL2 0x226
#define BTN_GRIPR2 0x227
#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
#define KEY_ROTATE_LOCK_TOGGLE 0x231 /* Display rotation lock */
#define KEY_REFRESH_RATE_TOGGLE 0x232 /* Display refresh rate toggle */
#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
@ -604,10 +619,30 @@
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */
#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */
#define KEY_ACCESSIBILITY 0x24e /* Toggles the system bound accessibility UI/command (HUTRR116) */
#define KEY_DO_NOT_DISTURB 0x24f /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
/*
* Keycodes for hotkeys toggling the electronic privacy screen found on some
* laptops on/off. Note when the embedded-controller turns on/off the eprivacy
* screen itself then the state should be reported through drm connecter props:
* https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
* Except when implementing the drm connecter properties API is not possible
* because e.g. the firmware does not allow querying the presence and/or status
* of the eprivacy screen at boot.
*/
#define KEY_EPRIVACY_SCREEN_ON 0x252
#define KEY_EPRIVACY_SCREEN_OFF 0x253
#define KEY_KBDINPUTASSIST_PREV 0x260
#define KEY_KBDINPUTASSIST_NEXT 0x261
#define KEY_KBDINPUTASSIST_PREVGROUP 0x262
@ -646,6 +681,110 @@
*/
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
/* Electronic privacy screen control */
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
/* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a
/* Move the focus to the next or previous user controllable element within a UI container */
#define KEY_NEXT_ELEMENT 0x27b
#define KEY_PREVIOUS_ELEMENT 0x27c
/* Toggle Autopilot engagement */
#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
/* Shortcut Keys */
#define KEY_MARK_WAYPOINT 0x27e
#define KEY_SOS 0x27f
#define KEY_NAV_CHART 0x280
#define KEY_FISHING_CHART 0x281
#define KEY_SINGLE_RANGE_RADAR 0x282
#define KEY_DUAL_RANGE_RADAR 0x283
#define KEY_RADAR_OVERLAY 0x284
#define KEY_TRADITIONAL_SONAR 0x285
#define KEY_CLEARVU_SONAR 0x286
#define KEY_SIDEVU_SONAR 0x287
#define KEY_NAV_INFO 0x288
#define KEY_BRIGHTNESS_MENU 0x289
/*
* Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most
* keyboards with these macro-keys the key-sequence to inject, or action to
* take, is all handled by software on the host side. So from the kernel's
* point of view these are just normal keys.
*
* The KEY_MACRO# codes below are intended for such keys, which may be labeled
* e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys
* where the marking on the key does indicate a defined meaning / purpose.
*
* The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing
* KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO
* define MUST be added.
*/
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
#define KEY_MACRO4 0x293
#define KEY_MACRO5 0x294
#define KEY_MACRO6 0x295
#define KEY_MACRO7 0x296
#define KEY_MACRO8 0x297
#define KEY_MACRO9 0x298
#define KEY_MACRO10 0x299
#define KEY_MACRO11 0x29a
#define KEY_MACRO12 0x29b
#define KEY_MACRO13 0x29c
#define KEY_MACRO14 0x29d
#define KEY_MACRO15 0x29e
#define KEY_MACRO16 0x29f
#define KEY_MACRO17 0x2a0
#define KEY_MACRO18 0x2a1
#define KEY_MACRO19 0x2a2
#define KEY_MACRO20 0x2a3
#define KEY_MACRO21 0x2a4
#define KEY_MACRO22 0x2a5
#define KEY_MACRO23 0x2a6
#define KEY_MACRO24 0x2a7
#define KEY_MACRO25 0x2a8
#define KEY_MACRO26 0x2a9
#define KEY_MACRO27 0x2aa
#define KEY_MACRO28 0x2ab
#define KEY_MACRO29 0x2ac
#define KEY_MACRO30 0x2ad
/*
* Some keyboards with the macro-keys described above have some extra keys
* for controlling the host-side software responsible for the macro handling:
* -A macro recording start/stop key. Note that not all keyboards which emit
* KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if
* KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START
* should be interpreted as a recording start/stop toggle;
* -Keys for switching between different macro (pre)sets, either a key for
* cycling through the configured presets or keys to directly select a preset.
*/
#define KEY_MACRO_RECORD_START 0x2b0
#define KEY_MACRO_RECORD_STOP 0x2b1
#define KEY_MACRO_PRESET_CYCLE 0x2b2
#define KEY_MACRO_PRESET1 0x2b3
#define KEY_MACRO_PRESET2 0x2b4
#define KEY_MACRO_PRESET3 0x2b5
/*
* Some keyboards have a buildin LCD panel where the contents are controlled
* by the host. Often these have a number of keys directly below the LCD
* intended for controlling a menu shown on the LCD. These keys often don't
* have any labeling so we just name them KEY_KBD_LCD_MENU#
*/
#define KEY_KBD_LCD_MENU1 0x2b8
#define KEY_KBD_LCD_MENU2 0x2b9
#define KEY_KBD_LCD_MENU3 0x2ba
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
/* Performance Boost key (Alienware)/G-Mode key (Dell) */
#define KEY_PERFORMANCE 0x2bd
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
@ -751,6 +890,7 @@
#define ABS_TOOL_WIDTH 0x1c
#define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
#define ABS_MISC 0x28
@ -805,7 +945,9 @@
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MAX 0x0f
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_USB_INSERT 0x11 /* set = USB audio device connected */
#define SW_MAX 0x11
#define SW_CNT (SW_MAX+1)
/*

View file

@ -89,7 +89,7 @@
|| (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6))
*/
#define __VALGRIND_MAJOR__ 3
#define __VALGRIND_MINOR__ 15
#define __VALGRIND_MINOR__ 18
#include <stdarg.h>
@ -110,6 +110,8 @@
*/
#undef PLAT_x86_darwin
#undef PLAT_amd64_darwin
#undef PLAT_x86_freebsd
#undef PLAT_amd64_freebsd
#undef PLAT_x86_win32
#undef PLAT_amd64_win64
#undef PLAT_x86_linux
@ -122,6 +124,7 @@
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
#undef PLAT_mips64_linux
#undef PLAT_nanomips_linux
#undef PLAT_x86_solaris
#undef PLAT_amd64_solaris
@ -130,12 +133,17 @@
# define PLAT_x86_darwin 1
#elif defined(__APPLE__) && defined(__x86_64__)
# define PLAT_amd64_darwin 1
#elif (defined(__MINGW32__) && !defined(__MINGW64__)) \
#elif defined(__FreeBSD__) && defined(__i386__)
# define PLAT_x86_freebsd 1
#elif defined(__FreeBSD__) && defined(__amd64__)
# define PLAT_amd64_freebsd 1
#elif (defined(__MINGW32__) && defined(__i386__)) \
|| defined(__CYGWIN32__) \
|| (defined(_WIN32) && defined(_M_IX86))
# define PLAT_x86_win32 1
#elif defined(__MINGW64__) \
|| (defined(_WIN64) && defined(_M_X64))
#elif (defined(__MINGW32__) && defined(__x86_64__)) \
|| (defined(_WIN32) && defined(_M_X64))
/* __MINGW32__ and _WIN32 are defined in 64 bit mode as well. */
# define PLAT_amd64_win64 1
#elif defined(__linux__) && defined(__i386__)
# define PLAT_x86_linux 1
@ -157,8 +165,10 @@
# define PLAT_s390x_linux 1
#elif defined(__linux__) && defined(__mips__) && (__mips==64)
# define PLAT_mips64_linux 1
#elif defined(__linux__) && defined(__mips__) && (__mips!=64)
#elif defined(__linux__) && defined(__mips__) && (__mips==32)
# define PLAT_mips32_linux 1
#elif defined(__linux__) && defined(__nanomips__)
# define PLAT_nanomips_linux 1
#elif defined(__sun) && defined(__i386__)
# define PLAT_x86_solaris 1
#elif defined(__sun) && defined(__x86_64__)
@ -254,7 +264,7 @@
#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
|| (defined(PLAT_x86_win32) && defined(__GNUC__)) \
|| defined(PLAT_x86_solaris)
|| defined(PLAT_x86_solaris) || defined(PLAT_x86_freebsd)
typedef
struct {
@ -394,6 +404,7 @@ valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
#if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin) \
|| defined(PLAT_amd64_solaris) \
|| defined(PLAT_amd64_freebsd) \
|| (defined(PLAT_amd64_win64) && defined(__GNUC__))
typedef
@ -872,7 +883,8 @@ typedef
/* results = r3 */ \
"lgr %0, 3\n\t" \
: "=d" (_zzq_result) \
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
: "a" (&_zzq_args[0]), \
"0" ((unsigned long int)_zzq_default) \
: "cc", "2", "3", "memory" \
); \
_zzq_result; \
@ -1045,6 +1057,75 @@ typedef
#endif /* PLAT_mips64_linux */
#if defined(PLAT_nanomips_linux)
typedef
struct {
unsigned int nraddr; /* where's the code? */
}
OrigFn;
/*
8000 c04d srl zero, zero, 13
8000 c05d srl zero, zero, 29
8000 c043 srl zero, zero, 3
8000 c053 srl zero, zero, 19
*/
#define __SPECIAL_INSTRUCTION_PREAMBLE "srl[32] $zero, $zero, 13 \n\t" \
"srl[32] $zero, $zero, 29 \n\t" \
"srl[32] $zero, $zero, 3 \n\t" \
"srl[32] $zero, $zero, 19 \n\t"
#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
_zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
__extension__ \
({ volatile unsigned int _zzq_args[6]; \
volatile unsigned int _zzq_result; \
_zzq_args[0] = (unsigned int)(_zzq_request); \
_zzq_args[1] = (unsigned int)(_zzq_arg1); \
_zzq_args[2] = (unsigned int)(_zzq_arg2); \
_zzq_args[3] = (unsigned int)(_zzq_arg3); \
_zzq_args[4] = (unsigned int)(_zzq_arg4); \
_zzq_args[5] = (unsigned int)(_zzq_arg5); \
__asm__ volatile("move $a7, %1\n\t" /* default */ \
"move $t0, %2\n\t" /* ptr */ \
__SPECIAL_INSTRUCTION_PREAMBLE \
/* $a7 = client_request( $t0 ) */ \
"or[32] $t0, $t0, $t0\n\t" \
"move %0, $a7\n\t" /* result */ \
: "=r" (_zzq_result) \
: "r" (_zzq_default), "r" (&_zzq_args[0]) \
: "$a7", "$t0", "memory"); \
_zzq_result; \
})
#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
{ volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
volatile unsigned long int __addr; \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
/* $a7 = guest_NRADDR */ \
"or[32] $t1, $t1, $t1\n\t" \
"move %0, $a7" /*result*/ \
: "=r" (__addr) \
: \
: "$a7"); \
_zzq_orig->nraddr = __addr; \
}
#define VALGRIND_CALL_NOREDIR_T9 \
__SPECIAL_INSTRUCTION_PREAMBLE \
/* call-noredir $25 */ \
"or[32] $t2, $t2, $t2\n\t"
#define VALGRIND_VEX_INJECT_IR() \
do { \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
"or[32] $t3, $t3, $t3\n\t" \
); \
} while (0)
#endif
/* Insert assembly code for other platforms here... */
#endif /* NVALGRIND */
@ -1145,7 +1226,7 @@ typedef
/* ----------------- x86-{linux,darwin,solaris} ---------------- */
#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
|| defined(PLAT_x86_solaris)
|| defined(PLAT_x86_solaris) || defined(PLAT_x86_freebsd)
/* These regs are trashed by the hidden call. No need to mention eax
as gcc can already see that, plus causes gcc to bomb. */
@ -1577,7 +1658,7 @@ typedef
/* ---------------- amd64-{linux,darwin,solaris} --------------- */
#if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin) \
|| defined(PLAT_amd64_solaris)
|| defined(PLAT_amd64_solaris) || defined(PLAT_amd64_freebsd)
/* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */
@ -4687,8 +4768,16 @@ typedef
r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the
function a proper return address. All others are ABI defined call
clobbers. */
#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
"f0","f1","f2","f3","f4","f5","f6","f7"
#if defined(__VX__) || defined(__S390_VX__)
#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \
"v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", \
"v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", \
"v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", \
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
#else
#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14", \
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"
#endif
/* Nb: Although r11 is modified in the asm snippets below (inside
VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for
@ -4710,9 +4799,9 @@ typedef
"aghi 15,-160\n\t" \
"lg 1, 0(1)\n\t" /* target->r1 */ \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "d" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
@ -4734,9 +4823,9 @@ typedef
"lg 2, 8(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
@ -4759,9 +4848,9 @@ typedef
"lg 3,16(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
@ -4786,9 +4875,9 @@ typedef
"lg 4,24(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
@ -4815,9 +4904,9 @@ typedef
"lg 5,32(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7" \
@ -4846,9 +4935,9 @@ typedef
"lg 6,40(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,160\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -4880,9 +4969,9 @@ typedef
"mvc 160(8,15), 48(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,168\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -4916,9 +5005,9 @@ typedef
"mvc 168(8,15), 56(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,176\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -4954,9 +5043,9 @@ typedef
"mvc 176(8,15), 64(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,184\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -4994,9 +5083,9 @@ typedef
"mvc 184(8,15), 72(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,192\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -5036,9 +5125,9 @@ typedef
"mvc 192(8,15), 80(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,200\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -5080,9 +5169,9 @@ typedef
"mvc 200(8,15), 88(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,208\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -5126,9 +5215,9 @@ typedef
"mvc 208(8,15), 96(1)\n\t" \
"lg 1, 0(1)\n\t" \
VALGRIND_CALL_NOREDIR_R1 \
"lgr %0, 2\n\t" \
"aghi 15,216\n\t" \
VALGRIND_CFI_EPILOGUE \
"lgr %0, 2\n\t" \
: /*out*/ "=d" (_res) \
: /*in*/ "a" (&_argvec[0]) __FRAME_POINTER \
: /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
@ -5678,6 +5767,422 @@ typedef
#endif /* PLAT_mips32_linux */
/* ------------------------- nanomips-linux -------------------- */
#if defined(PLAT_nanomips_linux)
/* These regs are trashed by the hidden call. */
#define __CALLER_SAVED_REGS "$t4", "$t5", "$a0", "$a1", "$a2", \
"$a3", "$a4", "$a5", "$a6", "$a7", "$t0", "$t1", "$t2", "$t3", \
"$t8","$t9", "$at"
/* These CALL_FN_ macros assume that on mips-linux, sizeof(unsigned
long) == 4. */
#define CALL_FN_W_v(lval, orig) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[1]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_W(lval, orig, arg1) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[2]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[3]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[4]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[5]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
"lw $a3,16(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[6]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
"lw $a3,16(%1)\n\t" \
"lw $a4,20(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[7]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
"lw $a3,16(%1)\n\t" \
"lw $a4,20(%1)\n\t" \
"lw $a5,24(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
arg7) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[8]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
"lw $a3,16(%1)\n\t" \
"lw $a4,20(%1)\n\t" \
"lw $a5,24(%1)\n\t" \
"lw $a6,28(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
arg7,arg8) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[9]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
__asm__ volatile( \
"lw $t9, 0(%1)\n\t" \
"lw $a0, 4(%1)\n\t" \
"lw $a1, 8(%1)\n\t" \
"lw $a2,12(%1)\n\t" \
"lw $a3,16(%1)\n\t" \
"lw $a4,20(%1)\n\t" \
"lw $a5,24(%1)\n\t" \
"lw $a6,28(%1)\n\t" \
"lw $a7,32(%1)\n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0\n" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
arg7,arg8,arg9) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[10]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
_argvec[9] = (unsigned long)(arg9); \
__asm__ volatile( \
"addiu $sp, $sp, -16 \n\t" \
"lw $t9,36(%1) \n\t" \
"sw $t9, 0($sp) \n\t" \
"lw $t9, 0(%1) \n\t" \
"lw $a0, 4(%1) \n\t" \
"lw $a1, 8(%1) \n\t" \
"lw $a2,12(%1) \n\t" \
"lw $a3,16(%1) \n\t" \
"lw $a4,20(%1) \n\t" \
"lw $a5,24(%1) \n\t" \
"lw $a6,28(%1) \n\t" \
"lw $a7,32(%1) \n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0 \n\t" \
"addiu $sp, $sp, 16 \n\t" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
arg7,arg8,arg9,arg10) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[11]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
_argvec[9] = (unsigned long)(arg9); \
_argvec[10] = (unsigned long)(arg10); \
__asm__ volatile( \
"addiu $sp, $sp, -16 \n\t" \
"lw $t9,36(%1) \n\t" \
"sw $t9, 0($sp) \n\t" \
"lw $t9,40(%1) \n\t" \
"sw $t9, 4($sp) \n\t" \
"lw $t9, 0(%1) \n\t" \
"lw $a0, 4(%1) \n\t" \
"lw $a1, 8(%1) \n\t" \
"lw $a2,12(%1) \n\t" \
"lw $a3,16(%1) \n\t" \
"lw $a4,20(%1) \n\t" \
"lw $a5,24(%1) \n\t" \
"lw $a6,28(%1) \n\t" \
"lw $a7,32(%1) \n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0 \n\t" \
"addiu $sp, $sp, 16 \n\t" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
arg6,arg7,arg8,arg9,arg10, \
arg11) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[12]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
_argvec[9] = (unsigned long)(arg9); \
_argvec[10] = (unsigned long)(arg10); \
_argvec[11] = (unsigned long)(arg11); \
__asm__ volatile( \
"addiu $sp, $sp, -16 \n\t" \
"lw $t9,36(%1) \n\t" \
"sw $t9, 0($sp) \n\t" \
"lw $t9,40(%1) \n\t" \
"sw $t9, 4($sp) \n\t" \
"lw $t9,44(%1) \n\t" \
"sw $t9, 8($sp) \n\t" \
"lw $t9, 0(%1) \n\t" \
"lw $a0, 4(%1) \n\t" \
"lw $a1, 8(%1) \n\t" \
"lw $a2,12(%1) \n\t" \
"lw $a3,16(%1) \n\t" \
"lw $a4,20(%1) \n\t" \
"lw $a5,24(%1) \n\t" \
"lw $a6,28(%1) \n\t" \
"lw $a7,32(%1) \n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0 \n\t" \
"addiu $sp, $sp, 16 \n\t" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
arg6,arg7,arg8,arg9,arg10, \
arg11,arg12) \
do { \
volatile OrigFn _orig = (orig); \
volatile unsigned long _argvec[13]; \
volatile unsigned long _res; \
_argvec[0] = (unsigned long)_orig.nraddr; \
_argvec[1] = (unsigned long)(arg1); \
_argvec[2] = (unsigned long)(arg2); \
_argvec[3] = (unsigned long)(arg3); \
_argvec[4] = (unsigned long)(arg4); \
_argvec[5] = (unsigned long)(arg5); \
_argvec[6] = (unsigned long)(arg6); \
_argvec[7] = (unsigned long)(arg7); \
_argvec[8] = (unsigned long)(arg8); \
_argvec[9] = (unsigned long)(arg9); \
_argvec[10] = (unsigned long)(arg10); \
_argvec[11] = (unsigned long)(arg11); \
_argvec[12] = (unsigned long)(arg12); \
__asm__ volatile( \
"addiu $sp, $sp, -16 \n\t" \
"lw $t9,36(%1) \n\t" \
"sw $t9, 0($sp) \n\t" \
"lw $t9,40(%1) \n\t" \
"sw $t9, 4($sp) \n\t" \
"lw $t9,44(%1) \n\t" \
"sw $t9, 8($sp) \n\t" \
"lw $t9,48(%1) \n\t" \
"sw $t9,12($sp) \n\t" \
"lw $t9, 0(%1) \n\t" \
"lw $a0, 4(%1) \n\t" \
"lw $a1, 8(%1) \n\t" \
"lw $a2,12(%1) \n\t" \
"lw $a3,16(%1) \n\t" \
"lw $a4,20(%1) \n\t" \
"lw $a5,24(%1) \n\t" \
"lw $a6,28(%1) \n\t" \
"lw $a7,32(%1) \n\t" \
VALGRIND_CALL_NOREDIR_T9 \
"move %0, $a0 \n\t" \
"addiu $sp, $sp, 16 \n\t" \
: /*out*/ "=r" (_res) \
: /*in*/ "r" (&_argvec[0]) \
: /*trash*/ "memory", __CALLER_SAVED_REGS \
); \
lval = (__typeof__(lval)) _res; \
} while (0)
#endif /* PLAT_nanomips_linux */
/* ------------------------- mips64-linux ------------------------- */
#if defined(PLAT_mips64_linux)
@ -6146,6 +6651,10 @@ typedef
command. */
VG_USERREQ__GDB_MONITOR_COMMAND = 0x1202,
/* Allows the client program to change a dynamic command line
option. */
VG_USERREQ__CLO_CHANGE = 0x1203,
/* These are useful and can be interpreted by any tool that
tracks malloc() et al, by using vg_replace_malloc.c. */
VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
@ -6628,6 +7137,14 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
command, 0, 0, 0, 0)
/* Change the value of a dynamic command line option.
Note that unknown or not dynamically changeable options
will cause a warning message to be output. */
#define VALGRIND_CLO_CHANGE(option) \
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CLO_CHANGE, \
option, 0, 0, 0, 0)
#undef PLAT_x86_darwin
#undef PLAT_amd64_darwin
#undef PLAT_x86_win32
@ -6641,6 +7158,7 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
#undef PLAT_s390x_linux
#undef PLAT_mips32_linux
#undef PLAT_mips64_linux
#undef PLAT_nanomips_linux
#undef PLAT_x86_solaris
#undef PLAT_amd64_solaris

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,10 @@ option('libwacom',
type: 'boolean',
value: true,
description: 'Use libwacom for tablet identification (default=true)')
option('mtdev',
type: 'boolean',
value: true,
description: 'Use mtdev for multitouch protocol A devices (default=true)')
option('debug-gui',
type: 'boolean',
value: true,
@ -24,8 +28,8 @@ option('install-tests',
description: 'Install the libinput test command [default=false]')
option('documentation',
type: 'boolean',
value: true,
description: 'Build the documentation [default=true]')
value: false,
description: 'Build the documentation [default=false]')
option('coverity',
type: 'boolean',
value: false,
@ -34,3 +38,15 @@ option('zshcompletiondir',
type: 'string',
value: '',
description: 'Directory for zsh completion scripts ["no" disables]')
option('internal-event-debugging',
type: 'boolean',
value: false,
description: 'Enable additional internal event debug tracing. This will print key values to the logs and thus must never be enabled in a release build')
option('autoload-plugins',
type: 'boolean',
value: false,
description: 'Always load plugins from default plugin paths (only if the caller does not do so)')
option('lua-plugins',
type: 'feature',
value: 'auto',
description: 'Enable support for Lua plugins')

View file

@ -0,0 +1,71 @@
-- SPDX-License-Identifier: MIT
--
-- This is an example libinput plugin
--
-- This plugin detects the Copilot key on the keyboard with
-- the given VID/PID and replaces it with a different key (sequence).
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
-- Replace this with your keyboard's VID/PID
KEYBOARD_VID = 0x046d
KEYBOARD_PID = 0x4088
meta_is_down = false
shift_is_down = false
-- shift-A, because you can never have enough screaming
replacement_sequence = { evdev.KEY_LEFTSHIFT, evdev.KEY_A }
function frame(device, frame, _)
for _, v in ipairs(frame) do
if v.value ~= 2 then -- ignore key repeats
if v.usage == evdev.KEY_LEFTMETA then
meta_is_down = v.value == 1
elseif v.usage == evdev.KEY_LEFTSHIFT then
shift_is_down = v.value == 1
elseif v.usage == evdev.KEY_F23 and meta_is_down and shift_is_down then
-- We know from the MS requirements that F23 for copilot is
-- either last key (on press) or the first key (on release)
-- of the three-key sequence, and no other keys are
-- within this frame.
if v.value == 1 then
-- Release our modifiers first
device:prepend_frame({
{ usage = evdev.KEY_LEFTSHIFT, value = 0 },
{ usage = evdev.KEY_LEFTMETA, value = 0 },
})
-- Insert our replacement press sequence
local replacement_frame = {}
for _, rv in ipairs(replacement_sequence) do
table.insert(replacement_frame, { usage = rv, value = 1 })
end
device:append_frame(replacement_frame)
else
-- Insert our replacement release sequence
local replacement_frame = {}
for idx = #replacement_sequence, 1, -1 do
table.insert(replacement_frame, { usage = replacement_sequence[idx], value = 0 })
end
device:append_frame(replacement_frame)
-- we don't care about re-pressing shift/meta because the
-- rest of the stack will filter the release for an
-- unpressed key anyway.
end
return {} -- discard this frame
end
end
end
end
function device_new(device)
local info = device:info()
if info.vid == KEYBOARD_VID and info.pid == KEYBOARD_PID then
device:connect("evdev-frame", frame)
end
end
libinput:connect("new-evdev-device", device_new)

View file

@ -0,0 +1,64 @@
-- SPDX-License-Identifier: MIT
--
-- This is an example libinput plugin
--
-- This plugin delays any event with relative motion by the given DELAY
-- by storing it in a table and replaying it via a timer callback later.
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
DELAY = 1500 * 1000 -- 1.5s
next_timer_expiry = 0
devices = {}
function timer_expired(time_in_microseconds)
next_timer_expiry = 0
for device, frames in pairs(devices) do
while #frames > 0 and frames[1].time <= time_in_microseconds do
--- we don't have a current frame so it doesn't matter
--- whether we prepend or append
device:prepend_frame(frames[1].frame)
table.remove(frames, 1)
end
local next_frame = frames[1]
if next_frame and (next_timer_expiry == 0 or next_frame.time < next_timer_expiry) then
next_timer_expiry = next_frame.time
end
end
if next_timer_expiry ~= 0 then
libinput:timer_set_absolute(next_timer_expiry)
end
end
function frame(device, frame, timestamp)
for _, v in ipairs(frame) do
if v.usage == evdev.REL_X or v.usage == evdev.REL_Y then
local next_time = timestamp + DELAY
table.insert(devices[device], {
time = next_time,
frame = frame
})
if next_timer_expiry == 0 then
next_timer_expiry = next_time
libinput:timer_set_absolute(next_timer_expiry)
end
return {} -- discard frame
end
end
return nil
end
function device_new(device)
local usages = device:usages()
if usages[evdev.REL_X] then
devices[device] = {}
device:connect("evdev-frame", frame)
device:connect("device-removed", function(dev)
devices[dev] = nil
end)
end
end
libinput:connect("new-evdev-device", device_new)
libinput:connect("timer-expired", timer_expired)

View file

@ -0,0 +1,16 @@
-- SPDX-License-Identifier: MIT
--
-- An example plugin to show how to disable an internal feature.
--
-- Typically one would expect the plugin to re-implement the feature
-- in a more device-specific manner but that's not done here.
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
libinput:connect("new-evdev-device", function(device)
local udev_info = device:udev_properties()
if udev_info["ID_INPUT_TOUCHPAD"] then
libinput:log_info("Disabling palm detection on " .. device:name())
device:disable_feature("touchpad-palm-detection")
end
end)

40
plugins/10-dwt.lua Normal file
View file

@ -0,0 +1,40 @@
-- SPDX-License-Identifier: MIT
--
-- This plugin implements a very simple version of disable-while-typing.
-- It monitors all keyboard devices and if any of them send an event,
-- any touchpad device is disabled for 2 seconds.
-- And "disabled" means any event from that touchpad is simply
-- discarded.
--
-- Install this file in /etc/libinput/plugins and
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
tp_enabled = true
libinput:connect("timer-expired", function(now)
libinput:log_debug("touchpad enabled")
tp_enabled = true
end)
libinput:connect("new-evdev-device", function (device)
local props = device:udev_properties()
if props.ID_INPUT_KEYBOARD then
device:connect("evdev-frame", function (device, frame, timestamp)
libinput:timer_set_relative(2000000)
if tp_enabled then
libinput:log_debug("touchpad disabled")
tp_enabled = false
end
end)
elseif props.ID_INPUT_TOUCHPAD then
libinput:log_debug("Touchpad detected: " .. device:name())
device:connect("evdev-frame", function (device, frame, timestamp)
if not tp_enabled then
-- Returning an empty table discards the event.
return {}
end
end)
end
end)

87
plugins/10-example.lua Normal file
View file

@ -0,0 +1,87 @@
-- SPDX-License-Identifier: MIT
--
-- This is an example libinput plugin
--
-- This plugin swaps left and right buttons on any device that has both buttons.
-- Let's create a plugin. A single Lua script may create more than one
-- plugin instance but that's a bit of a nice use-case. Most scripts
-- should be a single plugin.
-- A plugin needs to be registered to activate. If it isn't, it is
-- cleaned up immediately. In the register call we supply
-- the list of plugin versions we support. Currently we only
-- have version 1.
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
-- Note to the reader: it will be easier to understand this example
-- if you read it bottom-up from here on.
-- The callback for our "evdev-frame" signal.
-- These frames are sent *before* libinput gets to handle them so
-- any modifications will affect libinput.
function frame(device, frame, time_in_microseconds)
-- Frame is a table in the form
-- { { usage: 123, value: 3 }, ... }
-- Let's use the evdev module to make it more readable, evdev.KEY_A
-- is simply the value (0x1 << 16) | 0x1 (see linux/input-event-codes.h)
for _, v in ipairs(frame) do
-- If we get a right button event, change it to left, and
-- vice versa. Because this happens before libinput (or the next
-- plugin in the precedence order) sees the
-- frame it doesn't know that the swap happened.
if v.usage == evdev.BTN_RIGHT then
v.usage = evdev.BTN_LEFT
elseif v.usage == evdev.BTN_LEFT then
v.usage = evdev.BTN_RIGHT
end
end
-- We changed the frame, let's return it. If we return nil
-- the original frame is being used as-is.
return frame
end
-- This is a timer callback. It is invoked after one second
-- (see below) but only once - re-set the timer so
-- it goes off every second.
function timer_expired(time_in_microseconds)
libinput:timer_set_absolute(time_in_microseconds + 1000000)
end
-- Callback for the "new-evdev-device" signal, see below
-- The argument is the EvdevDevice object, see the documentation.
function device_new(device)
-- A table of evdev usages available on our device.
-- Using the evdev module makes it more readable but you can
-- use numbers (which is what evdev.EV_KEY and
-- friends resolve to anyway).
local usages = device:usages()
if usages[evdev.BTN_LEFT] and usages[evdev.BTN_RIGHT] then
-- The "evdev-frame" callback is invoked whenever the device
-- provided us with one evdev frame, i.e. a bunch of events up
-- to excluding EV_SYN SYN_REPORT.
device:connect("evdev-frame", frame)
end
-- The device has udev information, let's print it out. Right
-- now all we get are the ID_INPUT_ bits.
-- If this is empty we know libinput will ignore this device anyway
local udev_info = device:udev_properties()
for k, v in pairs(udev_info) do
libinput:log_debug(k .. "=" .. v)
end
end
-- Let's connect to the "new-evdev-device" signal. This function
-- is invoked when libinput detects a new evdev device (but before
-- that device is actually available to libinput as libinput device).
-- This allows us to e.g. change properties on the device.
libinput:connect("new-evdev-device", device_new)
-- Set our timer to expire 1s from now (in microseconds).
-- Timers are absolute, so they need to be added to the
-- current time
libinput:connect("timer-expired", timer_expired)
libinput:timer_set_relative(1000000)

View file

@ -0,0 +1,32 @@
-- SPDX-License-Identifier: MIT
--
-- This plugin inverts the horizontal scroll direction of
-- the Logitech MX Master mouse. OOTB the mouse scrolls
-- in the opposite direction to all other mice out there.
--
-- This plugin is only needed when the mouse is connected
-- to the Logitech Bolt receiver - on that receiver we cannot
-- tell which device is connected.
--
-- For the Logitech Unifying receiver and Bluetooth please
-- add the ModelInvertHorizontalScrolling=1 quirk
-- in quirks/30-vendor-logitech.quirks.
--
--
-- Install this file in /etc/libinput/plugins and
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
libinput:connect("new-evdev-device", function (device)
local info = device:info()
if info.vid == 0x046D and info.pid == 0xC548 then
device:connect("evdev-frame", function (device, frame, timestamp)
for _, event in ipairs(frame) do
if event.usage == evdev.REL_HWHEEL or event.usage == evdev.REL_HWHEEL_HI_RES then
event.value = -event.value
end
end
return frame
end)
end
end)

View file

@ -0,0 +1,22 @@
-- SPDX-License-Identifier: MIT
--
-- An example plugin to make the pointer go three times as fast
--
-- Install this file in /etc/libinput/plugins and
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
libinput:connect("new-evdev-device", function(device)
local usages = device:usages()
if usages[evdev.REL_X] then
device:connect("evdev-frame", function(device, frame, timestamp)
for _, v in ipairs(frame) do
if v.usage == evdev.REL_X or v.usage == evdev.REL_Y then
-- Multiply the relative motion by 3
v.value = v.value * 3
end
end
return frame
end)
end
end)

View file

@ -0,0 +1,56 @@
-- SPDX-License-Identifier: MIT
--
-- An example plugin to make the pointer go three times as slow
--
-- Install this file in /etc/libinput/plugins and
--
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
remainders = {}
function split(v)
if math.abs(v) >= 1.0 then
local i = math.floor(math.abs(v))
local r = math.abs(v) % 1.0
if v < 0.0 then
i = -i
r = -r
end
return i, r
else
return 0, v
end
end
function decelerate(device, x, y)
local remainder = remainders[device]
local rx, ry = 0, 0
if x ~= 0.0 then
rx, remainder.x = split(remainder.x + x/3.0)
end
if y ~= 0.0 then
ry, remainder.y = split(remainder.y + y/3.0)
end
return rx, ry
end
libinput:connect("new-evdev-device", function(device)
local usages = device:usages()
if usages[evdev.REL_X] then
remainders[device] = { x = 0.0, y = 0.0 }
device:connect("evdev-frame", function(device, frame, timestamp)
for _, v in ipairs(frame) do
if v.usage == evdev.REL_X then
v.value, _ = decelerate(device, v.value, 0.0)
elseif v.usage == evdev.REL_Y then
_, v.value = decelerate(device, 0.0, v.value)
end
end
return frame
end)
device:connect("device-removed", function(dev)
remainders[dev] = nil
end)
end
end)

View file

@ -0,0 +1,121 @@
-- SPDX-License-Identifier: MIT
--
-- This is an example libinput plugin
--
-- This plugin controls a mouse/pointer from a tablet device. This
-- effectively hides stylus interactions and sends pointer events
-- instead. In other words: mouse emulation for tablets, implemented
-- by (remote) controlling a mouse device. This allows using a
-- tablet stylus as a mouse replacement without tablet limitations
-- from compositors or clients. Note that axis usually needed for
-- drawing (like pressure, tilt or distance) are no longer emitted
-- when this plugin is active and a mouse is connected. When no
-- mouse is connected, this plugin doesn't change tablet events,
-- thus the stylus works like a normal stylus.
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
-- globals
pointer_device = nil
tablet_device = nil
maximum_x = nil
maximum_y = nil
function adjust_for_aspect_ratio(y)
-- adjust y to match monitor 21:9 aspect ratio
local adj_maximum_y = maximum_x * 1440 / 3440
return math.floor(math.min(y * maximum_y / adj_maximum_y, maximum_y + 1))
end
function on_tablet_frame(device, frame, time_in_microseconds)
-- emit tablet frame when there is no pointer device
if not pointer_device then return nil end
-- map tablet frame to pointer frame
local events = {}
for _, v in ipairs(frame) do
if v.usage == evdev.ABS_MISC then
-- save a few cycles on Wacom tablets by discarding a
-- proximity in / out frame early, non-Wacom tablets should
-- use BTN_TOOL_PEN/RUBBER/... instead
return {}
elseif v.usage == evdev.ABS_X then
table.insert(events, { usage = evdev.ABS_X, value = v.value })
elseif v.usage == evdev.ABS_Y then
-- uncomment the next two lines and comment the original line
-- for configuring aspect correction, see
-- adjust_for_aspect_ratio() for details and configuration
-- local adj_value = adjust_for_aspect_ratio(v.value)
-- table.insert(events, { usage = evdev.ABS_Y, value = adj_value })
table.insert(events, { usage = evdev.ABS_Y, value = v.value })
elseif v.usage == evdev.BTN_TOUCH then
table.insert(events, { usage = evdev.BTN_LEFT, value = v.value })
elseif v.usage == evdev.BTN_STYLUS then
table.insert(events, { usage = evdev.BTN_RIGHT, value = v.value })
elseif v.usage == evdev.BTN_STYLUS2 then
table.insert(events, { usage = evdev.BTN_MIDDLE, value = v.value })
end
end
-- emit pointer frame, if any
if #events > 0 then pointer_device:append_frame(events) end
-- discard tablet frame
return {}
end
function on_tablet_removed(device)
libinput:log_info("Remove tablet device")
tablet_device = nil
end
function on_pointer_removed(device)
libinput:log_info("Remove pointer device")
pointer_device = nil
end
function setup()
if not pointer_device or not tablet_device then return end
libinput:log_info("Controlling '" .. pointer_device:name() .. "' with '" .. tablet_device:name() .. "'")
-- fetch absinfos from tablet
local absinfo_x = {}
local absinfo_y = {}
for a, b in pairs(tablet_device:absinfos()) do
if a == evdev.ABS_X then absinfo_x = b end
if a == evdev.ABS_Y then absinfo_y = b end
end
-- copy max values for aspect ratio correction later on
maximum_x = absinfo_x.maximum
maximum_y = absinfo_y.maximum
-- copy absinfos to pointer device
pointer_device:set_absinfo(evdev.ABS_X, absinfo_x)
pointer_device:set_absinfo(evdev.ABS_Y, absinfo_y)
-- setup listeners
pointer_device:connect("device-removed", on_pointer_removed)
tablet_device:connect("device-removed", on_tablet_removed)
tablet_device:connect("evdev-frame", on_tablet_frame)
end
function on_new_device(device)
local udev = device:udev_properties()
if udev["ID_INPUT_TABLET"] and not udev["ID_INPUT_TABLET_PAD"] then
libinput:log_info("Found tablet device")
tablet_device = device
setup()
end
if udev["ID_INPUT_MOUSE"] then
libinput:log_info("Found pointer device")
pointer_device = device
setup()
end
end
-- setup listener
libinput:connect("new-evdev-device", on_new_device)

View file

@ -0,0 +1,64 @@
-- SPDX-License-Identifier: MIT
--
-- This is an example libinput plugin
--
-- This plugin maps a downwards mouse wheel to a button down event and
-- an upwards wheel movement to a button up event.
-- UNCOMMENT THIS LINE TO ACTIVATE THE PLUGIN
-- libinput:register({1})
-- The button we want to press on wheel events
local wheel_button = evdev.BTN_EXTRA
local button_states = {}
local function evdev_frame(device, frame, timestamp)
local events = {}
local modified = false
for _, v in ipairs(frame) do
if v.usage == evdev.REL_WHEEL then
-- REL_WHEEL is inverted, neg value -> down, pos value -> up
if v.value < 0 then
if not button_states[device] then
table.insert(events, { usage = wheel_button, value = 1 })
button_states[device] = true
end
else
if button_states[device] then
table.insert(events, { usage = wheel_button, value = 0 })
button_states[device] = false
end
end
modified = true
-- Because REL_WHEEL is no longer a wheel, the high-res
-- events are dropped
elseif v.usage == evdev.REL_WHEEL_HI_RES then
modified = true
else
table.insert(events, v)
end
end
if modified then
return events
else
return nil
end
end
local function device_new(device)
local usages = device:usages()
if usages[evdev.REL_WHEEL] then
button_states[device] = false
if not usages[wheel_button] then
device:enable_evdev_usage(wheel_button)
end
device:connect("evdev-frame", evdev_frame)
device:connect("device-removed", function(dev)
button_states[dev] = nil
end)
end
end
libinput:connect("new-evdev-device", device_new)

17
plugins/meson.build Normal file
View file

@ -0,0 +1,17 @@
plugins = [
'10-example.lua',
'10-dwt.lua',
'10-logitech-mx-master-horiz-scroll.lua',
'10-pointer-go-faster.lua',
'10-pointer-go-slower.lua',
'10-delay-motion.lua',
'10-disable-feature.lua',
'10-copilot-key-override.lua',
'10-wheel-to-button.lua',
'10-tablet-mouse-control.lua',
]
fs = import('fs')
foreach plugin : plugins
fs.copyfile(plugin)
endforeach

View file

@ -9,3 +9,23 @@ AttrKeyboardIntegration=internal
MatchUdevType=keyboard
MatchBus=bluetooth
AttrKeyboardIntegration=external
# Detachable devices usually have the tablet part buttons wired as ps2 keyboard,
# don't disable them when tablet-mode switch is in effect.
# DMI Chassis Type 20h (32 decimal) is Detachable as per SMBIOS specification.
[Detachable Device Buttons]
MatchBus=ps2
MatchUdevType=keyboard
MatchDMIModalias=dmi:*:ct32:*
ModelTabletModeNoSuspend=1
# Tablet devices usually have the tablet part buttons wired as ps2 keyboard,
# despite being tablets some of them, e.g. Microsoft Surface Laptop Studio,
# expose tablet-mode switch, so don't disable the ps2 keyboard.
# Tablets that don't expose tablet-mode switch won't have any diference.
# DMI Chassis Type 1Eh (30 decimal) is Tablet as per SMBIOS specification.
[Tablet Device Buttons]
MatchBus=ps2
MatchUdevType=keyboard
MatchDMIModalias=dmi:*:ct30:*
ModelTabletModeNoSuspend=1

View file

@ -1,11 +0,0 @@
# Do not edit this file, it will be overwritten on update
[Lid Switch Ct9]
MatchName=*Lid Switch*
MatchDMIModalias=dmi:*:ct9:*
AttrLidSwitchReliability=reliable
[Lid Switch Ct10]
MatchName=*Lid Switch*
MatchDMIModalias=dmi:*:ct10:*
AttrLidSwitchReliability=reliable

View file

@ -0,0 +1,6 @@
# Do not edit this file, it will be overwritten on update
# https://gitlab.freedesktop.org/libinput/libinput/-/issues/656
[Emulated Mouse]
MatchName=ImPS/2 Generic Wheel Mouse
ModelBouncingKeys=1

Some files were not shown because too many files have changed in this diff Show more