Commit graph

195 commits

Author SHA1 Message Date
Peter Hutterer
0e820d466f Remove a couple of double semicolons
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7b3e583abe)
2017-01-13 10:45:17 +10:00
Peter Hutterer
a89619d792 touchpad: if an external touchpad and keyboard share a VID/PID assume dwt
This requires to expand the blacklisting to be a bit more specific so we don't
initialize dwt config on devices that won't need it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 0a82d2fa39)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-13 10:45:17 +10:00
Peter Hutterer
9835acf7c7 touchpad: sync BTN_TOOL_FINGER state on init
The Elantech touchpad on my Asus Vivobook doesn't release BTN_TOOL_FINGER on
up. If the touchpad was used before libinput initializes, the kernel filters
the event because its state is already set. We never receive it and keep
ignoring all events until the first switch to BTN_TOOL_DOUBLETAP and back.

On touchpad init sync the BTN_TOOL_FINGER state and set it accordingly. This
is the only event that can be legitimately down on init. We don't care about
BTN_TOUCH because ignoring an ongoing touch on init is generally a good idea
and we can ignore any multifinger gesture as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 5552a6f145)
2016-12-06 17:39:04 +10:00
Peter Hutterer
4fe85b736a test: fix edge-scroll no-motion test
The test is supposed to make sure no motion event is sent and that scrolling
continues once leaving the edge. It does so by moving down the edge, into the
touchpad, then down further. The move from the edge into the touchpad had a
vertical component to it though and could cause the scroll minimum test to
fail. This is currently covered up by the delta calculations though, but fix
it anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-22 11:23:39 +10:00
Peter Hutterer
5bc29e9a51 test: fix clang warning about abs(float)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-25 10:00:58 +10:00
Peter Hutterer
38a562e485 test: rename SYNAPTICS_CLICKPAD to SYNAPTICS_CLICKPAD_X220
That's where this device comes from. The x220 is special because it's too
small to trigger some of the features, eg. palm detection. Make this more
obvious by changing to a less generic name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-09 12:54:01 +10:00
Peter Hutterer
8fad73b67a test: add test for touchpad disabling on external mouse
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-05 10:48:59 +10:00
Peter Hutterer
aa87d2b25b touchpad: always reset the motion history on finger changes
We've already been doing this for semi-mt devices and for non-clickpads but
let's do it for clickpads as well. On Synaptics touchpads (PS/2 and RMI4)
we see slot jumps where two slots are active, slot X ends but slot Y continues
with the other slot's positional data. This causes a cursor jump on finger
lift after a two-finger scrolling motion. Simply resetting the motion history fixes it.

The only multi-finger interaction where a user could expect perfect fluid
motion is when using a second finger to touch cone of the software button
areas. Let's see if we have complaints first before we implement something
more complex.

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

Signed-off-by:Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-29 20:10:50 +10:00
Peter Hutterer
b1a811ee52 touchpad: reset the edge scroll state on touch up if edge scroll is disabled
If a touch was down (and up again) before the device was switched to edge
scrolling, libinput reported an error message:
  litest error: libinput bug: unexpected scroll event 0 in area state

While edge scrolling was disabled, any new touch would be set to the area
state but it was never reset on touch release.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-23 07:07:55 +10:00
Peter Hutterer
96b3489f23 Merge branch 'wip/litest-serial-parallel-v3' 2016-08-09 11:18:27 +10:00
Peter Hutterer
1ea9fbfd4c touchpad: ignore modifier key combos for dwt
Inspired by the syndaemon -K switch and Anton Lindqvist's patch.
https://patchwork.freedesktop.org/patch/102417/

We already ignored modifiers for dwt. Now we also ignore modifier + key
combinations, i.e. hitting Ctrl+s to save does not trigger dwt, the touchpad
remains immediately usable.

However, if dwt is already active and a modifier combination is pressed, dwt
remains active, i.e. while typing, a shift + key does not disable dwt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-05 07:35:10 +10:00
Peter Hutterer
114021a6c1 test: add dwt modifier/fkey test cases
dwt shouldn't trigger on those keys

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-04 12:57:02 +10:00
Peter Hutterer
35b28b1af3 test: merge all tests into a single binary
Call it a libinput-test-suite-runner, in subsequent patches we'll handle doing
parallel tests ourselves instead of relying on automake features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
8e7f99c27a touchpad: don't init a horizontal scroll area on touchpads <50mm high
We simply don't have enough space on those touchpads to have an area carved
out for horizontal scrolling. Given that horizontal scrolling is rarely needed
anyway users of these touchpads will just have to cling to scroll bars or use
two-finger scrolling.

Exception are small clickpads because they already have an area blocked off
for software buttons and those small clickpads generally come from a time when
clickfinger wasn't much of a thing yet.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-07-15 10:47:29 +10:00
Peter Hutterer
ef3c7437ef test: split edge scroll tests into one for vert, one for horiz
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-07-15 09:18:44 +10:00
Peter Hutterer
89747d7143 Revert "touchpad: reset the motion history on significant negative pressure changes"
We will reinstate the hysteresis for all devices making the negative
pressure check unncessary.

This reverts commit ef48c07a96.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:23:51 +10:00
Peter Hutterer
dd73c5391e Revert "test: add a test for the T450 dropped motion events"
This reverts commit b5527fa4c7.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:23:40 +10:00
Peter Hutterer
7860a9ed77 touchpad: stop palm detection when a second finger is detected
This avoids accidental palm detection during two-finger scrolling if one
finger is inside the edge exclusion zone.

Palm detection is designed to avoid accidental touches while typing. If a
non-palm finger is on the touchpad already the user is unlikely to be typing.
So stop palm detection in this case and process the fingers as normal.

This implementation has a minor bug: if both palm touches start within the
palm exclusion zone within the same frame, neither will be labelled as palm
due to how we check the other touches. Since this is an extremeley niche case
we can live with that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-15 10:23:18 +10:00
Peter Hutterer
f6fc03ab12 test: fix a couple of touchpad tests that triggered the cursor jump warning
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-19 09:06:36 +10:00
Peter Hutterer
6a22eed4ef touchpad: detect and warn about kernel tracking pointer jumps
If a touch moves by more than 20mm within a single frame, reset the motion
history, effectively discarding the movement. This is a relatively common bug
and almost always needs a kernel fix, so add an explanatory page to the docs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-28 10:01:20 +10:00
Peter Hutterer
774be50e68 test: use a few more events for some of the tests with large pointer movements
Don't move across the touchpad in one single event, it looks like a cursor
jump that we're trying to detect in future patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-28 10:01:20 +10:00
Jonas Ådahl
240d669bba test: Handle 32 bit msec time overflows
The libinput_*_get_time() returns a 32 bit unsigned integer, but in the
tests we compared them to a 64 bit unsigned integer. This means that
when the 32 bit integer overflowed, we'd still compare to a
non-overflowed 64 bit integer, causing the tests to fail.

This commit fixes this by always casting the millisecond 64 bit unsigned
integer to a 32 unsigned integer, triggering the same overflow.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:25 +10:00
Peter Hutterer
aa90121125 touchpad: reset the motion history on significant negative pressure changes
Resetting the motion history has the side-effect of swallowing movements, we
don't calculate deltas until we have 4 motion events. During a finger release,
we're likely to get a large pressure change between two events, resetting the
motion history prevents the cursor from jumping on release.

The value of 7 found by trial-and-error, tested on the T440 and T450 hardware.
The absolute value is highly variable but recordings show that the pressure
changes only by 1 or 2 units during normal interaction. Higher pressure
changes are during finger position changes but since those should not cause a
jump anyway, we tend to win there too.

Currently only enabled for negative pressure changes, let's see how we go with
that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-30 14:07:26 +10:00
Peter Hutterer
b5527fa4c7 test: add a test for the T450 dropped motion events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-30 11:10:12 +10:00
Peter Hutterer
79139ebcd1 touchpad: move the tapping exclusion zone to the top edge of the button
We previously used the half-way mark of the touchpad's y axis to decide where
to ignore tapping. Move this down to the top edge of the software buttons
instead. Users may tap with a finger in the software button areas, on the rest
of the touchpad it's unlikely that they tap within 5% of the edge.

On touchpads with physical buttons or if clickfinger is enabled, the
no-tapping zone extends to the bottom of the touchpad. This required splitting
the tests into clickfinger, softbuttons and hardbuttons.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-18 10:38:20 +10:00
Peter Hutterer
0e87dc9af2 touchpad: fix dwt disabling while a key is still down
If dwt is disabled on the commandline, e.g. by setting an xinput property it
may be disabled before the release event comes in. This caused the timer to
refresh indefinitely since the key state mask was still on for that key.
Always updating the key state mask (even when dwt is disabled) fixes that.

If a key is held down while dwt is disabled, this can still cause a indefinite
timer refresh, so in the timer func, check if dwt is enabled before refreshing
the timer.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-09 07:40:04 +10:00
Peter Hutterer
0b0150e08d touchpad: if we have a serio keyboard, override any previous dwt pairing
If a USB keyboard like the YubiKey is found before the internal keyboard, it
will be paired with the touchpad when it is seen. The internal keyboard is
seen later bug ignored because we already have a keyboard paired with the
touchpad.

This is obviously wrong. For now, give priority to serio keyboards, and
override existing dwt pairings with the new keyboard.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-05 07:43:25 +10:00
Peter Hutterer
b27f04689e touchpad: while a key is held down, don't disable dwt
If a key enables dwt and is held down when the timeout expires, re-issue the
timeout.

There is a corner case where dwt may not work as expected:
1. key down and held down
2. dwt timer expires, dwt is re-issued
3. touch starts
4. key is released
5. dwt timer expires
6. touch now starts moving the pointer

This is an effect of the smart touch detection. A touch starting after the
last key press is released for pointer motion once dwt turns off again. This
is what happens in the above case, the dwt timer expiring is the last virtual
key press. This is a corner case and likely hard to trigger by a real user.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-05 07:40:51 +10:00
Peter Hutterer
c352a50295 test: exclude semi-mt devices from the normal 2fg scroll test
We have a specific semi-mt 2fg scroll test for those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-04 15:12:55 +10:00
Peter Hutterer
d76dc643cd test: fix call to test_2fg_scroll
Last argument is a boolean whether we want to have a tap timeout. It used to
be the ms to sleep, obsolete since e4adbff919

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-01 12:14:09 +10:00
Peter Hutterer
a4adea1646 Merge branch 'wip/3-finger-pinch-gesture' 2016-01-20 15:38:17 +10:00
Peter Hutterer
d9e1b2603e test: change semi-mt 2fg scroll test to use two-finger movement
As we implement more gestures, we will drop two-finger scrolling performed by
only a single finger movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Caibin Chen
b3f11180e3 touchpad: fix DWT pairing for Macbook Pro 2015
Label internal keyboards through the udev hwdb and only pair the internal
(usb) Apple touchpads with those keyboards labelled as such.

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

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-11 10:11:32 +10:00
Peter Hutterer
8d76734fb6 test: change extra axes to take a percentage as well
More flexible than having values that are device-specific.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-10 19:02:45 +10:00
Peter Hutterer
147162da69 touchpad: don't set the axis for a 0.0 value in a scroll event
Once we trigger diagonal scrolling, the device's scroll direction is set as
horiz+vert. From then on, both axes will be set on every subsequent scroll
event, even when the actual delta for an axis is 0.

This causes continuous scroll stop events in clients that care about these
things.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 13:13:16 +10:00
Peter Hutterer
eb1197899e touchpad: don't try to position fake touches when no fingers are down
If all fingers are released in the same frame, we won't be able to find the
top-most touch.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:35:09 +10:00
Peter Hutterer
5d191d10e7 Add a missing closing ) in a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-02 10:49:09 +10:00
Peter Hutterer
168c61920c test: fix edge scroll timeout test
This test is supposed to test for the timeout kicking in on edge scrolling -
if the finger is in the edge for longer than the timeout, we switch to
scrolling without requiring the motion threshold to be met first.

To emulate this, move the finger ever so slightly first to load up the motion
history, then timeout, then move. We expect a bunch of motion events with a
small delta.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-20 07:57:14 +10:00
Peter Hutterer
c7b11644c6 test: use the touchpad size for the 7mm movement
Makes the code more straightforward, and we now require the devices to
have a height/width anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-20 07:57:14 +10:00
Peter Hutterer
0cd54c5987 touchpad: enable natural scrolling for edge scrolling
Instead of going straight to pointer_notify_axis, go through
evdev_notify_axis() which flips the scroll direction around for us.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-12 08:33:02 +10:00
Peter Hutterer
2fdf71f82b Merge branch 'disable-gestures-semi-mt' 2015-08-03 11:40:37 +10:00
Peter Hutterer
7013a20f8b touchpad: pretend the jumpy semi-mt touchpad is a single-touch touchpad
The first finger is accurate, it's just the second finger that is imprecise,
so we can't handle it as a true touch. Instead, revert the device back to
being a single-touch touchpad and use the fake touch bits for second finger
handling.

Two-finger scrolling thus becomes usable though we will lose out on
other features like thumb detection. Useful scrolling trumps that though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-03 11:40:29 +10:00
Peter Hutterer
cbc0b20793 test: fix test case failure caused by belated timer
See 5cec16eede

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-03 11:19:54 +10:00
Peter Hutterer
2dd1b3ead0 test: move the helper functions to the litest.h file
To avoid duplication

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-31 09:14:21 +10:00
Peter Hutterer
5cec16eede test: add a bunch of libinput_dispatch() before timeout calls
98346f6a1a added a warning about timeouts expiring before now. Those warnings
are triggered by a bunch of tests where we have events, then a timeout, then a
libinput_dispatch().

All these are bugs in the test, since we can't guarantee the order of fds (and
thus which fd the events are pulled off first) it's just lucky that they worked.
Insert the required libinput_dispatch() calls.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-29 09:52:28 +10:00
Jonas Ådahl
aa5f55149b Change to micro seconds for measuring time internally
In order to provide higher precision event time stamps, change the
internal time measuring from milliseconds to microseconds.
Microseconds are chosen because it is the most fine grained time stamp
we can get from evdev.

The API is extended with high precision getters whenever the given
information is available.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 17:42:32 +08:00
Peter Hutterer
eb146677eb touchpad: disable 2fg scrolling on Synaptics semi-mt touchpads
These touchpads have a terrible resolution when two fingers are down, causing
scrolling to jump around a lot. That then turns into bug reports that we can't
do much about, the data is simply garbage.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-27 19:34:42 +10:00
Peter Hutterer
b4f27c43d9 test: rename 2fg natural scroll test to be more obvious
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-27 10:40:07 +10:00
Peter Hutterer
a5e2e23870 test: enable 2fg scrolling before tests that rely on it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-27 10:39:21 +10:00
Peter Hutterer
f2aefb9942 test: filter out edge-scroll-only touchpads from 2fg scroll tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-27 10:39:06 +10:00