Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
2df11f8708 test: add an option to skip installing our quirks into the test system
This allows us to run the test suite runner against the installed system
rather than always using the build tree quirks.

The actual option will be removed in a future commit, it is just here for
commit consistency and testing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
d4f5faae0d tools: move the builddir lookup function out to a separate file
We want to use this from the tests as well soon, so let's move it to a more
generic location. This also changes the API to be slightly more sensible, a
free() is the same cost (and safer) than passing a static buffer in and hoping
we didn't get the size wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
cbbd5b15c6 test: split out the unit tests into a separate test suite
All the bits that test for utility functions to work correctly can be run
separately from the main test suite (which tests devices and libinput in
general). These bits here are the ones that test the code itself and aren't
reliant on anything else.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
bda69ad6c6 test: move the double assert macros to a separate header
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
c0f4ede0c2 test: split the library version test out
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
4e0a362803 test: split up the quirks installations
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
27188228fd test: install the test device udev rule from a string
It's a one-liner, we don't need this as a separate file. Plus, this makes the
test suite runner less dependent on the build directory.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
c879b47b38 test: split the test-specific #defines out
These don't need to be in the libinput config.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:04 +10:00
Peter Hutterer
fefddeda4d test: add --help to the test suite runner
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:00 +10:00
Peter Hutterer
5a05e41940 test: clip the exit code to 255
If more than 255 tests fail, we're returning an exit code outside of the POSIX
standard. This only takes effect for -j1, where we fork off we only ever have
a failed value of 1 anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 15:10:15 +10:00
Peter Hutterer
87abdf1f63 test: minor warning message change
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-12 15:10:15 +10:00
Henré Botha
5dae7aac38 Reduce button scroll timeout to 38ms
When using button scrolling, a hardcoded delay of 200 milliseconds between
button down and scroll events being emitted makes fast scrolling gestures feel
clunky and sometimes fail entirely. This feature comes from
xf86-input-mouse, was copied into xf86-input-evdev and reimplemented in
libinput.

This was, as far as can be determined, to allow right clicks without
triggering scrolling. libinput now also has distance triggers (2bbf4a0117)
and sends button events if no movement has happened for long clicks,
regardless of the delay.

The 200ms delay is thus not really necessary anymore, let's drop it to 38ms
which is just above the 3-event threshold for 8/10/12ms intervals which is
most devices.

Fixes #237

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 10:37:05 +10:00
Peter Hutterer
9b18adc407 test: replace != NULL checks with ck_assert_notnull
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-15 08:42:15 +10:00
Peter Hutterer
1228fab87b test: check for a non-null libinput in the new udev_create_seat_too_long test
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-15 08:38:02 +10:00
Peter Hutterer
fb0305321f test: remove unreachable code
When the loop was reduced to BTN_DIGI only, it guaranteed that the BTN_STYLUS
condition was no longer met.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-15 08:35:52 +10:00
Peter Hutterer
19aac0e4be test: add another helper to discard specific events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
067b5be144 test: skip the tablet pressure test if we don't have pressure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
29c82107cc test: fix the tablet relative delta test
These numbers just happened to add up correctly for the motion history to
produce a zero delta for a diagonal movement. Fix it by adding extra events to
flush out any motion history leftovers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
626b5bd00f test: fix the tablet motion test
This test had a loop around the proximity events, so in theory we could've
sent two proximity-in events and still get a positive test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
1f90378421 test: set LITEST_HOVER for all tests that require the hover feature
Where we test for changes on tip state, we need the hover feature

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
11dd646273 test: mark all current tablets as having a hover feature
The totem, also a tablet tool, is a tool that is always tip-down and does not
support hovering so we need to be able to distinguish this for tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
9abc55e484 test: make litest robust for ABS_MT_POSITION_X-only devices
The Dell Canvas Totem only has the MT axes but not the single touch ones. Make
sure we copy the axis extents correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 18:45:04 +10:00
Peter Hutterer
3d8daf99e5 test: remove hwdb leftovers
We don't write hwdb entries anymore, so let's drop any reference to it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 06:53:51 +00:00
Peter Hutterer
8b761e2fec fallback: cancel the arbitration timer on device remove
When the touch arbitration is reset to ARBITRATION_NOT_ACTIVE, the proximity
timer is set for 90ms to avoid erroneous touches (see 2a378beab for the
reason).

If the device is removed within those 90ms, the timer is never cancelled,
leading to an assert on cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
6bbe03a086 Add a bit() macro
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
df527b07b4 path: limit path device nodes to PATH_MAX characters
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 03:35:53 +00:00
Peter Hutterer
4353ed9152 udev: restrict the seat ID to 256 characters
Anything longer than that is likely a bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 03:35:53 +00:00
Peter Hutterer
fbe7abfd5d test: up the ratelimit tests to 1000ms
This fails too often on the gitlab runners, so let's expand the times.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-04 09:56:45 +10:00
Peter Hutterer
f612c1ef0c tablet: add tilt-based touch arbitration for screen tablets
If the tilt angle on tip down is not 0 set the touch arbitration to a
rectangle around the assumed position of the hand. This assumed position is
right of the tip for a rightwards tilt and left of the tip for a leftwards
tilt (i.e. left-handed mode). The rectangle is 200x200mm with a 20x50mm
NW of the tip or NE for left-handed. In other words, if the period below is
the tip, the rectangle looks like this:

    +-----------+                          +-----------+
    | . 	| <- for rightwards tilt   |         . |
    |           |                          |           |
    |           |                          |           |
    |           |    for leftwards tilt -> |           |
    +-----------+                          +-----------+

Touches within that rectangle are canceled, new touches are ignored. As the
tip moves around the rectangle is updated but touches are only cancelled on
the original tip down. While the tip is down, new touches are ignored in the
exclusion area but pre-existing touches are not cancelled.

This is currently only implemented in the fallback interface, i.e. it will
only work for Cintiqs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
794bff8af0 test: add a LITEST_DIRECT feature for the wacom cintiqs
Currently unused, but will be used in later patches

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
ab1dbcc996 fallback: add timer-based touch arbitration
When a hand is resting on a pen+touch device, lifting the hand may remove the
stylus from proximity before the hand leaves the surface. If the kernel
performs touch arbitration, this triggers a touch down on proximity out,
followed by a touch up immediately after when the hand stops touching.

This can cause ghost touch events. Prevent this by using a timer-based
arbitration toggle.

Same as 2a378beab0 but for the fallback
interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
caa8f3fe61 touchpad: release all button presses on device suspend
This leaves a bug open, on a Lenovo T440 generation touchpad with top software
buttons, the button will not be leased correctly. This is caused by
device->is_suspended=true by the time we try to clear the state and the
button events thus getting filtered.

This used to affect all touchpads, this patch just moves it so it only affects
the T440-like devices now.

Fixes #233

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
e8625ef8d3 test: add a test for normal touchpad button presses
Probably covered elsewhere in a more generic test anyway but let's have one we
know is executed for all touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
34b49d5118 evdev: cancel the middle button timer on device removed
If a middle-button-emulating device is removed with one button down, the timer
never gets cancelled and triggers an assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
afbb90daeb test: add an additional final libinput_dispatch()
After the test device was removed, run one more libinput_dispatch(). This may
catch some errors that happen due to the device removal that were ignored for
now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
c75c00dac3 fallback: when force-releasing keys, release them directly
An emulated button is recorded as BTN_MIDDLE in the key down mask. If the
device is removed in that state, the BTN_MIDDLE event processed triggers
an assertion when we try to send out the event twice.

Fixes #201

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
507441537e evdev: cancel the button scroll timer on device removed
If a device was removed while a button was held down and within the timeout,
the timer was never cancelled (and removed from the timer list), triggering an
assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Furkan Tokac
59dee41ba1 test: Missing test cases for palm detection based on touch size
Missing tests are written.
2019-01-29 03:19:57 +00:00
Peter Hutterer
8630e0ef67 test: run the 'keep ignoring' arbitration tests on the cintiqs as well
Not 100% why this one was only run on the intuos, but I suspect by accident.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:09:53 +10:00
Peter Hutterer
d8f1be4f0b test: automate the tablet pairing for the arbitration tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
8987773440 test: store the device type in the test device struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
d4e6a6aadc test: fetch the is-touchpad in arbitration tests from a input property
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
9b42872ee6 test: don't enable tapping for the touch arbitration test
Looks like a copy/paste error.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
c67c3872ca test: clarify a confusing comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 11:01:31 +10:00
Peter Hutterer
62bcac30fc test: add test devices for the Cintiq Pro 16
Reconstructed from the HID descriptors here:
https://github.com/linuxwacom/wacom-hid-descriptors/tree/master/Wacom Cintiq Pro 16/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-04 03:53:37 +00:00
Peter Hutterer
5cd27b070e tools: add a test for tool option parsing
We don't check for correctness in the output as such, just that whatever
combination of cmdline arguments still works/doesn't work. This is the
scaffolding and a few tests, but needs to be filled in, especially for
libinput measure and for some more complex combinations.

valgrind: requires one more python-related suppression
gitlab-ci: requires another environment variable so we know to skip the
	   --device tests (udev will time out on those)
meson: skip the test run in release builds, we pass the full path to the built
       libinput tool but rely on the subtool lookup that won't work in a
       release build

Fixes #174

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-07 05:03:52 +00:00
Peter Hutterer
6041d0ba69 test: fix a clang warning
test/test-misc.c:1065:28: warning: Value stored to 't' during its
initialization is never read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-05 14:28:13 +10:00
Peter Hutterer
981f3a47e6 quirks: add the ability to disable custom event codes/types
This is a more flexible approach than adding a model flag and the C code to
just call libevdev_disable_event_code(). There's a risk users will think this
is is a configuration API but there are some devices out there (e.g. the
Microsoft Sculpt mouse) that need a more generic solution.

Case in point: the Sculpt mouse insists on holding BTN_SIDE down at all times.
We cannot ship any quirks for that device because we only have the receiver's
generic VID/PID. So a local override is required, but we might as well make
that one generic enough to catch other devices too in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-29 04:16:38 +00:00
Peter Hutterer
4fa7a6b94a test: move the custom parser test structs into the functions
No need to pollute the namespace here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-22 08:16:02 +10:00
Peter Hutterer
fd9e749f1c Remove obsolete HAVE_CONFIG_H check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-22 08:15:45 +10:00