Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
2ee2bebb34 test: don't try to print axis values that aren't set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-05 11:28:32 +10:00
Peter Hutterer
6bfc36f9cf Merge branch 'master' into tablet-support 2015-08-04 12:32:00 +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
96d0e06f13 touchpad: disable gestures on Synaptics semi-mt touchpads
Follow-up to eb146677e, if we disable 2fg scrolling on those touchpads we
should also disable gestures. The data doesn't magically become more useful.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-08-03 11:40:17 +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
bae79eff3c test: abort if we trigger a libinput bug message
Only abort on client or libinput bugs, skip over kernel bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-29 19:53:39 +10:00
Peter Hutterer
dfb442be4e test: add missing libinput_dispatch() before timeouts
see 5cec16eede.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-07-29 19:53:39 +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
091206c907 Ignore test devices for libinput contexts not run from the test suite
Add a LIBINPUT_TEST_DEVICE udev parameter to test devices created by
the test suite. When an application tries to add such a device to the
path backend or when the udev backend discovers such a device, it will
be ignored. Only the context when run via the test suite will actually
handle these devices.

Doing this will enable a user to run the libinput test suite on a system
running libinput without having the test suite devices interfering with
the actual system.

Note that X.org users running an input device driver that is not the
libinput X input driver will still need to manually configure the X
server to ignore such devices (see test/50-litest.conf).

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
Jonas Ådahl
5cb1cb47f7 test: Make udev path variables more explicitly named
This is to make room for more types of rules files.

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
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
Jonas Ådahl
6e26493272 test/pointer: Don't rely on velocities in direction change test
We currently rely on an extra millisecond being added by the filter
code to get a velocity that are small enough to not hit the max
acceleration limit. If this arbitrary millisecond is changed (for
example by changing the internal time measurment to microseconds and
adding just a microsecond instead), the velocity may change so that the
maximum or minimum acceleration is always hit.

Adding a delay to the test won't work either since it would not only rely
on ending up within the acceleration limits but there would also be an
non-deterministic actual delay causing the velocity of the movement
after the direction change to be potentially larger than the movement
in the original direction due to the actual time delta in libinput will
not always be 1ms.

To fix the test to not rely on any artificial delays in the filter code
nor any non-deterministic delays in the test, lets just test that the
direction change of the hardware events resulted in a direction change
of the libinput motion events.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 16:15:46 +08:00
Jonas Ådahl
4bd1d5c6d1 test: Use ck_assert_double_ for checking doubles in some places
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 16:15:05 +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
316f30d2f2 touchpad: don't check clickfinger distance for three fingers
It's reasonable to expect a thumb (or the other hand's index finger) to click
a button while a finger is down for movement. It's less reasonable to expect
this when two fingers are interacting with the touchpad, or when two fingers
click the touchpad (even on a large touchpad that's an awkward position).

Simplify the clickfinger detection mechanism - if we have three touches down,
it's always a three-finger click. Two fingers may be a right click or a index
+ thumb click.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-27 11:58:49 +10:00
Peter Hutterer
ed1aee6061 test: don't leak the custom udev rule path for devices with custom creates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-27 11:14:52 +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
a7bd84a7ee Merge branch 'master' into tablet-support 2015-07-24 10:56:05 +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
303565c329 test: fix default axis value assignment
Was assigned to -1 if no custom axes were provided.

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
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
9727b703c3 touchpad: drop TOUCHPAD_HAS_TRACKPOINT_BUTTONS parsing
This was a stopgap measure to support the Lenovo Carbon X1 3rd and the Lenovo
*50 series. These devices have the trackpoint buttons wired to the touchpad
and thus trackpoint events came from the touchpad device.

This was fixed in the kernel commit cdd9dc195916ef5644cfac079094c3c1d1616e4c,
the systemd hwdb to set this property was removed in 05304592457e01 so nothing
sets this property anymore. Drop it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:48:20 +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
e4a43c19b1 test: only initialize the generic rules/hwdb once
Installing the udev rules and reloading udevadm takes around 150ms each
time. For test-pointer alone (currently 336 tests) this adds almost a
minute to the runtime.
The model quirks and libinput udev rules don't change, so installing them once
at the start of the test run is sufficient.

Unfortunately, now that we're not as slow anymore to initialize, we need to
up the maximum wait time for the path device to wait for a udev device to
initialize.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:48:17 +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
ab016fd8ed Tag synaptics serial touchpads with a LIBINPUT_MODEL tag
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
3b73342e34 touchpad: reduce 2fg scroll threshold to 2mm
3mm is too large, especially on fine-grained scroll motions. Since we
already use the hysteresis to defuzz the current touchpad point, having a
slower threshold here should not cause any adverse motions.

This affects the pinch gestures too and needs a minor test adjustment. The
atmel hover device's resolution is low enough that we trigger a >1 degree
angle now, make the movement a bit more finegrained.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-21 16:29:11 +10:00
Thomas Hindoe Paaboel Andersen
c1dbd67f3b Code cleanup
Removes some dead assignments, an unused function, and
uses %d format specifier for int.

Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-20 11:30:06 +10:00
Peter Hutterer
ae32e0a17b Drop vector_length(), replace with hypot(3)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-20 11:18:53 +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