platform/upstream/libinput.git
5 years agolibinput 1.13.0 1.13.0
Peter Hutterer [Thu, 28 Mar 2019 23:39:30 +0000 (09:39 +1000)]
libinput 1.13.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add another valgrind suppression for Python
Peter Hutterer [Thu, 28 Mar 2019 05:59:16 +0000 (15:59 +1000)]
test: add another valgrind suppression for Python

This triggers on Fedora 30, even though skip skip the tools options test when
running under valgrind.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix tool option parsing tests for signals
Peter Hutterer [Thu, 28 Mar 2019 05:31:51 +0000 (15:31 +1000)]
test: fix tool option parsing tests for signals

Not sure how this ever worked correctly: a process terminated by a signal has
the negative signo as return code. This would apply to every debug-events and
debug-gui test because they have to get killed by a signal. This failed
occasionally, presumably a race with the GTK startup/signal handler/whatever.

Fix this by a) sending SIGQUIT because that won't get handled by the tools and
b) prending that if we get a -SIGQUIT exit code, everything is fine.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: fix the tool option parse test to handle unittest arguments
Peter Hutterer [Thu, 28 Mar 2019 05:25:13 +0000 (15:25 +1000)]
tools: fix the tool option parse test to handle unittest arguments

Pass arguments we don't handle directly through to the unittest module. This
way we can filter tests with -k testname etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agodoc/api: improve readability of the API docs
Peter Hutterer [Wed, 27 Mar 2019 05:18:20 +0000 (15:18 +1000)]
doc/api: improve readability of the API docs

Still not great and probably makes any professional designer's eyes bleed, but
at least it's more readable now.

Changes:
- spacing after param name so they don't cuddle up with the description
- color changes and background image removals to drop the doxygen default look
- font size changes to not make things overrun
- font family change to make the function prototypes readable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoFix three coverity complaints
Peter Hutterer [Mon, 25 Mar 2019 05:15:13 +0000 (15:15 +1000)]
Fix three coverity complaints

Two resource leaks, one uninitialized variable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: mark the protocol A device as touch device
Peter Hutterer [Fri, 22 Mar 2019 06:21:08 +0000 (16:21 +1000)]
test: mark the protocol A device as touch device

Now that we're emulating everything correctly, let's mark it as proper touch
device.

Two test cases need to be excluded:
- double-down triggers an assert in the test device because this isn't
  possible this way with protocol A devices
- the axisrange warning test can't be triggered, mtdev clips those axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: switch the protocol A test device to be an actual protocol A device
Peter Hutterer [Fri, 22 Mar 2019 05:47:21 +0000 (15:47 +1000)]
test: switch the protocol A test device to be an actual protocol A device

This device mostly behaved like a normal touch device except for
SYN_MT_REPORT. Switch it to behave like a real protocol A device and adjust
the test accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: let the device custom create method return a bool
Peter Hutterer [Fri, 22 Mar 2019 05:44:32 +0000 (15:44 +1000)]
test: let the device custom create method return a bool

This is so we can tell litest to create the device anyway, useful for when all
we have to do in the custom create is allocate some memory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: drop remnants of the test device udev rules
Peter Hutterer [Fri, 22 Mar 2019 01:49:41 +0000 (11:49 +1000)]
test: drop remnants of the test device udev rules

Removed with 27188228fdef10707c61f822db57bf0d3d568682 but we still had the
meson define being set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: don't install our normal rules file in installed mode
Peter Hutterer [Fri, 22 Mar 2019 01:43:13 +0000 (11:43 +1000)]
test: don't install our normal rules file in installed mode

When running the test-suite, don't install our rules for device groups and
model quirks - they're expected to be present already.

Plus, since we copy them from the meson build dir, we don't have
those files available anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: remove unnecessary comparison
Konstantin Kharlamov [Thu, 21 Mar 2019 21:02:24 +0000 (00:02 +0300)]
evdev: remove unnecessary comparison

All "goto err" resides after fd have been properly initialized.

Fixes "Comparison is always true because fd >= 0." warning by LGTM.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
5 years agoevdev: fix "always false" comparison
Konstantin Kharlamov [Thu, 21 Mar 2019 20:49:46 +0000 (23:49 +0300)]
evdev: fix "always false" comparison

Fixes "Comparison is always false because rc >= 0." warning by LGTM.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
5 years agolibinput 1.12.902 1.12.902
Peter Hutterer [Thu, 21 Mar 2019 05:19:46 +0000 (15:19 +1000)]
libinput 1.12.902

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: Rename button up and down states to mirror each other
Benjamin Poirier [Fri, 4 Jan 2019 06:37:17 +0000 (15:37 +0900)]
evdev: Rename button up and down states to mirror each other

The button up debouncing states mirror the button down states with the
addition of the spurious debouncing states. Rename the states to better
show this symmetry.

5 years agotouchpad: multitap state transitions use the same timing used for taps
Paolo Giangrandi [Thu, 14 Mar 2019 03:53:54 +0000 (21:53 -0600)]
touchpad: multitap state transitions use the same timing used for taps

Multitap sequences (more than 2 taps) had a 180ms timer set only on press,
not on release.
New taps within those 180ms could either trigger multitap+drag or another
multitap (for N+1 taps), resetting the timer on press once again.
If no new tap appears within those 180ms, the sequence was considered
complete.

This behavior differed from regular taps: for the very first tap of a
sequence the timer was set both on touch and on release.

The multitap timing caused misdetection of triple-tap-and-drag sequences as
the timer was hit frequently. Some of those were correctly detected, others
as tripletap only.

Changing the timer to be set on press **and** release gives us a more lenient
timeout. 180ms for tap-and-drag and 180ms for the next tap down after
release. This was also the behavior for the xorg synaptics driver.

Note that quadruple-tap-and-drag didn't suffer from this because the timeout
resulted in double-tap + double-tap-and-drag. Which has the same
user-visible effect.

5 years agoSet TouchPad Pressure Range for Toshiba L855
Feldwor [Sun, 17 Mar 2019 21:45:43 +0000 (21:45 +0000)]
Set TouchPad Pressure Range for Toshiba L855

5 years agomeson.build: make valgrind optional
Peter Hutterer [Fri, 15 Mar 2019 00:23:25 +0000 (10:23 +1000)]
meson.build: make valgrind optional

Now that we're providing the test suite as installed option, distributions
will likely include it as a test package. valgrind is only used for the
meson-specifc test setup. So let's make it optional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: flake8 fixes, typo fixes and missing exception handling
Peter Hutterer [Fri, 15 Mar 2019 01:19:22 +0000 (11:19 +1000)]
tools: flake8 fixes, typo fixes and missing exception handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agolibinput 1.12.901 1.12.901
Peter Hutterer [Thu, 14 Mar 2019 05:13:52 +0000 (15:13 +1000)]
libinput 1.12.901

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: make the test suite runner available as installed binary
Peter Hutterer [Tue, 5 Mar 2019 05:51:06 +0000 (15:51 +1000)]
test: make the test suite runner available as installed binary

Available as 'libinput test-suite'. This also renames the bit in the build
directory now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add an option to skip installing our quirks into the test system
Peter Hutterer [Tue, 5 Mar 2019 05:24:10 +0000 (15:24 +1000)]
test: add an option to skip installing our quirks into the test system

This allows us to run the test suite runner against the installed system
rather than always using the build tree quirks.

The actual option will be removed in a future commit, it is just here for
commit consistency and testing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: move the builddir lookup function out to a separate file
Peter Hutterer [Wed, 6 Mar 2019 10:16:41 +0000 (20:16 +1000)]
tools: move the builddir lookup function out to a separate file

We want to use this from the tests as well soon, so let's move it to a more
generic location. This also changes the API to be slightly more sensible, a
free() is the same cost (and safer) than passing a static buffer in and hoping
we didn't get the size wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: split out the unit tests into a separate test suite
Peter Hutterer [Wed, 6 Mar 2019 04:19:08 +0000 (14:19 +1000)]
test: split out the unit tests into a separate test suite

All the bits that test for utility functions to work correctly can be run
separately from the main test suite (which tests devices and libinput in
general). These bits here are the ones that test the code itself and aren't
reliant on anything else.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: move the double assert macros to a separate header
Peter Hutterer [Wed, 13 Mar 2019 04:30:01 +0000 (14:30 +1000)]
test: move the double assert macros to a separate header

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: split the library version test out
Peter Hutterer [Wed, 6 Mar 2019 03:56:01 +0000 (13:56 +1000)]
test: split the library version test out

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: split up the quirks installations
Peter Hutterer [Wed, 6 Mar 2019 02:03:33 +0000 (12:03 +1000)]
test: split up the quirks installations

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: install the test device udev rule from a string
Peter Hutterer [Tue, 5 Mar 2019 05:14:12 +0000 (15:14 +1000)]
test: install the test device udev rule from a string

It's a one-liner, we don't need this as a separate file. Plus, this makes the
test suite runner less dependent on the build directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: split the test-specific #defines out
Peter Hutterer [Wed, 6 Mar 2019 03:43:00 +0000 (13:43 +1000)]
test: split the test-specific #defines out

These don't need to be in the libinput config.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add --help to the test suite runner
Peter Hutterer [Wed, 6 Mar 2019 23:16:05 +0000 (09:16 +1000)]
test: add --help to the test suite runner

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: skip the option parsing test during valgrind
Peter Hutterer [Thu, 7 Mar 2019 01:22:13 +0000 (11:22 +1000)]
tools: skip the option parsing test during valgrind

We don't want to valgrind through python...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: clip the exit code to 255
Peter Hutterer [Thu, 7 Mar 2019 00:12:11 +0000 (10:12 +1000)]
test: clip the exit code to 255

If more than 255 tests fail, we're returning an exit code outside of the POSIX
standard. This only takes effect for -j1, where we fork off we only ever have
a failed value of 1 anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: minor warning message change
Peter Hutterer [Tue, 5 Mar 2019 05:10:36 +0000 (15:10 +1000)]
test: minor warning message change

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agodoc/user: put an extra note in regarding the test suite
Peter Hutterer [Wed, 6 Mar 2019 23:14:55 +0000 (09:14 +1000)]
doc/user: put an extra note in regarding the test suite

Running the test suite runner is good, but not sufficient, a full ninja test
is required to get the full coverage.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agodoc/user: correct the test suite runner invocation
Peter Hutterer [Wed, 6 Mar 2019 03:35:08 +0000 (13:35 +1000)]
doc/user: correct the test suite runner invocation

With meson this is now in the build directory

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoinclude: sync kernel headers for v5.0
Peter Hutterer [Wed, 6 Mar 2019 01:11:04 +0000 (11:11 +1000)]
include: sync kernel headers for v5.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: display the discrete axis steps too
Peter Hutterer [Wed, 28 Nov 2018 02:16:51 +0000 (12:16 +1000)]
tools: display the discrete axis steps too

Draw a second smaller scroll bar that moves with every discrete step. For that
to work, we have to accumulate the value from the normal scroll events until
we get the first discrete one, then move up.

The value per discrete event changes depending on the click wheel angle, so we
can't just use discrete on its own if we want the two scroll bars aligned.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: group the scroll bits into a struct
Peter Hutterer [Wed, 28 Nov 2018 02:11:08 +0000 (12:11 +1000)]
tools: group the scroll bits into a struct

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: fix grammar in comment
Peter Hutterer [Mon, 11 Feb 2019 22:51:32 +0000 (08:51 +1000)]
fallback: fix grammar in comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: record: print a helpful error message when we don't have devices
Peter Hutterer [Fri, 1 Mar 2019 00:27:05 +0000 (10:27 +1000)]
tools: record: print a helpful error message when we don't have devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: Do not perform spurious detection when spurious is already enabled
Benjamin Poirier [Fri, 4 Jan 2019 07:03:38 +0000 (16:03 +0900)]
evdev: Do not perform spurious detection when spurious is already enabled

When exiting RELEASE_DELAYED state, do not transition into states to detect
the need for spurious mode (RELEASE_WAITING, MAYBE_SPURIOUS).
RELEASE_DELAYED is only entered when spurious mode is enabled, there is no
need to detect the need for spurious mode again.

5 years agoReduce button scroll timeout to 38ms
Henré Botha [Mon, 18 Feb 2019 15:04:53 +0000 (15:04 +0000)]
Reduce button scroll timeout to 38ms

When using button scrolling, a hardcoded delay of 200 milliseconds between
button down and scroll events being emitted makes fast scrolling gestures feel
clunky and sometimes fail entirely. This feature comes from
xf86-input-mouse, was copied into xf86-input-evdev and reimplemented in
libinput.

This was, as far as can be determined, to allow right clicks without
triggering scrolling. libinput now also has distance triggers (2bbf4a0117624)
and sends button events if no movement has happened for long clicks,
regardless of the delay.

The 200ms delay is thus not really necessary anymore, let's drop it to 38ms
which is just above the 3-event threshold for 8/10/12ms intervals which is
most devices.

Fixes #237

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agodoc/user: replace evemu with libinput-record in the documentation
Peter Hutterer [Mon, 18 Feb 2019 05:46:07 +0000 (15:46 +1000)]
doc/user: replace evemu with libinput-record in the documentation

Fixes #220

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: replace != NULL checks with ck_assert_notnull
Peter Hutterer [Thu, 14 Feb 2019 22:42:15 +0000 (08:42 +1000)]
test: replace != NULL checks with ck_assert_notnull

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: check for a non-null libinput in the new udev_create_seat_too_long test
Peter Hutterer [Thu, 14 Feb 2019 22:37:21 +0000 (08:37 +1000)]
test: check for a non-null libinput in the new udev_create_seat_too_long test

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: remove unreachable code
Peter Hutterer [Thu, 14 Feb 2019 22:32:04 +0000 (08:32 +1000)]
test: remove unreachable code

When the loop was reduced to BTN_DIGI only, it guaranteed that the BTN_STYLUS
condition was no longer met.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoLenovo X1 Carbon 6th Trackpoint
Diep Pham [Thu, 14 Feb 2019 13:56:02 +0000 (20:56 +0700)]
Lenovo X1 Carbon 6th Trackpoint

5 years agodoc/user: swap udevadm hwdb for systemd-hwdb
Peter Hutterer [Thu, 14 Feb 2019 06:55:01 +0000 (16:55 +1000)]
doc/user: swap udevadm hwdb for systemd-hwdb

The latter has more obvious handling of hwdb matches. With udevadm hwdb a glob
may take precedence over a hwdb entry even if the latter is sorted later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoadd quirk for Lenovo X1 Carbon 4th Trackpoint
Diep Pham [Thu, 14 Feb 2019 03:17:28 +0000 (10:17 +0700)]
add quirk for Lenovo X1 Carbon 4th Trackpoint

5 years agotools: debug-gui: change the tablet color
Peter Hutterer [Thu, 14 Feb 2019 03:01:39 +0000 (13:01 +1000)]
tools: debug-gui: change the tablet color

Grey isn't pretty enough

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: debug-gui: add a previously unbalanced cairo_restore()
Peter Hutterer [Thu, 14 Feb 2019 02:44:27 +0000 (12:44 +1000)]
tools: debug-gui: add a previously unbalanced cairo_restore()

And remove some of the unnecessary ones

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: debug-gui: move the pointer delta code to draw_pointer
Peter Hutterer [Thu, 14 Feb 2019 02:57:11 +0000 (12:57 +1000)]
tools: debug-gui: move the pointer delta code to draw_pointer

Not sure why this was in draw_tablet(), probably copy/paste

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add another helper to discard specific events
Peter Hutterer [Tue, 12 Feb 2019 01:59:09 +0000 (11:59 +1000)]
test: add another helper to discard specific events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: skip the tablet pressure test if we don't have pressure
Peter Hutterer [Tue, 12 Feb 2019 04:02:13 +0000 (14:02 +1000)]
test: skip the tablet pressure test if we don't have pressure

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix the tablet relative delta test
Peter Hutterer [Tue, 12 Feb 2019 04:02:48 +0000 (14:02 +1000)]
test: fix the tablet relative delta test

These numbers just happened to add up correctly for the motion history to
produce a zero delta for a diagonal movement. Fix it by adding extra events to
flush out any motion history leftovers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix the tablet motion test
Peter Hutterer [Tue, 12 Feb 2019 01:36:20 +0000 (11:36 +1000)]
test: fix the tablet motion test

This test had a loop around the proximity events, so in theory we could've
sent two proximity-in events and still get a positive test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: set LITEST_HOVER for all tests that require the hover feature
Peter Hutterer [Tue, 12 Feb 2019 04:04:49 +0000 (14:04 +1000)]
test: set LITEST_HOVER for all tests that require the hover feature

Where we test for changes on tip state, we need the hover feature

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: mark all current tablets as having a hover feature
Peter Hutterer [Tue, 12 Feb 2019 01:19:54 +0000 (11:19 +1000)]
test: mark all current tablets as having a hover feature

The totem, also a tablet tool, is a tool that is always tip-down and does not
support hovering so we need to be able to distinguish this for tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: make litest robust for ABS_MT_POSITION_X-only devices
Peter Hutterer [Thu, 27 Sep 2018 05:07:53 +0000 (15:07 +1000)]
test: make litest robust for ABS_MT_POSITION_X-only devices

The Dell Canvas Totem only has the MT axes but not the single touch ones. Make
sure we copy the axis extents correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: draw the tablet before the touch points
Peter Hutterer [Wed, 13 Feb 2019 00:15:29 +0000 (10:15 +1000)]
tools: draw the tablet before the touch points

On the Dell Canvas Totem, the tool will cancel existing touch points and to
visually debug that, we need the touchpoints to be drawn over the tool.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: draw other buttons in the debug-gui
Peter Hutterer [Tue, 12 Feb 2019 04:46:58 +0000 (14:46 +1000)]
tools: draw other buttons in the debug-gui

Buttons that aren't lmr are drawn in a separate button square now with the
name as it comes from the kernel. This only handles one button at a time, but
it'll do for debugging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: debug-gui: move the lmr button handling into a substruct
Peter Hutterer [Tue, 12 Feb 2019 00:05:25 +0000 (10:05 +1000)]
tools: debug-gui: move the lmr button handling into a substruct

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: debug-gui: show cancelled touches as unfilled circles
Peter Hutterer [Wed, 6 Feb 2019 23:30:46 +0000 (09:30 +1000)]
tools: debug-gui: show cancelled touches as unfilled circles

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: remove hwdb leftovers
Peter Hutterer [Wed, 13 Feb 2019 04:33:35 +0000 (14:33 +1000)]
test: remove hwdb leftovers

We don't write hwdb entries anymore, so let's drop any reference to it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: fix typo in comment
Peter Hutterer [Wed, 13 Feb 2019 04:31:30 +0000 (14:31 +1000)]
touchpad: fix typo in comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agogitlab CI: update arch linux source image
Peter Hutterer [Tue, 12 Feb 2019 23:28:17 +0000 (09:28 +1000)]
gitlab CI: update arch linux source image

The old one is deprecated (and removed), new one is archlinux/base which also
now requires the diffutils package.

The new one apparently doesn't come with /var/cache/pacman/pkg and it's
not created, so pacman clean exits with an error, breaking the build.
Simply create that directory and everything is hunky, though dory remains
elusive.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: cancel the arbitration timer on device remove
Peter Hutterer [Thu, 7 Feb 2019 02:02:50 +0000 (12:02 +1000)]
fallback: cancel the arbitration timer on device remove

When the touch arbitration is reset to ARBITRATION_NOT_ACTIVE, the proximity
timer is set for 90ms to avoid erroneous touches (see 2a378beab for the
reason).

If the device is removed within those 90ms, the timer is never cancelled,
leading to an assert on cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotimer: print the timers still in the list before the assert
Peter Hutterer [Wed, 6 Feb 2019 23:36:08 +0000 (09:36 +1000)]
timer: print the timers still in the list before the assert

Helps a lot with debugging if we know which timer is still there during
cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoDrop the AS_MASK macro, replace with bit
Peter Hutterer [Thu, 7 Feb 2019 04:15:38 +0000 (14:15 +1000)]
Drop the AS_MASK macro, replace with bit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoAdd a bit() macro
Peter Hutterer [Wed, 6 Feb 2019 05:29:23 +0000 (15:29 +1000)]
Add a bit() macro

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoinclude: add MT_TOOL_DIAL to freebsd's input.h
Peter Hutterer [Thu, 7 Feb 2019 23:13:27 +0000 (09:13 +1000)]
include: add MT_TOOL_DIAL to freebsd's input.h

Missing from 6d683213dbbf17ee0e03138802bb071efb6944cd

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopath: limit path device nodes to PATH_MAX characters
Peter Hutterer [Fri, 8 Feb 2019 01:08:36 +0000 (11:08 +1000)]
path: limit path device nodes to PATH_MAX characters

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoudev: restrict the seat ID to 256 characters
Peter Hutterer [Fri, 8 Feb 2019 01:07:15 +0000 (11:07 +1000)]
udev: restrict the seat ID to 256 characters

Anything longer than that is likely a bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoquirks: add a quirk for the Lenovo L380 (Yoga) clickpad
Pascal Kockwelp [Sun, 10 Feb 2019 23:02:28 +0000 (00:02 +0100)]
quirks: add a quirk for the Lenovo L380 (Yoga) clickpad

5 years agomeson.build: define HAVE_LOCALE_H
Peter Hutterer [Tue, 5 Feb 2019 00:04:56 +0000 (10:04 +1000)]
meson.build: define HAVE_LOCALE_H

Regression introduced in 99bb0ee7cb35f7d7a932e7cf28885782bad17613,
HAVE_LOCALE_H isn't defined by default, we need to set it manually.

Reported-by: Pascal Kockwelp
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoudev: drop unused function
Peter Hutterer [Thu, 7 Feb 2019 05:00:39 +0000 (15:00 +1000)]
udev: drop unused function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: fix a a compiler warning
Peter Hutterer [Thu, 7 Feb 2019 04:58:59 +0000 (14:58 +1000)]
evdev: fix a a compiler warning

Implicit enum conversion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopad: rename the include guard
Peter Hutterer [Wed, 6 Feb 2019 04:12:56 +0000 (14:12 +1000)]
pad: rename the include guard

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofilter: drop an unused function and an unused struct
Peter Hutterer [Wed, 6 Feb 2019 04:07:37 +0000 (14:07 +1000)]
filter: drop an unused function and an unused struct

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: fix a comment typo
Peter Hutterer [Tue, 5 Feb 2019 23:05:48 +0000 (09:05 +1000)]
fallback: fix a comment typo

5 years agoquirks: add a quirk to ignore unreliable tablet mode switch devices
Peter Hutterer [Wed, 16 Jan 2019 00:05:59 +0000 (10:05 +1000)]
quirks: add a quirk to ignore unreliable tablet mode switch devices

On the Asus Vivobook Flip 14, the tablet mode switch is unreliable and always
on. Instead of marking every device as 'do not suspend', just mark the tablet
switch itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: Rename some debouncing functions for consistency
Benjamin Poirier [Fri, 4 Jan 2019 07:20:48 +0000 (16:20 +0900)]
evdev: Rename some debouncing functions for consistency

All other similar functions are named with the "_handle_event" postfix.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: up the ratelimit tests to 1000ms
Peter Hutterer [Sun, 3 Feb 2019 23:56:45 +0000 (09:56 +1000)]
test: up the ratelimit tests to 1000ms

This fails too often on the gitlab runners, so let's expand the times.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agomeson.build: gnu90 alias for gnu89 may not be supported
Jan Beich [Sun, 3 Feb 2019 09:27:33 +0000 (09:27 +0000)]
meson.build: gnu90 alias for gnu89 may not be supported

cc1: error: unrecognized command line option "-std=gnu90"

5 years agotablet: add tilt-based touch arbitration for screen tablets
Peter Hutterer [Fri, 28 Sep 2018 01:47:32 +0000 (11:47 +1000)]
tablet: add tilt-based touch arbitration for screen tablets

If the tilt angle on tip down is not 0 set the touch arbitration to a
rectangle around the assumed position of the hand. This assumed position is
right of the tip for a rightwards tilt and left of the tip for a leftwards
tilt (i.e. left-handed mode). The rectangle is 200x200mm with a 20x50mm
NW of the tip or NE for left-handed. In other words, if the period below is
the tip, the rectangle looks like this:

    +-----------+                          +-----------+
    | .  | <- for rightwards tilt   |         . |
    |           |                          |           |
    |           |                          |           |
    |           |    for leftwards tilt -> |           |
    +-----------+                          +-----------+

Touches within that rectangle are canceled, new touches are ignored. As the
tip moves around the rectangle is updated but touches are only cancelled on
the original tip down. While the tip is down, new touches are ignored in the
exclusion area but pre-existing touches are not cancelled.

This is currently only implemented in the fallback interface, i.e. it will
only work for Cintiqs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: add a rectangle to the touch arbitration
Peter Hutterer [Wed, 19 Sep 2018 02:02:51 +0000 (12:02 +1000)]
evdev: add a rectangle to the touch arbitration

This enables us to specify the location that needs to be arbitrated, rather
than just disabling the whole device altogether. This patch just adds the
hooks, no implementation.

This is internal API only, one backend can specify an area in mm which gets
converted to device coordinates in the target device and arbitrated there.
Right now, everything simply passes NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: force the palm state to PALM_NONE on touch begin
Peter Hutterer [Fri, 28 Sep 2018 04:10:48 +0000 (14:10 +1000)]
fallback: force the palm state to PALM_NONE on touch begin

If we don't have tool-based palm detection, make sure our touch is labelled as
"not palm" during touch down. Otherwise that slot remains on palm forever if
it gets tagged as palm through some other means.

This currently has no effect, nothing in the code would label the touch as
palm. This is prep work for better touch arbitration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: introduce a touch arbitration enum
Peter Hutterer [Wed, 19 Sep 2018 02:02:51 +0000 (12:02 +1000)]
evdev: introduce a touch arbitration enum

This enables us to change the types of touch arbitration, with the focus on
allowing location-based touch arbitration as well as the more generic "disable
everything".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add a LITEST_DIRECT feature for the wacom cintiqs
Peter Hutterer [Tue, 8 Jan 2019 05:37:52 +0000 (15:37 +1000)]
test: add a LITEST_DIRECT feature for the wacom cintiqs

Currently unused, but will be used in later patches

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: add timer-based touch arbitration
Peter Hutterer [Sun, 6 Jan 2019 22:27:22 +0000 (08:27 +1000)]
fallback: add timer-based touch arbitration

When a hand is resting on a pen+touch device, lifting the hand may remove the
stylus from proximity before the hand leaves the surface. If the kernel
performs touch arbitration, this triggers a touch down on proximity out,
followed by a touch up immediately after when the hand stops touching.

This can cause ghost touch events. Prevent this by using a timer-based
arbitration toggle.

Same as 2a378beab032d742770e24a6822378faa90cf1f6 but for the fallback
interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: release all button presses on device suspend
Peter Hutterer [Thu, 31 Jan 2019 01:09:53 +0000 (11:09 +1000)]
touchpad: release all button presses on device suspend

This leaves a bug open, on a Lenovo T440 generation touchpad with top software
buttons, the button will not be leased correctly. This is caused by
device->is_suspended=true by the time we try to clear the state and the
button events thus getting filtered.

This used to affect all touchpads, this patch just moves it so it only affects
the T440-like devices now.

Fixes #233

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add a test for normal touchpad button presses
Peter Hutterer [Thu, 31 Jan 2019 01:55:55 +0000 (11:55 +1000)]
test: add a test for normal touchpad button presses

Probably covered elsewhere in a more generic test anyway but let's have one we
know is executed for all touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: cancel the middle button timer on device removed
Peter Hutterer [Wed, 30 Jan 2019 23:02:58 +0000 (09:02 +1000)]
evdev: cancel the middle button timer on device removed

If a middle-button-emulating device is removed with one button down, the timer
never gets cancelled and triggers an assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add an additional final libinput_dispatch()
Peter Hutterer [Wed, 30 Jan 2019 04:26:31 +0000 (14:26 +1000)]
test: add an additional final libinput_dispatch()

After the test device was removed, run one more libinput_dispatch(). This may
catch some errors that happen due to the device removal that were ignored for
now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: when force-releasing keys, release them directly
Peter Hutterer [Wed, 30 Jan 2019 04:10:28 +0000 (14:10 +1000)]
fallback: when force-releasing keys, release them directly

An emulated button is recorded as BTN_MIDDLE in the key down mask. If the
device is removed in that state, the BTN_MIDDLE event processed triggers
an assertion when we try to send out the event twice.

Fixes #201

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoevdev: cancel the button scroll timer on device removed
Peter Hutterer [Wed, 30 Jan 2019 02:00:47 +0000 (12:00 +1000)]
evdev: cancel the button scroll timer on device removed

If a device was removed while a button was held down and within the timeout,
the timer was never cancelled (and removed from the timer list), triggering an
assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agomeson.build: replace manual checks with cc.has_function()
Peter Hutterer [Wed, 30 Jan 2019 09:37:48 +0000 (19:37 +1000)]
meson.build: replace manual checks with cc.has_function()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agomeson.build: bump to 1.12.900
Peter Hutterer [Wed, 30 Jan 2019 23:46:51 +0000 (09:46 +1000)]
meson.build: bump to 1.12.900

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: Missing test cases for palm detection based on touch size
Furkan Tokac [Sun, 23 Dec 2018 23:52:42 +0000 (01:52 +0200)]
test: Missing test cases for palm detection based on touch size

Missing tests are written.

5 years agoquirks: enforce uppercase hex numbers
Peter Hutterer [Fri, 18 Jan 2019 01:57:55 +0000 (11:57 +1000)]
quirks: enforce uppercase hex numbers

No specific reason other than consistency.

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