Commit graph

486 commits

Author SHA1 Message Date
James Ye
a817098fcb test: add tests for lid switch
Ship a custom udev rule for the test device until systemd v333 is commonplace.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
James Ye
1f0223e9fd Add a "switch" interface for parts of the SW_* range
This will allow switch devices known to libinput to be exposed. Currently,
this is SW_LID.

libinput also handles switch events internally, e.g. a laptop touchpad will
be disabled autmoatically when the lid is closed. This is transparent to
the caller, although the caller will also receive the event. See
https://bugs.freedesktop.org/show_bug.cgi?id=86223
This features is intended to be the main driver for the interface.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: James Ye <jye836@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00
Peter Hutterer
ebeba8e8ff Merge branch 'wip/wheel-tilt-source' 2017-01-20 12:51:53 +10:00
Peter Hutterer
dbb376f74b test: add wheel tilt tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-01-20 11:45:29 +10:00
Peter Hutterer
35421834c7 test: check the pad button state in litest_is_pad_button_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-20 10:35:45 +10:00
Peter Hutterer
fcddfc6b11 test: add helper function to install a "bug expected" log handler
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-20 10:35:43 +10:00
Peter Hutterer
6fb1348765 Revert "Remove the workaround for libevdev pre 1.3"
I'm using semaphore CI for build testing and that only provides Ubuntu 14.04
which doesn't have libevdev 1.3 or later.

Since this is a minor workaround for an error case only, revert the commit
again and leave the handling in. Less effort than having to patch around it in
semaphore.

This reverts commit 1e0736daf3.
2017-01-16 10:24:02 +10:00
Peter Hutterer
86c2e56132 test: fix a comment regarding uinput's resolution assignment
This isn't true anymore with kernel 4.5 and libevdev 1.5.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-16 08:59:32 +10:00
Peter Hutterer
1e0736daf3 Remove the workaround for libevdev pre 1.3
1.3 has been out since Sep 2014, that's enough time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-16 08:59:32 +10:00
Peter Hutterer
a294cf4f90 test: add a synaptics RMI4 test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-12 14:45:50 +10:00
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
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
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
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
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
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
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
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
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
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
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
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
6cde53fc1d test: if we're in a debugger, use single-fork mode only
Don't fork by default if we're in gdb.

Note that is_debugger_attached() is now inside #ifndef LITEST_NO_MAIN, gdb for
the litest selftest will now require a manual CK_FORK=no.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:32:03 +10:00
Peter Hutterer
681f967c8f test: if a filter is specified, don't parallelize jobs by default
Likely testing a specific set of tests, possibly in gdb. So don't parallelize.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:32:03 +10:00
Peter Hutterer
eb8e1d4a13 test: add a make-like job control to run tests in parallel
Add a make-like -j/--jobs option to split the number of parallel test
processes. Defaults to 8 if not specified, future patches will default this to
1 for special cases where filters are specified or gdb is detected.

Each subprocess overwrites argv[0] to be easier identifiable in the ps
output when we're trying to figure out which tests are still running.

A -j1 is equivalent to the previous functionality, i.e. we don't fork.

One quirk needed for check: any test case not part of a test runner will not
be freed and thus triggers valgrind. We do test filtering by splitting
up the tests across multiple forks (i.e. each process has several tests that
are in the list but not added to the runner). Thus we need to mark those we
expect check to free as used.
Then on cleanup we traverse the test list, add all the unused one to a
test runner and free that test runner (without actually running it). This
cleans up both the filtered tests in each subprocess and the whole test list
in the parent process which doesn't run a test itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 11:26:58 +10:00
Peter Hutterer
68841bfd52 Revert "test: create a lock file to avoid parallel udev reloads during device add"
Not needed anymore, we only have one process creating the udev rules.

This reverts commit 030ec053fb.
2016-08-02 10:19:38 +10:00
Peter Hutterer
51fb42cb60 test: restore the hwdb/udev rules on SIGINT
We can't call system() in the signal handler but we are allowed to fork. Do
that, update the hwdb and immediately exit the child again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
f9f4bb0266 test: make sure we remove all udev rules when we SIGINT the test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
a7f04c9a84 test: only init the device rules once
The udev hwdb takes about 200ms and we still trigger it on each device. The
udev rules don't actually change after compiling, so simply create them
once and remove them after the test run.

For multiple test binaries this needed to be synchronized (which is hard),
hence the previous merge into a single binary for all tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
35b28b1af3 test: merge all tests into a single binary
Call it a libinput-test-suite-runner, in subsequent patches we'll handle doing
parallel tests ourselves instead of relying on automake features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
bc76bd6f77 test: store created udev rules in a list for easier deletion
Easier to clean up than knowing all the destination paths we'll install.
Only affects global udev rules so far.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-01 14:49:45 +10:00
Peter Hutterer
e06701201f test: add a Cintiq 13 HDT test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-12 15:14:30 +10:00
Peter Hutterer
3c113111fa Remove LIBINPUT_EVENT_TABLET_PAD_MODE event
Unimplemented and it wasn't supposed to be in the series.

https://lists.freedesktop.org/archives/wayland-devel/2016-June/029376.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-07-11 11:00:51 +10:00
Peter Hutterer
601cdeeb95 test: up the timeout to 30s
10s is not enough when running the test suite in parallel as any test may have
to wait longer than that to get access to the udev lock. Especially for
tests with multiple timeouts it was too easy to trigger timeouts.

Up the timeout to 30s, this seems reliable enough now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-07-05 11:28:43 +10:00
Peter Hutterer
030ec053fb test: create a lock file to avoid parallel udev reloads during device add
litest_add_device and litest_delete_device trigger a udev rule reload. This
messes with some test devices and when we run multiple tests in parallel we
get weird errors like "keyboard $BLAH failed the touchpad sanity test".

Still not 100% reliable to run tests in parallel, but it's vastly improved
now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-07-05 11:28:43 +10:00
Peter Hutterer
b5ea413724 test: fix a memleak when creating udev devices
If the first device we got didn't have the expected syspath we'd leak the
device and cause the valgrind tests to fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-05 11:14:39 +10:00
Peter Hutterer
30bc86f47e test: add pad mode group tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-24 13:29:18 +10:00
Peter Hutterer
d520c5bb84 test: add an Wacom EKR test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-24 13:29:18 +10:00
Peter Hutterer
6583f4bb53 pad: Add a new API for modes and mode groups
Move mode control to libinput. This reduces some flexibility on what we can do
with modes but makes it a lot easier for anyone to implement modes correctly
and have the LEDs apply appropriately, etc. Let's go with the option to make
the 95% use-case easy. Note: whether the mode is actually used is up to the
caller, e.g.  under Windows and OS X the mode only applies to the
rings/strips, not the buttons.

A tablet pad has 1 or more mode groups, all buttons/ring/strips are assigned
to a mode group. That group has a numeric mode index and is hooked to the
LEDs. libinput will switch the LEDs accordingly.

The mode group is a separate object. This allows for better APIs when it comes
to:
* checking whether a button/ring/strip is part of a mode group
* checking whether a button will trigger a mode transition

and in the future potentially:
* checking which mode transition will happen
* setting which button should change the mode transition
* changing what type of mode transition should happen.
* moving a button from one mode group to the other

This patch adds the basic scaffolding, without any real implementation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Proofread-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-06-22 11:57:07 +10:00
Peter Hutterer
28f75d9f9d Merge branch 'wip/touchpad-drop-hysteresis' 2016-06-20 09:26:44 +10:00
Peter Hutterer
89747d7143 Revert "touchpad: reset the motion history on significant negative pressure changes"
We will reinstate the hysteresis for all devices making the negative
pressure check unncessary.

This reverts commit ef48c07a96.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:23:51 +10:00
Peter Hutterer
9bb0cfd878 test: add an apple magicmouse device
This device has a touchpad on the mouse but it's labeled as mouse. For litest
we only label it as LITEST_MOUSE feature and test the touchpad directly on the
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:17:38 +10:00
Peter Hutterer
5f55d71774 test: when creating an abs test device, force the abs->value to the mimimum
Otherwise the abs->value could lie outside the [min, max] range of the axis.
This isn't much of an issue for actual axes but in the case of ABS_MT_SLOT
(value 47) it causes errors when libevdev sanitises the event into the allowed
slot range.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-06-20 09:17:38 +10:00
Peter Hutterer
41b9078eec test: skip manually setting uinput resolution if it's already set
If we have libevdev 1.5 or later, the resolution is already set, no need to
change it again. Let's rely on libevdev to do the right thing and simply skip
the rest if we have one correct nonzero resolution already set on the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-05-20 09:58:19 +10:00
Peter Hutterer
fb5a97211b test: add a keyboard test device with all codes enabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-17 07:58:15 +10:00
Peter Hutterer
064c72a52a Merge branch 'wip/tablet-pad-support' 2016-04-18 13:31:46 +10:00
Peter Hutterer
d82cfa1d53 test: tablet pad tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00