Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
91467f7280 test: add test for the vertical position-dependent pinch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-22 07:26:55 +10:00
Peter Hutterer
0a82d2fa39 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>
2016-12-20 10:21:43 +10:00
Peter Hutterer
b69cfccdca test: use the udev property to check for external/internal touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-20 09:44:10 +10:00
Peter Hutterer
5307051386 test: mark the magic trackpad as external in udev
This should be handled by a udev rule in systemd/hwdb but that rule doesn't
apply to virtual devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-20 08:53:35 +10:00
Peter Hutterer
1f5c5cf2c7 test: don't set LITEST_VERBOSE during make check
I've never had the log output help me identify a bug during a test run. Now
that we run all tests in the same binary the verbosity just leads to a massive
file that makes it hard to find the actual failure. Turn off LITEST_VERBOSE by
default but leave the parsing in for cases where it may come in handy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-12-20 08:53:35 +10:00
Peter Hutterer
8540efc209 test: fix distcheck
Broken in e0b200caa6

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-07 10:28:40 +10:00
Peter Hutterer
5552a6f145 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>
2016-12-06 07:28:15 +10:00
Peter Hutterer
340474857e Whitespace fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-05 15:17:28 +10:00
Peter Hutterer
c3842dfe17 Fix the license for a bunch of tablet test devices
In bc9f16b40e the license was updated from MIT
X11 to MIT Expat, see that commit for details.

These devices came in from the tablet-support branch which didn't get
updated, any new tablet device that used those as templated thus copied the
license. Fix this, make the license text the same as all other files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-12-01 11:12:09 +10:00
Peter Hutterer
5d2501aa7d Drop HAVE_CONFIG_H ifdef
We have one. Yay. Lucky us. Go forth and celebrate.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-12-01 11:06:54 +10:00
Peter Hutterer
4bb3da4115 evdev: init axis range warnings for touch devices too
Move the code from the touchpad code into the more generic evdev code

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-30 08:54:00 +10:00
Peter Hutterer
dbeb2f7916 tablet: reject tablets without resolution
Fix the kernel driver or get a udev override in place. Tablets not having a
physical size is not ok.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-29 11:25:24 +10:00
Peter Hutterer
d308022fb3 util: tighten requirements on the click angle/count properties
Require both of them to be an integer, don't allow for a list or preceding
whitespaces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-29 11:21:39 +10:00
Peter Hutterer
33100fe88d util: add a helper function to split a string into substrings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:39 +10:00
Peter Hutterer
d6020d7ab2 util: add safe_atod for locale-independent conversion
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:38 +10:00
Peter Hutterer
31542ffbfd test: add a device and test for udev-set calibration values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:38 +10:00
Peter Hutterer
a06473221b test: add a test for safe_atoi
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-29 11:21:38 +10:00
Peter Hutterer
b2a6a84da1 test: switch asserts to litest_assert
Gives us a stacktrace when it fails.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-28 11:56:36 +10:00
Peter Hutterer
c9d2d5e3de test: allow the first event to be a short one during scroll tests
The hysteresis cuts the first pointer motion by the hysteresis margin. On some
touchpads this causes the tests to fail when the motion history length is
reduced (future patch). Allow the first event to be smaller than the expected
minimum.

This doesn't trigger in current tests because the hysteresis is per-event and
by the time we get past the minimum 4 events to move the pointer, we're
already flying unaffected by the hysteresis.

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
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
63409a6938 test: start with the first offset when moving touches
This doesn't have an effect in our current tests because the touchpad always
needs 4 motion events to get moving. But for the future, it simplifies the
case of "i want to move between x1/y1 and x2/y2", because it fills in only the
events in between rather than re-using the touch down coordinates and thus not
causing a motion on the first event.

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
ff574d2f5c test: fix maybe-uninitialized compiler warnings
touchpad-tap.c: In function ‘touchpad_3fg_tap_btntool_inverted’:
touchpad-tap.c:1548:2: warning: ‘button’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
and similar

False positive, if button isn't set by now we would've abort()-ed before we
even get here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-22 11:23:39 +10:00
Peter Hutterer
f8c2eb0736 test: mark the various abort functions as noreturn
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-22 11:23:38 +10:00
Peter Hutterer
17c0049d24 Disable test runs on 'distcheck'
The tests require the creation of udev devices which in turn require root and
usually cause distcheck runs to fail. Add a new option to disable the
*running* of tests at distcheck (we still want to build them).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-14 10:14:02 +10:00
Peter Hutterer
58c7a9cbf0 evdev: implement support for the MOUSE_WHEEL_CLICK_COUNT property
Not all mice have a click angle with integer degrees. The new
MOUSE_WHEEL_CLICK_COUNT property specifies how many clicks per full rotation,
the angle can be calculated from that.

See https://github.com/systemd/systemd/pull/4440 for more information

CLICK_COUNT overrides CLICK_ANGLE, so we check for the former first and then
fall back to the angle if need be. No changes to the user-facing API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-04 12:10:52 +10:00
Peter Hutterer
a58a9de70d evdev: actually ignore joysticks
A joystick has ID_INPUT_JOYSTICK *and* ID_INPUT set, so we need to check for
both.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-11-02 21:04:03 +10:00
Peter Hutterer
b1fa57372c test: add missing comma to horizontal click angle udev rule
Without the comma it now assigns the horizontal click angle property to all
devices.

Introduced in b02acd346b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-25 12:11:42 +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
ef2f95dfee Mark some internal log functions as printf-style function
Fixes the respective clang warnings

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
416fa44d80 touchpad: require at least 3 events before enabling trackpoint palm detection
Some trackpoints, notably the one on the Lenovo T460s have a tendency to send
the odd event even when they're not actually used. Trackpoint events trigger
palm detection (see 0210f1fee1) and thus effectively disable the touchpad,
causing the touchpad to appear nonresponsive.

Fix this by requiring at least 3 events from a trackpoint before palm
detection is enabled. For normal use it's hard enough to trigger a single
event anyway so this should not affect the normal use-case.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-12 13:50:15 +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
b519ea4ab5 tablet: add touch arbitration
So far we've relied on the wacom kernel module to do touch arbitration for us
but that won't be the case in upcoming kernels. Implement touch arbitration in
userspace by pairing the two devices and suspending the touch device whenever
a tool comes into proximity.

In the future more sophisticated arbitration can be done (e.g. only touches
which are close to the pen) but let's burn that bridge when we have to cross
it.

Note that touch arbitration is "device suspend light", i.e. we leave the
device enabled and the fd is active. Tablet interactions are comparatively
short-lived, so closing the fd and asking logind for a new one every time the
pen changes proximity is suboptimal. Instead, we just keep a boolean around
and discard all events while it is set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
31fdb7e6b0 test: add litest_assert_touch_sequence helper
Touch sequences are interrupted by TOUCH_FRAME events which makes them
annoying to handle event-by-event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
f73527b8de test: move the Intuos 5 and Cintiq 13HD test tablets into the same device group
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
61e8542d6e evdev: release current touches when the device is suspended
Previously suspending a touch device with at least one touch down would never
release the touch point.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-07 11:17:03 +10:00
Peter Hutterer
df781aad2f test: add trackpoint palm detection tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-07 09:20:15 +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
d686e13338 tablet: if a serial comes in late, discard it
If a tool starts reporting with serial 0 and later updates to a real serial,
discard that serial and keep reporting as serial 0. We cannot really change
the tool after proximity in as we don't know when callers query for the serial
(well, we could know but any well-written caller will ask for the serial on
the proximity in event, so what's the point).

Thus if we do get a serial in and the matching tool, check if we have a tool
with the serial 0 already. If so, re-use that. This means we lose correct tool
tracking on such tablets but so far these seem to only be on devices where the
use of multiple tools is unlikely.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-02 09:10:57 +10:00
Peter Hutterer
3ceb6aeb8c test: change the matrix delta test to use a tip-down event
Makes the test suitable for tablets without proximity capabilities.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-02 09:10:56 +10:00
Peter Hutterer
9550cd47b2 test: add a Wacom HID 4800 test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-09-02 09:10:54 +10:00
Peter Hutterer
3ecd389c94 test: add the valgrind test suite output to the distcleanfiles
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-30 17:50:49 +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
bc9e9267f0 test: prevent cursor jumps in the various tap tests
Probably a copied typo in the original tests, 5 events with 40ms in between
makes less sense than the now-replacement 20 events every 2ms. The previous
one could trigger the cursor jump detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-29 14:12:57 +10:00
Peter Hutterer
ad2a51152f test: only abort when we fail to add any tests and we have no filters
This prevents any tests from being added but not run in the normal setup. But
as soon as filters are manually specified on the list proceed anyway.
Otherwise it's impossible to run specific sets of tests, e.g. things like
running all tests applicable to a specific device with
   --filter-device=foo

Now that all tests are in the same binary we are guaranteed that at least some
tests don't apply, so the above was guaranteed to abort.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-26 14:12:44 +10:00
Peter Hutterer
a43042425e test: add a helper function to compare the event type
New error message prints the human-readable event type, not just the enum
values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-26 14:12:44 +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
b02acd346b Read the horizontal wheel click angle property if available
The Logitech MX master has different click angles for the two wheels.

https://github.com/systemd/systemd/issues/3947

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-22 11:29:35 +10:00
Peter Hutterer
ff1347727e test: implement tests for configurable tap button mappings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15 09:09:38 +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