platform/upstream/libinput.git
6 years agotools: yaml verifier: allow for SYN_REPORT value 1
Peter Hutterer [Thu, 19 Apr 2018 04:04:09 +0000 (14:04 +1000)]
tools: yaml verifier: allow for SYN_REPORT value 1

This is generated by the kernel's autorepeat code, see input_repeat_key() in
drivers/input/input.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: yaml verifier: add POINTER_AXIS to allowed events types
Peter Hutterer [Thu, 19 Apr 2018 03:46:12 +0000 (13:46 +1000)]
tools: yaml verifier: add POINTER_AXIS to allowed events types

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoImprove responsiveness for Apple Magic Trackpad
Daniel van Vugt [Tue, 17 Apr 2018 02:43:32 +0000 (10:43 +0800)]
Improve responsiveness for Apple Magic Trackpad

The touch size threshold was too high, so occasionally libinput would
think the finger had lifted when it hadn't and events would be ignored.

Similarly, the palm threshold was too low, so occasionally libinput would
think a heavy single finger was a palm and ignored that too.

This fixes both of those issues.

https://bugs.freedesktop.org/show_bug.cgi?id=103572

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: duplicate the pointer_accelerator struct into the bits that use it
Peter Hutterer [Wed, 11 Apr 2018 02:06:06 +0000 (12:06 +1000)]
filter: duplicate the pointer_accelerator struct into the bits that use it

Yeah, it's duplication. But this way it's also separation and we can't
accidentally use the wrong struct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: namespace the various trackers_* functions
Peter Hutterer [Wed, 11 Apr 2018 01:49:15 +0000 (11:49 +1000)]
filter: namespace the various trackers_* functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: split the mouse acceleration out into a separate file
Peter Hutterer [Wed, 11 Apr 2018 01:41:16 +0000 (11:41 +1000)]
filter: split the mouse acceleration out into a separate file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: drop the ntrackers argument from init_trackers
Peter Hutterer [Wed, 11 Apr 2018 01:24:48 +0000 (11:24 +1000)]
filter: drop the ntrackers argument from init_trackers

Reduces the duplication, everyone uses the same value anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: tidy up the touchpad filter
Peter Hutterer [Wed, 11 Apr 2018 01:14:56 +0000 (11:14 +1000)]
filter: tidy up the touchpad filter

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: split the low-dpi acceleration into a separate file
Peter Hutterer [Wed, 11 Apr 2018 01:05:12 +0000 (11:05 +1000)]
filter: split the low-dpi acceleration into a separate file

Plenty of duplication there from the normal filter.c, but that also makes it
less likely to break if we adjust the other one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move the flat filter into a separate file
Peter Hutterer [Wed, 11 Apr 2018 00:57:50 +0000 (10:57 +1000)]
filter: move the flat filter into a separate file

This also fixes a bug with the _noop function, because we casted to the wrong
struct the dpi value was garbage.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move the velocity diff to the only function we use it in
Peter Hutterer [Wed, 11 Apr 2018 00:54:48 +0000 (10:54 +1000)]
filter: move the velocity diff to the only function we use it in

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: split the touchpad acceleration code into a separate file
Peter Hutterer [Tue, 10 Apr 2018 04:21:26 +0000 (14:21 +1000)]
filter: split the touchpad acceleration code into a separate file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: make the simpsons accel calculation available through the header
Peter Hutterer [Tue, 10 Apr 2018 06:20:45 +0000 (16:20 +1000)]
filter: make the simpsons accel calculation available through the header

This is the standard approach for mice and touchpads to calculate the
acceleration based on the last two deltas, let's make that code shareable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move the pointer_accelerator struct into the header
Peter Hutterer [Tue, 10 Apr 2018 04:49:56 +0000 (14:49 +1000)]
filter: move the pointer_accelerator struct into the header

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: split trackpoint acceleration code into a separate file
Peter Hutterer [Tue, 10 Apr 2018 04:09:31 +0000 (14:09 +1000)]
filter: split trackpoint acceleration code into a separate file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: split the tablet accel code into a separate file
Peter Hutterer [Tue, 10 Apr 2018 04:01:58 +0000 (14:01 +1000)]
filter: split the tablet accel code into a separate file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move the x230 filter into a separate file
Peter Hutterer [Tue, 10 Apr 2018 03:08:09 +0000 (13:08 +1000)]
filter: move the x230 filter into a separate file

There's a fair bit of duplication of code from filter.c but it's not worth
disecting this and optimising it. The device is 5 years old now, we don't want
to touch this accel method so duplication is good here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: add helper function to reset and free trackers
Peter Hutterer [Tue, 10 Apr 2018 06:26:46 +0000 (16:26 +1000)]
filter: add helper function to reset and free trackers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: pass trackers to calculate_velocity
Peter Hutterer [Tue, 10 Apr 2018 05:12:58 +0000 (15:12 +1000)]
filter: pass trackers to calculate_velocity

So the function to calculate the velocity is easier to call from other sites.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move the smoothing values to the trackers
Peter Hutterer [Tue, 10 Apr 2018 03:25:53 +0000 (13:25 +1000)]
filter: move the smoothing values to the trackers

This way we can pass them around easier without needing the whole
pointer_accelerator struct (which in theory is device-type specific). The
values relate to the calculation of the delta between trackers anyway, so
logically this is where they belong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: move some functions to the shared header
Peter Hutterer [Tue, 10 Apr 2018 02:56:22 +0000 (12:56 +1000)]
filter: move some functions to the shared header

Prep work for splitting things up better

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofilter: factor out the pointer trackers from the accel filter
Peter Hutterer [Tue, 28 Nov 2017 04:30:26 +0000 (14:30 +1000)]
filter: factor out the pointer trackers from the accel filter

No functional changes, just refactoring

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: re-use the filter source list
Peter Hutterer [Tue, 10 Apr 2018 03:07:19 +0000 (13:07 +1000)]
meson: re-use the filter source list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add the P50 to the T450 jumping motion quirks
Peter Hutterer [Mon, 19 Mar 2018 05:39:22 +0000 (15:39 +1000)]
udev: add the P50 to the T450 jumping motion quirks

On slow finger motion, this device also sends a bunch of events with only
pressure updates, followed by a massive coordinate jump. Enable the quirk so
we skip that jump.

https://bugs.freedesktop.org/show_bug.cgi?id=105022

This patch was initially applied as ab55302ef and reverted as e8cb7e4523.
Turns out the issues are unrelated to this patch, so let's re-apply it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: use a udev monitor to wait for a device to disappear
Peter Hutterer [Wed, 18 Apr 2018 01:05:46 +0000 (11:05 +1000)]
test: use a udev monitor to wait for a device to disappear

Reduces potential race conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: replace a strcmp with streq
Peter Hutterer [Wed, 18 Apr 2018 00:52:32 +0000 (10:52 +1000)]
test: replace a strcmp with streq

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: remove double check for empty queue
Peter Hutterer [Tue, 17 Apr 2018 07:18:01 +0000 (17:18 +1000)]
test: remove double check for empty queue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: don't suspend keyboard on ThinkPad X1 Yoga 1st in tablet mode
Davide Depau [Tue, 17 Apr 2018 13:22:42 +0000 (15:22 +0200)]
evdev: don't suspend keyboard on ThinkPad X1 Yoga 1st in tablet mode

When the X1 Yoga is in tablet mode, one capacitative touch button (windows
key, sends KEY_LEFTMETA) and two side volume buttons are accessible on the
front. The key event comes through the internal keyboard that we disabled in
tablet mode so it stops working.

Luckily the Yoga physically disables the "main" keyboard when in tablet mode,
so all we have to do is skip our code to disable the keyboard and the keys are
working again.

https://bugs.freedesktop.org/show_bug.cgi?id=103749

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoAdd Dell XPS13 L322X touchpad quirks
Sean Lanigan [Sun, 15 Apr 2018 02:17:00 +0000 (12:17 +1000)]
Add Dell XPS13 L322X touchpad quirks

Signed-off-by: Sean Lanigan <sean@lano.id.au>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoRevert "Add Dell XPS13 L322X touchpad quirks"
Peter Hutterer [Tue, 17 Apr 2018 00:06:22 +0000 (10:06 +1000)]
Revert "Add Dell XPS13 L322X touchpad quirks"

The current match doesn't capture all L322X devices, the 'pn' element of
the dmi modalias can read 'pnXPSL322X' or 'pnDellSystemXPSL322X'.
Reverting in favour of the following patch.

This reverts commit 69fe467fbacbc8376d548c335c79cca71b606b07.

https://bugs.freedesktop.org/show_bug.cgi?id=104990

6 years agotest: add a test for a touchscreen with out-of-range axes
Peter Hutterer [Fri, 13 Apr 2018 04:00:05 +0000 (14:00 +1000)]
test: add a test for a touchscreen with out-of-range axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: add a description of the internal architecture
Peter Hutterer [Mon, 16 Apr 2018 01:25:15 +0000 (11:25 +1000)]
doc: add a description of the internal architecture

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoRemove some duplicate empty lines
Peter Hutterer [Sun, 15 Apr 2018 22:37:06 +0000 (08:37 +1000)]
Remove some duplicate empty lines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoDrop the libinput-list-devices and libinput-debug-events compat scripts
Peter Hutterer [Fri, 13 Apr 2018 04:45:19 +0000 (14:45 +1000)]
Drop the libinput-list-devices and libinput-debug-events compat scripts

Added in 1.8, let's drop them for 1.11

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: only run the selinux restore script on meson < 0.43
Peter Hutterer [Fri, 13 Apr 2018 04:39:58 +0000 (14:39 +1000)]
meson: only run the selinux restore script on meson < 0.43

Meson handles this now, see meson commits 1826872 and follow-up c63aa037.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoAdd Dell XPS13 L322X touchpad quirks
Sean Lanigan [Thu, 12 Apr 2018 11:17:00 +0000 (21:17 +1000)]
Add Dell XPS13 L322X touchpad quirks

https://bugs.freedesktop.org/show_bug.cgi?id=104990

Signed-off-by: Sean Lanigan <sean@lano.id.au>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: add a section on what happens when a bug was resolved
Peter Hutterer [Fri, 13 Apr 2018 00:44:34 +0000 (10:44 +1000)]
doc: add a section on what happens when a bug was resolved

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: add a run-time check to avoid re-using model flags
Peter Hutterer [Thu, 12 Apr 2018 23:05:02 +0000 (09:05 +1000)]
evdev: add a run-time check to avoid re-using model flags

Only runs on the LIBINPUT_MODEL_* flags, the ID_INPUT_TRACKBALL flag is an
exception.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: remove duplicate MODEL entry in the model parsing
Peter Hutterer [Thu, 12 Apr 2018 23:07:38 +0000 (09:07 +1000)]
evdev: remove duplicate MODEL entry in the model parsing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodebounce: disable debouncing on the Logitech K400
Peter Hutterer [Thu, 12 Apr 2018 22:57:05 +0000 (08:57 +1000)]
debounce: disable debouncing on the Logitech K400

This is an external keyboard+touchpad but not recognised as touchpad by the
kernel so it's in mouse emulation mode. Double-taps are sent with impossibly
close timestamps and filtered out by the debouncing code. Since this isn't a
real button that can wear out anyway, let's just disable debouncing on this
device.

https://bugs.freedesktop.org/show_bug.cgi?id=105974

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: expand the "reporting bugs" page
Peter Hutterer [Thu, 12 Apr 2018 04:17:50 +0000 (14:17 +1000)]
doc: expand the "reporting bugs" page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: fix switch case-statement indentation
Peter Hutterer [Thu, 12 Apr 2018 01:56:43 +0000 (11:56 +1000)]
tools: fix switch case-statement indentation

We don't indent the 'case FOO:' lines in libinput

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: return an error if the profile change failed
Peter Hutterer [Thu, 12 Apr 2018 00:56:32 +0000 (10:56 +1000)]
evdev: return an error if the profile change failed

If we get to this point, we've already ruled out invalid arguments and this
shouldn't really fail, so let's reply with UNSUPPORTED instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: break up a long line
Peter Hutterer [Thu, 12 Apr 2018 01:10:26 +0000 (11:10 +1000)]
evdev: break up a long line

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: fix duplicated flag value
Tim Richardson [Wed, 11 Apr 2018 09:34:59 +0000 (19:34 +1000)]
evdev: fix duplicated flag value

edit: Luckily there's no overlap between the users of those two flags so this
didn't trigger any bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoRevert "udev: add the P50 to the T450 jumping motion quirks"
Peter Hutterer [Mon, 9 Apr 2018 22:53:12 +0000 (08:53 +1000)]
Revert "udev: add the P50 to the T450 jumping motion quirks"

Apparently this negatively affects scrolling behavior.

https://bugs.freedesktop.org/show_bug.cgi?id=105022#c38

This reverts commit ab55302ef88c3827ecc32f3dd3dc58ca7ebfb7a9.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: axis overrides need to go to systemd, not libinput
Peter Hutterer [Mon, 9 Apr 2018 21:58:31 +0000 (07:58 +1000)]
doc: axis overrides need to go to systemd, not libinput

And remove the double-slash in the error message pointing here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: debugging touchpad pressure/size ranges is interactive
Peter Hutterer [Mon, 9 Apr 2018 00:51:40 +0000 (10:51 +1000)]
doc: debugging touchpad pressure/size ranges is interactive

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: call K_OFF when run on the vt
Peter Hutterer [Thu, 5 Apr 2018 05:04:51 +0000 (15:04 +1000)]
test: call K_OFF when run on the vt

Slight disadvantage: this breaks Ctrl+C to cancel the test suite. Still
potentially better than injecting random events into your vt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agotools: fix man page for debug-events
Peter Hutterer [Thu, 5 Apr 2018 22:18:06 +0000 (08:18 +1000)]
tools: fix man page for debug-events

click method is 'buttonareas', not just 'buttons'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoFix a doxygen link for the get_default_matrix call
Peter Hutterer [Thu, 5 Apr 2018 05:37:21 +0000 (15:37 +1000)]
Fix a doxygen link for the get_default_matrix call

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: don't process state for a touch in TOUCH_NONE
Peter Hutterer [Thu, 5 Apr 2018 01:18:40 +0000 (11:18 +1000)]
touchpad: don't process state for a touch in TOUCH_NONE

If a touch is in TOUCH_NONE, there is nothing to see here, please move along.

In the case of bug 105696, we were accessing the speed.exceeded_count of a
touch that was released previously, erroneously detecting a speed-based thumb.
The sequence was:
- touch down in slot 0, speed.exceeded_count is reset to 0
- move touch until exceeded_count is greater than our threshold
- touch up in slot 0
- touch down in slot 1 [1]
- touch down in slot 2 (more than 25mm away)
- we counted the slot 0 speed.exceeded_count, labeling the slot 2 touch as
  speed-based thumb

[1] peculiar behavior only observed on this device, usually slots get re-used
at the first opportunity so having an inactive slot followed by higher slots
being used is unusual.

https://bugs.freedesktop.org/show_bug.cgi?id=105696

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: log the touch size thresholds if we're using them
Peter Hutterer [Thu, 5 Apr 2018 01:05:14 +0000 (11:05 +1000)]
touchpad: log the touch size thresholds if we're using them

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: validate input devices during cold-plug
Nandor Han [Wed, 4 Apr 2018 11:51:33 +0000 (14:51 +0300)]
udev: validate input devices during cold-plug

During libinput initialization a list of existing input devices is
retrieved from udev. This can lead to a situation where libinput can
end up processing un-configured devices because of the race generated
by udev events and libinput startup.
Sequence example:
weston - start
udev - device 1 added
weston - get a list of input devices
weston - process device 1 -- undefined behavior
udev - device 1 added - finalized

The problem was found because of incorrect touchscreen association
when in a dual monitor system the secondary touchscreen was
incorrectly associated with output one since udev didn't finish the
device initialization and WL_OUTPUT was missing.

To avoid this situation we skip un-configured devices during libinput
initialization, relying on udev to send events when devices are
fully configured.

Note: due to the peculiarities of udev_device_get_is_initialized(), the
input device is still processed if the call fails. If there are no udev
rules defined for the device, it will never be reported as initialized,
but this is not a problem, because all input devices handled by libinput
must have some udev properties set, therefore they always have rules.

Signed-off-by: Nandor Han <nandor.han@ge.com>
[Pekka: change log to debug, unref device]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: expand on the palm detection documentation a bit
Peter Hutterer [Tue, 3 Apr 2018 07:33:18 +0000 (17:33 +1000)]
doc: expand on the palm detection documentation a bit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add T450s trackpoint range
Peter Hutterer [Fri, 23 Mar 2018 03:43:07 +0000 (13:43 +1000)]
udev: add T450s trackpoint range

From https://bugs.freedesktop.org/show_bug.cgi?id=103947

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add trackpoint range for the T440s
Peter Hutterer [Fri, 23 Mar 2018 02:41:20 +0000 (12:41 +1000)]
udev: add trackpoint range for the T440s

Measured at 200 sensitivity because that's what systemd sets for us

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: point users to the trackpoint documentation for missing ranges
Peter Hutterer [Fri, 23 Mar 2018 01:20:05 +0000 (11:20 +1000)]
evdev: point users to the trackpoint documentation for missing ranges

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: add another debug message for the trackpoint sensitivity
Peter Hutterer [Fri, 23 Mar 2018 01:14:24 +0000 (11:14 +1000)]
evdev: add another debug message for the trackpoint sensitivity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add the T440p to the T450 jumping motion quirks
Peter Hutterer [Mon, 19 Mar 2018 05:39:22 +0000 (15:39 +1000)]
udev: add the T440p to the T450 jumping motion quirks

On slow finger motion, this device also sends a bunch of events with only
pressure updates, followed by a massive coordinate jump. Enable the quirk so
we skip that jump. This is for RMI4 and PS/2, RMI4 is confirmed in the bug
below, let's assume PS/2 has that issue too.

https://bugs.freedesktop.org/show_bug.cgi?id=105640

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: add a script to check for leftover litest rules
Peter Hutterer [Fri, 23 Mar 2018 00:29:28 +0000 (10:29 +1000)]
test: add a script to check for leftover litest rules

An aborted test run can sometimes leave udev rules as detritus. Test for that
so we don't get test case failures triggered by those rules.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoCODING_STYLE: add exception for for (int i=0, ...) declarations
Peter Hutterer [Fri, 23 Mar 2018 00:17:26 +0000 (10:17 +1000)]
CODING_STYLE: add exception for for (int i=0, ...) declarations

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add trackpoint range for Lenovo X280
Peter Hutterer [Thu, 22 Mar 2018 04:29:37 +0000 (14:29 +1000)]
udev: add trackpoint range for Lenovo X280

https://bugs.freedesktop.org/show_bug.cgi?id=105485

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotablet: add missing space in an error message
Peter Hutterer [Wed, 21 Mar 2018 22:30:01 +0000 (08:30 +1000)]
tablet: add missing space in an error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: reliably sort the udev rules
Peter Hutterer [Wed, 21 Mar 2018 10:08:16 +0000 (20:08 +1000)]
test: reliably sort the udev rules

This guarantees the device rules have a static order between test runs.
Previously and in some cases, the temporary file name could affect the order
of the udev rules - let's not do that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: move all the _setup() functions into a special section
Peter Hutterer [Wed, 21 Mar 2018 02:54:10 +0000 (12:54 +1000)]
test: move all the _setup() functions into a special section

This way we can loop through them instead of having to add them manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: only keep low-pressure fingers alive for 2+-slot touchpads
Peter Hutterer [Wed, 21 Mar 2018 00:24:12 +0000 (10:24 +1000)]
touchpad: only keep low-pressure fingers alive for 2+-slot touchpads

Regression introduced by 3979b9e16a5ed141506d95f80ddfd7b94651dcfa, bug 105258.
With that commit, we only ended real touches when we had less than nslots fake
fingers down. i.e. tripletap on a 2 slot touchpad would not end the
first/second touch even if the pressure goes below the threshold. e.g. Lenovo
x270 needs this, see https://bugs.freedesktop.org/attachment.cgi?id=137672, it
dips below the pressure threshold for the first slot and ends the second slot
in the same frame as the third finger is detected. Fun times.

Anyway, this breaks semi-mt touchpads, another fine category of devices,
because some of those can detect hovering fingers at low pressure, see bug
105535. Because semi-mt devices are generally garbage, we treat them as
single-touch devices instead. So whenever two fingers are down, we treat both
as above the pressure threshold, even when they're physicall hovering.

Fix this by making the x270 fix conditional on at least 2 slots.

https://bugs.freedesktop.org/show_bug.cgi?id=105535

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: drop the * from the Lid Switch test device udev rule match
Peter Hutterer [Wed, 21 Mar 2018 04:04:28 +0000 (14:04 +1000)]
test: drop the * from the Lid Switch test device udev rule match

This is the cause of the random test case failures. Because the rule for this
device would also match on the Surface3 lid switch test device it comes down
to whatever mkstemps() picked as the unique characters. When the Surface3
sorted later, everything worked, otherwise it would fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: fix vert axis printing on error
Peter Hutterer [Wed, 21 Mar 2018 00:18:45 +0000 (10:18 +1000)]
test: fix vert axis printing on error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoudev: add the P50 to the T450 jumping motion quirks
Peter Hutterer [Mon, 19 Mar 2018 05:39:22 +0000 (15:39 +1000)]
udev: add the P50 to the T450 jumping motion quirks

On slow finger motion, this device also sends a bunch of events with only
pressure updates, followed by a massive coordinate jump. Enable the quirk so
we skip that jump.

https://bugs.freedesktop.org/show_bug.cgi?id=105022

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: point users to disabled documentation when dot/doxygen is missing
Peter Hutterer [Mon, 19 Mar 2018 04:52:57 +0000 (14:52 +1000)]
meson: point users to disabled documentation when dot/doxygen is missing

Especially dot is hard to find for some users, so provide the solution to
their problems right there in the error message.

And because users are likely to just copy/paste, remove the disable-libwacom
option. Save them from themselves...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: touchpad-pressure: init the lo/hi values correctly
Peter Hutterer [Tue, 20 Mar 2018 05:21:33 +0000 (15:21 +1000)]
tools: touchpad-pressure: init the lo/hi values correctly

From https://bugs.freedesktop.org/show_bug.cgi?id=105535

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: print the mouse and pointingstick udev properties
Peter Hutterer [Tue, 20 Mar 2018 03:51:06 +0000 (13:51 +1000)]
tools: libinput-record: print the mouse and pointingstick udev properties

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: print a progress bar when recording to a file
Peter Hutterer [Wed, 14 Mar 2018 22:44:19 +0000 (08:44 +1000)]
tools: libinput-record: print a progress bar when recording to a file

To let users know something is happening.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: print a comment when the device is in a neutral state
Peter Hutterer [Mon, 12 Mar 2018 03:36:54 +0000 (13:36 +1000)]
tools: libinput-record: print a comment when the device is in a neutral state

Common problem: some touch sequence does something to confuse libinput but it
cannot easily be captureed. The result is a long sequence of touche that need
to be picked apart and isolated.

Print an easy-to-search  for message in the evdev output that signals that the
device touch state is now neutral (i.e. no finger down). Same can be achieved
by searching for BTN_TOOL_FINGER but that provides false positives for
switching between one and two fingers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: add support for printing libinput events
Peter Hutterer [Thu, 1 Mar 2018 00:04:11 +0000 (10:04 +1000)]
tools: libinput-record: add support for printing libinput events

Collect libinput events together with the evdev events and print them to the
log. This makes it possible to debug the full behavior of a user's machine
rather than having to replay it with potential different race conditions/side
effects.

Example event output:
  - evdev:
    - [  2, 314443,   4,   4,    57] # EV_MSC / MSC_SCAN               57
    - [  2, 314443,   1,  57,     1] # EV_KEY / KEY_SPACE               1
    - [  2, 314443,   0,   0,     0] # ------------ SYN_REPORT (0) ---------- +87ms
    libinput:
    - {time: 2.314443, type: KEYBOARD_KEY, key: 57, state: pressed}
  - evdev:
    - [  2, 377203,   4,   4,    57] # EV_MSC / MSC_SCAN               57
    - [  2, 377203,   1,  57,     0] # EV_KEY / KEY_SPACE               0
    - [  2, 377203,   0,   0,     0] # ------------ SYN_REPORT (0) ---------- +63ms
    libinput:
    - {time: 2.377203, type: KEYBOARD_KEY, key: 57, state: released}

Note that the only way to know that events are within the same frame is to
check the timestamp. libinput keeps those intact which means we can tell that
if we just had an evdev frame with timestamp T and get a pointer motion with
timestamp T, that frame caused the motion event.

So far, only key, pointer and touch events are printed. We also
hardcode-enable tapping where available until we have options to enable this
on the commandline just because that's useful to have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: disable the second-finger-move test for semi-mt devices
Peter Hutterer [Thu, 15 Mar 2018 08:17:15 +0000 (18:17 +1000)]
test: disable the second-finger-move test for semi-mt devices

Having only one finger move (and the second finger at that) in semi-mt device
is not something we can realistically support. We disable the mt axes and
treat semi-mts as single-touch devices, so we don't actually get those events.

The only reason this test passed is because we release the first touch first
here, causing a ABS_X/Y shift that exceeded the motion threshold.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-debug-events stop variable needs volatile
Peter Seiderer [Tue, 13 Mar 2018 20:28:22 +0000 (21:28 +0100)]
tools: libinput-debug-events stop variable needs volatile

The stop variable set in the signal handler needs
volatile (and use the defined sig_atomic_t instead
of unsigned int).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-replay: only print the events in verbose mode
Peter Hutterer [Mon, 12 Mar 2018 03:41:22 +0000 (13:41 +1000)]
tools: libinput-replay: only print the events in verbose mode

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: make sure we compare only the last 3 events for wobble
Peter Hutterer [Mon, 12 Mar 2018 04:32:39 +0000 (14:32 +1000)]
touchpad: make sure we compare only the last 3 events for wobble

We're left-shifting the bits but weren't comparing against the l_r_l mask
itself. So if we get a sequence of [1, 1, 0, 1] we didn't detect a wobble
because 0b1101 != 0b101 (what we're looking for).

Fix this by turning it into a right shift, that way the bits fall off
the mask automatic
                  al
                    ly
                      y
                      y
                      y
                      y
                     .  .
                   _._v.___

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: don't enable top palm detection on touchpads <= 55mm high
Peter Hutterer [Mon, 12 Mar 2018 23:33:57 +0000 (09:33 +1000)]
touchpad: don't enable top palm detection on touchpads <= 55mm high

Tiny enough as it is, let's not take usable space away.

https://bugs.freedesktop.org/show_bug.cgi?id=105434

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: end hovering touches in maybe_end_touch
Peter Hutterer [Mon, 12 Mar 2018 00:33:21 +0000 (10:33 +1000)]
touchpad: end hovering touches in maybe_end_touch

Otherwise a hovering touch stays around forever even after the finger has
discontinued. This doesn't matter on slots, but for fake fingers the finger
may suddenly end up being forced down/up as a result of the pressure changes
on the real fingers.

So when in maybe_end_touch, switch them back to NONE immediately - hovering
touches do not need to trigger a TOUCH_END event.

https://bugs.freedesktop.org/show_bug.cgi?id=105258

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: add separate variable for the first device
Peter Hutterer [Thu, 8 Mar 2018 01:01:10 +0000 (11:01 +1000)]
tools: libinput-record: add separate variable for the first device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: drop unused 'print' argument
Peter Hutterer [Thu, 8 Mar 2018 00:53:57 +0000 (10:53 +1000)]
tools: libinput-record: drop unused 'print' argument

And rename the function for more clarity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: libinput-record: fix frame printing for multiple devices
Peter Hutterer [Fri, 9 Mar 2018 04:50:56 +0000 (14:50 +1000)]
tools: libinput-record: fix frame printing for multiple devices

The evdev events were just dumped into one big list instead of being split up
by frame.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: add a tool to verify the yaml output from libinput-record
Peter Hutterer [Fri, 9 Mar 2018 04:23:55 +0000 (14:23 +1000)]
tools: add a tool to verify the yaml output from libinput-record

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoMerge branch 'wip/hysteresis-wobbles'
Peter Hutterer [Fri, 9 Mar 2018 00:17:43 +0000 (10:17 +1000)]
Merge branch 'wip/hysteresis-wobbles'

6 years agoExtract and reset the abs fuzz value for the x/y axes
Peter Hutterer [Mon, 5 Mar 2018 03:17:43 +0000 (13:17 +1000)]
Extract and reset the abs fuzz value for the x/y axes

The kernel fuzz handling is buggy, especially when we want to rely on the fuzz
value for our hysteresis. But since this is a hw property and (at least
sometimes) set by the driver, we can't make this a pure libinput hwdb set
either.

So our workaround is:
* extract the (non-zero) fuzz into a udev property so we don't lose it
* set the fuzz to 0 to disable the in-kernel hysteresis
* overwrite our internal absinfo with the property fuzz

This way we get to use the hw-specified fuzz without having the kernel muck
around with it. We also get to use the EVDEV_ABS_ values in 60-evdev.hwdb to
override a driver-set fuzz.

Two drawbacks:
- we're resetting the kernel fuzz to 0, this affects any other users of the
  device node. That's probably a minor impact only.
- we can only save this in a udev property there's a risk of this information
  getting lost when playing around with udev rules. That too should be a minor
  issue.

https://bugs.freedesktop.org/show_bug.cgi?id=105303

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: enable hysteresis based on a 0 fuzz value
Peter Hutterer [Fri, 23 Feb 2018 01:44:23 +0000 (11:44 +1000)]
touchpad: enable hysteresis based on a 0 fuzz value

If the fuzz is 0, assume we don't need hysteresis and use the wobble detection
code instead. If the fuzz is non-zero, enable it by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: use the fuzz value (if any) for the hysteresis margin
Peter Hutterer [Wed, 21 Feb 2018 03:41:31 +0000 (13:41 +1000)]
touchpad: use the fuzz value (if any) for the hysteresis margin

We currently used 0.5mm on touchpads as hysteresis value. This causes pointer
movement delays, it is likely too high. Reduce it to a kernel-set fuzz value
(if any) and see how we go with that. On many touchpads, the fuzz is 8 which
would be closer to 0.2mm on e.g. a T440.

Note that the does some defuzzing anyway, but the response of that function is
nonlinear, e.g. for a fuzz of 8, the physical deltas map to:

phys 0..3  → delta 0
phys 4..7  → delta 1
phys 8..15 → delta 4, 5, 6, 7
phys 16..N → delta 16..N

In other words, we never see some logical deltas 2 and 3. While this shouldn't
matter given the average touchpad resolution, reducing the hysteresis margin
is likely to provide some better response. We never see values 8-15 either
which could be the cause of some pointer jumps we've been seeing.

see https://bugs.freedesktop.org/show_bug.cgi?id=105303

Devices with a fuzz of 0 have the hysteresis margin reduced to 0.25mm (from
0.5mm).

https://bugs.freedesktop.org/show_bug.cgi?id=105108

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofallback: fix touchscreen defuzzing
Peter Hutterer [Thu, 8 Mar 2018 23:41:57 +0000 (09:41 +1000)]
fallback: fix touchscreen defuzzing

The hysteresis-returned point always differs from the current point, even if
the hysteresis kicks in. We need to compare to the hysteresis center.

And the returned point is only the new center if we exceed the margin,
otherwise the center stays as-is.

The touch_fuzz() test only succeeded for this because for the values we were
introducing jitter by, the kernel filtered out all the actual movement so
these paths weren't hit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: record udev properties in libinput-record
Peter Hutterer [Wed, 7 Mar 2018 23:31:02 +0000 (09:31 +1000)]
tools: record udev properties in libinput-record

Only the ones we care about in libinput but for those it's handy to know which
ones are set (especially the LIBINPUT_MODEL ones).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson.build: fix vcs_tag fallback argument
Peter Hutterer [Wed, 7 Mar 2018 22:27:10 +0000 (08:27 +1000)]
meson.build: fix vcs_tag fallback argument

This needs to be specified as keyword argument, and meson < 0.41 doesn't allow
for a missing fallback.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: handle a palm down in the tapped state
Peter Hutterer [Wed, 7 Mar 2018 00:58:17 +0000 (10:58 +1000)]
touchpad: handle a palm down in the tapped state

We expected the first event after TAPPED to be a finger down. If that finger
has been recognised as palm, the finger state isn't TOUCH_BEGIN so we get an
invalid state in our FSM.

  libinput bug: 0: invalid tap event TAP_EVENT_PALM in state TAP_STATE_TAPPED

https://bugs.freedesktop.org/show_bug.cgi?id=105370

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: make libinput-git-version.h a source of libinput-record
Peter Hutterer [Tue, 6 Mar 2018 22:48:01 +0000 (08:48 +1000)]
meson: make libinput-git-version.h a source of libinput-record

Fixes the dependency chain, otherwise a race condition between building
libinput-record and building the git version header causes random build
failures.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: add the git version in the libinput-record output
Peter Hutterer [Wed, 28 Feb 2018 11:29:38 +0000 (21:29 +1000)]
tools: add the git version in the libinput-record output

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: enable palm detection on tablets' touchpads
Peter Hutterer [Fri, 9 Feb 2018 02:17:38 +0000 (12:17 +1000)]
touchpad: enable palm detection on tablets' touchpads

https://bugs.freedesktop.org/show_bug.cgi?id=104986

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: init touch size range based on the udev property
Peter Hutterer [Wed, 7 Feb 2018 05:01:31 +0000 (15:01 +1000)]
touchpad: init touch size range based on the udev property

No need to hardcode Apple here, if we have a udev property for this, let's use
it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agopad: use libwacom to get the evdev to button number mapping
Peter Hutterer [Wed, 18 Oct 2017 03:00:16 +0000 (13:00 +1000)]
pad: use libwacom to get the evdev to button number mapping

Some of wacom's tablets, notably the Bamboo series, have a non-predictable
scheme of mapping the buttons to numeric button numbers in libwacom. Since we
promise sequential button numbers, we need to have those identical to
libwacom, otherwise it's impossible to map the two together.

Most tablets have a predictable mapping, so this does not affect the majority
of devices.

For the old-style bamboos, this swaps the buttons around with the buttons
being ordered vertically top-to-bottom in libwacom.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
6 years agotest: don't use litest_is_pad_button_event for a few tests
Peter Hutterer [Mon, 23 Oct 2017 03:33:13 +0000 (13:33 +1000)]
test: don't use litest_is_pad_button_event for a few tests

That function requires us to know which button we're testing for. Because of
the upcoming libwacom changes, we don't know which button we're about to get,
especially on the bamboos. Use the standard libinput functions to get to the
libinput event instead, we don't care about the button numbers here anyway.

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