Commit graph

195 commits

Author SHA1 Message Date
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
Peter Hutterer
fa67be9e3c test: reduce movement of finger while pinned
Otherwise the test fails on large touchpads with resolution (magic trackpad).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-13 09:11:09 +10:00
Peter Hutterer
3734a67eef test: slow down 2fg slow scroll movement
To avoid test case failures when we switch to forced resolutions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-10 11:43:42 +10:00
Peter Hutterer
cc59c8986f test: add touchpad thumb detection tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-09 11:27:53 +10:00
Peter Hutterer
7d314738fb touchpad: be smarter about clickfinger thumb detection
Watching a colleague try clickfinger right-click after enabling it the first
time showed that the vertical distance is too small. Increase it to 30mm
instead.

Increase the allowed spread between fingers to 40x30mm, but check if one of
the fingers is in the bottom-most 20mm of the touchpad. If that's the case,
and the touchpad is large enough to be feasable for resting a thumb on it,
discard the finger for clickfinger count.

If both fingers are in that area or one finger is in the area and they're
really close together, the fingers count separately and are not regarded as
thumb.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-09 11:24:17 +10:00
Peter Hutterer
abff4a1c24 touchpad: allow edge scrolling on clickpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-09 11:24:17 +10:00
Peter Hutterer
77aca3c194 test: add helper function for enabling click methods
Makes the test code easier to read. In tests where we explicitly check the API
the real calls were left in place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-09 11:24:17 +10:00
Peter Hutterer
9a8238836e test: move enable_edge_scroll up
No functional changes, just so we can group those helpers together.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-09 11:24:17 +10:00
Hans de Goede
ad26785f6a touchpad: Implement pinch gesture support
Implement touchpad pinch (and rotate) gesture support.

Note that two two-finger scrolling tests are slightly tweaked to assure that
there is enough touch movement to allow the scroll-or-pinch detect code to do
its work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-07-06 14:09:33 +10:00
Peter Hutterer
3fcdba6ca6 test: replace tap config with helper function
No functional change, other than that we check for status codes now too.
In tests that don't specifically check the interface itself, a short
enable_tap() or disable_tap() is a lot more obvious to parse for the reader.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-23 14:24:29 +10:00
Peter Hutterer
51b694e282 touchpad: disable right-edge palm detection for edge scrolling
Most scroll motions would be labelled a palm.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-22 08:07:12 +10:00
Peter Hutterer
9c2afae146 test: move tapping tests into a separate binary
The previous set hit _some_ sort of limit, but no idea what or why. When
adding one more test, the touchpad test case would reliably fail with a udev
timeout in litest_wait_for_udev(). This only happened in the valgrind case,
the normal run succeeded. Reproduced on three different installations (2 vms
on two different hosts).

Move the tapping tests into a separate binary, this unwedges whatever was
unhappy and sunshine, lollipops and rainbows are distributed generously.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-22 08:07:07 +10:00
Peter Hutterer
83015f9dca test: switch clickpad multitap to a ranged test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-18 13:36:22 +10:00
Peter Hutterer
bc9f16b40e COPYING: Update boilerplate from MIT X11 to MIT Expat license
To quote Bryce Harrington from [1]:
"MIT has released software under several slightly different licenses,
including the old 'X11 License' or 'MIT License'.  Some code under this
license was in fact included in X.org's Xserver in the past.  However,
X.org now prefers the MIT Expat License as the standard (which,
confusingly, is also referred to as the 'MIT License').  See
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

When Wayland started, it was Kristian Høgsberg's intent to license it
compatibly with X.org.  "I wanted Wayland to be usable (license-wise)
whereever X was usable."  But, the text of the older X11 License was
taken for Wayland, rather than X11's current standard.  This patch
corrects this by swapping in the intended text."

libinput is a fork of weston and thus inherited the original license intent
and the license boilerplate itself.

See this thread on wayland-devel here for a discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-May/022301.html

[1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022552.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2015-06-16 14:36:04 +10:00
Peter Hutterer
8025b374d5 touchpad: set the finger pin distance to 5mm where possible
On touchpads with resolutions, use a 5mm motion threshold before we unpin the
finger (allow motion events while a clickpad button is down). This should
remove any erroneous finger movements while clicking, at the cost of having to
move the finger a bit more for a single-finger click-and-drag (use two fingers
already!)

And drop the finger drifting, it was per-event based rather than time-based.
So unless the motion threshold was hit in a single event it was possible to
move the finger around the whole touchpad without ever unpinning it.

Drop the finger drifting altogether, if the touchpad drifts by more than 5mm
we have other issues.

https://bugzilla.redhat.com/show_bug.cgi?id=1230462

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-16 10:18:48 +10:00
Peter Hutterer
8af1f4b085 touchpad: on non-resolution touchpads, use 30% as maximum clickfinger spread
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Peter Hutterer
df83144457 touchpad: impose maximum distance limits on clickfingers
A common use-case for clickfinger is to use the index finger for moving the
pointer, then triggering the click with a thumb. If the index finger isn't
lifted before the click this counted as two-finger click.

To avoid this, check the distance between touches on the touchpad (on
touchpads reporting resolution values anyway). If the touches are too far
apart, don't count them together (or specifically only count those close
enough together as multi-finger).

The touch area is uneven, it's wider than high. Spreading fingers horizontally
is more common and this also makes it easier to rule out thumbs which tend to
be well below the fingers.

http://bugs.freedesktop.org/show_bug.cgi?id=90526

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Peter Hutterer
289e4675c8 filter: enforce minimum velocity
In the current code, a timeout or direction change on the first tracker will
result in a velocity of 0. Really slow movements will thus always be zero, and
the first event after a direction is swallowed.

Enforce a minimum velocity:
In the case of a timeout, assume the current velocity is that of
distance/timeout. In the case of a direction change, the velocity is simply
that since the last tracker.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 09:03:07 +10:00
Peter Hutterer
0dc058a0c7 touchpad: touches after the last key press can be released
The current code labels a touch as palm if it started within the typing
timeouts. To move the pointer even after the timeout expires, a user has to
lift the finger which is quite annoying and different to the old synaptics
driver behaviour (which had a simple on/off toggle on whether to let events
through or not).

Be smarter about this: if a touch starts _after_ the last key press event,
release it for pointer motion once the timeout expires. Touches started before
the last key press remain labelled as palms. This makes it possible to rest
the palm on the touchpad while typing without getting interference but also
provides a more responsive UI when moving from typing to using the touchpad
normally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
f85a46b661 touchpad: don't enable edge palm detection on Wacom touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
00c75a2667 test: add disable-while-typing tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
3a7264a03e touchpad: be finer-grained about when to pair touchpads/keyboard for DWT
Check a couple of easy yes/no definitives that cover most Lenovo laptops,
and avoid false positives on Wacoms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
a6be43990c Merge branch 'litest-filter-tests'
The litest-selftest has its own main method and compiles litest.c with special
flags. Use that to ifdef out the litest.c main function, and inline the
litest_run/litest_parse_args functions so gcc doesn't complain about unused
functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 09:15:15 +10:00
Peter Hutterer
9dbeb9d0f7 test: move main() into litest
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:33 +10:00
Peter Hutterer
af4ff07f6b touchpad: sync the initial touch state
Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would
generate a bogus delta on the second event when the touch coordinate jumps
from 0/y or x/0 to the real coordinates.

For touchpads with distance support this is a real issue since the default
value for a touch distance is > 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:48 +10:00
Peter Hutterer
ed5d43da36 Merge branch 'litest-backtrace' 2015-05-21 11:05:45 +10:00
Peter Hutterer
cd163b3b8a Allow disabling tapping on a device without tapping
The doc says this "always succeeds", not "segfaults".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 16:57:47 +10:00