Commit graph

4480 commits

Author SHA1 Message Date
Peter Hutterer
c5d6b3f6e8 Default branch is now main
To update your local repository, use these commands

    $ git fetch origin
    $ git checkout master
    $ git branch -m main
    $ git branch --set-upstream-to=origin/main

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-29 10:55:01 +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