Commit graph

171 commits

Author SHA1 Message Date
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
Peter Hutterer
988f31fc4a Merge branch 'thumb-detect-improvements' 2015-07-24 09:19:08 +10:00
Peter Hutterer
2c78149844 touchpad: put a movement threshold on thumb detection
If a thumb moves around, it's not resting and we should consider it a normal
touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:50:23 +10:00
Peter Hutterer
8ba5b9cbf9 test: only run 3-slot test for touchpads with three slots
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:50:22 +10:00
Peter Hutterer
689632cd0a touchpad: only try thumb detection in the lowest 15/8mm
That's the most likely area it will be resting in, if it's sitting anywhere
above that it's likely part of an interaction.

A thumb in the lowest 15mm needs to trigger the pressure threshold before it's
labelled a thumb. A thumb in the lowest 8mm is considered a thumb if it
remains there for 300ms. Regardless of the pressure, since we can't reliably
get pressure here. If a thumb moves out of the area, or starts outside of that
area it is never a thumb.

If edge scrolling is enabled, the 8mm threshold is ineffective since we'll
have normal interaction in that zone for horizontal scrolling.

The thumb tests now require all touchpads to be switched to clickfinger, if we
test for thumb detection on the bottom of the pad we won't get expected
motion events due to the software button area.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:50:17 +10:00
Peter Hutterer
5571f2d2cc touchpad: hook up disable-while-typing configuration
This is not a frequent toggle, so we don't need to jump through too many hoops
here. We simply enable/disable on command and once any current timeouts have
expired the new setting takes effect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:49:25 +10:00
Peter Hutterer
2a11010467 test: split button tests into separate binary
We're again hitting the fork ulimits again (see also 9c2afae14) causing test
case failures in the valgrind run of the touchpad test.
Split out the touchpad button tests so we don't require special ulimits on
test boxes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:48:19 +10:00
Peter Hutterer
6352b0175d Merge branch 'edge-scroll-on-edge-only' 2015-07-23 14:50:06 +10:00
Peter Hutterer
cbde0894ee Merge branch 'serial-synaptics-cursor-jump' 2015-07-23 10:34:03 +10:00
Peter Hutterer
fbc9be1909 Merge branch 'reduce-motion-thresholds' 2015-07-23 10:28:49 +10:00
Peter Hutterer
d3b9302187 touchpad: only edge-scroll while the finger is in the edge area
When the touch leaves the area for edge scrolling after starting to scroll,
discard any movement. This signals to the user that they've left the area and
forces them to lift the finger to switch back to motion. If the finger moves
back into the area, scrolling continues.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-23 10:26:22 +10:00
Peter Hutterer
3948cb9048 test: enable 2fg scrolling on most palm tests
edge scrolling disables some palm detection, so we can't run those tests when
active. That fell through the cracks so far, all devices with edge scroll by
default were too small to enable palm detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-22 16:20:48 +10:00
Peter Hutterer
2447f3862c test: fix hover test to avoid the edge scroll zone
On the synaptics hover device where this test is run, we'd eventually get into
the edge scroll zone. When edge scrolling is enabled this causes the test to
fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-22 16:20:48 +10:00
Peter Hutterer
d4ceb671b9 touchpad: handle serial synaptics slot confusion on TRIPLETAP
Synatics touchpads only have 2 slots, but support TRIPLETAP and above. When
the third finger touches, the kernel may end the second slot and re-start it
with the coordinates of the third touch in the next frame. The event sequence
is something like:

ABS_MT_SLOT          0
ABS_MT_POSITION_X    4000
ABS_MT_POSITION_Y    4000
ABS_MT_PRESSURE      78
ABS_MT_SLOT          1
ABS_MT_TRACKING_ID   -1

ABS_X                4000
ABS_Y                4000
ABS_PRESSURE         78
BTN_TOOL_DOUBLETAP   0
BTN_TOOL_TRIPLETAP   1
--- SYN_REPORT (0) ----------
ABS_MT_SLOT          0
ABS_MT_POSITION_X    4000
ABS_MT_POSITION_Y    4000
ABS_MT_PRESSURE      78
ABS_MT_SLOT          1
ABS_MT_TRACKING_ID   55
ABS_MT_POSITION_X    2000
ABS_MT_POSITION_Y    2000
ABS_MT_PRESSURE      72

ABS_X                4000
ABS_Y                4000
ABS_PRESSURE         78
--- SYN_REPORT (0) ----------

libinput usually ignores any BTN_TOOL_* <= num_slots since we expect
that the slot values are valid. Make an exception for the serial synaptics
touchpads. If a touch has ended when the fake touch goes above active-slots
(but still within num-slots), move that touch back to UPDATE. This ensures the
right number of nfingers_down. When the touch restarts again in the next
frame, tp_begin_touch() will skip over re-initializing it because it's already
in UPDATE anyway.

Note that at this point this only handles the transition _to_ TRIPLETAP, not
from TRIPLETAP to DOUBLETAP. Need to wait for this to be seen in the wild
first.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-22 13:53:09 +10:00
Peter Hutterer
32ea86559b test: only run 3-slot test for touchpads with three slots
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-22 12:06:45 +10:00
Peter Hutterer
7e9ef68dd6 touchpad: scale thumb pressure threshold with the resolution
On touchpads with a higher resolution we also see higher pressure values.
Scale accordingly, but use the T440s as reference and don't go below that
device's threshold. A false positive is worse than a false negative when it
comes to thumb detection.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-22 09:55:12 +10:00
Peter Hutterer
7a6026104b touchpad: use the top-most touch for fake finger positions
The average human hand has four fingers but only one thumb, i.e. the chance of
a fake finger being close to the top-most touch is higher than to whatever the
first touch was (which may be a thumb at the bottom of the touchpad).
So search for the top-most real touch and copy its position into the fake
touches.

This also fixes another bug with the previous code - the first slot may not be
active but we still used its position for the fake touches. Whether that was
really triggerable is questionable though.

The test is only run for the T440 touchpad - we know it's big enough to
enable thumb detection and that way we don't have to double-check in the how
big the touchpad is, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-22 08:59:24 +10:00
Peter Hutterer
f6bef12bfa touchpad: ignore thumbs when counting clickfingers
We may have four fingers on the touchpad - three real ones + a thumb. Count it
as three-finger click then.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-22 08:59:22 +10:00
Peter Hutterer
058d05e589 touchpad: only enable thumb detection on clickpads
The use-case we have thumb detection for is to let a user rest a thumb on the
touchpad before clicking. On a touchpad with physical buttons, the thumb won't
be resting on the touchpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-21 16:35:31 +10:00
Peter Hutterer
c06a173e58 touchpad: skip thumb detection for touchpads smaller than 50mm
Gets a bit cramped if you're trying to rest the thumb on a touchpad that
small.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-21 16:35:31 +10:00
Peter Hutterer
9d0c767122 touchpad: reduce unpin threshold to 1.5mm
3mm is too large, it makes the touchpad feel sluggish. We already take fuzz
into account through the hysteresis and the real issue we have with the
pointer moving on a click is _before_ the BTN_LEFT event comes in, not after.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-21 16:29:12 +10:00
Peter Hutterer
ecda01eb4c test: add 3fg and 4fg clickfinger tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-20 11:18:03 +10:00
Peter Hutterer
35fb5412c5 test: remove some excessive linebreaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-13 15:41:13 +10:00
Peter Hutterer
55435a707f test: add an Apple Magic Trackpad test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-13 09:11:13 +10:00
Peter Hutterer
74a8d6546e test: move finger position to test for right button down
On large touchpads with resolution, 90% of the touchpad may be north of the
button.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-13 09:11:13 +10:00