Commit graph

2629 commits

Author SHA1 Message Date
Peter Hutterer
b3779caef7 doc: add a short blurb regarding lid switch handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-13 12:21:33 +10:00
Peter Hutterer
42ee99ee4d test: decouple our tests/test suites from the ones used by check
Check arranges the tests into suites and test cases (which then can have
multiple test functions). The primary feature for suites is the ability to
select them with environment variables and that the log messages are printed
per suite, not per test case.

We used the suites to distribute tests across the processes forked by the test
runner, but that also resulted in slow suites relying on timeouts (tap/dwt) to
take a lot longer than other suites and hold everything else up.

This patch basically drops the use of check test suites. Our test runner has a
--filter-group argument which selects on suite names, the log messages are
more useful if they immediately include the device and the test case name.

So we just save the test metatdata in our own struct and then assemble a
suite/test case on the fly for each test.

The advantage of this is that tests of the same suite are now distributed
across the forks so slow tests that rely on length timeouts are now run in
parallel. This brings the test runs down to under 6 min again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-13 10:09:55 +10:00
Peter Hutterer
c837cf8d78 tools: free the tap data on error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-13 08:33:12 +10:00
Peter Hutterer
5ba30f7b42 tools: add missing toffset copy from src to dest while duplicating
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-13 08:31:15 +10:00
Peter Hutterer
50991bd0d0 tools: point out that measuring taps may be different to what libinput sees
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-09 15:00:36 +10:00
Peter Hutterer
b64f2382f7 test: localise the open/close function counter in the path tests
Reduces the chance of interference between tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-09 14:28:19 +10:00
Peter Hutterer
57d4d7d3b4 test: use unique names for all the test suite names
This makes it possible to run multiple test suite simultaneously on the same
host without messing up the other runs (provided that all instances use
the same udev/hwdb files). Previously, removing the udev rules/hwdb at the end
of a test run would cause test case failures in other runs that hadn't
completed yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-06-09 07:48:55 +10:00
Peter Hutterer
a369b2c208 test: remove unused devices field from struct test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 14:23:47 +10:00
Paul Kocialkowski
04b9cd22b6 udev: Add specific pressure range for the Chromebook R13 CB5-312T
This adds specific pressure range values for the Elan touchpad found in
the Chromebook R13 CB5-312T (codename elm).

These values allow using the touchpad from the tip of the finger and
makes scrolling generally more reactive.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 09:33:45 +10:00
Paul Kocialkowski
596777a314 udev: Add generic pressure range values for I2C Elan touchpads
This adds generic pressure range values for I2C Elan touchpads used
with device-tree. These values were tested to work with various devices
and should be acceptable in most cases.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 09:33:33 +10:00
Paul Kocialkowski
1603a4326a udev: Add support for device-tree-based model selection
This adds support for detecting input peripherals based on their name
and the device-tree model of the device they're used with.

This is mostly an equivalent to dmi-based model detection (e.g. on x86
devices) for device that use device-tree (e.g. on ARM devices).

Note that this requires systemd updates, see
https://github.com/systemd/systemd/pull/5837

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 09:32:24 +10:00
Peter Hutterer
ce12ea6f9a tools: fix linker error with the debug-gui
Make sure we link libudev into everything that requires it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-06 17:55:14 +10:00
Peter Hutterer
56ceac34d0 tools: link libinput.la for libshared.la
Hopefully fixes the Semaphore CI build failures, apparently things are a bit
more restrictive there than in Fedora 26.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-06 15:23:22 +10:00
Peter Hutterer
5b3ece0c55 configure.ac: require libevdev 1.3 or later
b5e3fd04b2 added hooks for the libevdev log handler and that one
was added in libevdev 1.3 (released in Sep 2014).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-06 14:26:33 +10:00
Peter Hutterer
5d2959aef9 tools: escape all dashes in man pages (for commands and options)
Apparently the rule is that if a dash may end up being copy/pasted, it needs
to be escaped.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
6511154705 tools: man page cleanup - lowercase all command names
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
328bc99d3b tools: add "libinput measure touchpad-tap"
This is the first tool of many more to come to enable users to gather
information aobut their devices and/or usage of these devices. Previously,
these required the users to record events, submit them to a bugzilla, have me
run various scripts over it and then decree that the scripts have spoken.
Push some of this into the hands of the users so they can query the numbers
locally and start investigating (or at least get an idea of what's happening).

This tool measures the time deltas between touch up and touch down and prints
a basic summary, together with the ability to print a dat file with the data
for visualization by e.g. gnuplot. Eventually, more of the current analysis
scripts will be moved into this or other helpers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
1332d883f3 Add tv2us helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
758ffa9c8a tools: link to the online documentation from the libinput(1) man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
f245884dd5 tools: split the install_man() up for better grouping of tools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
4508e29a47 tools: make the libinput tool usage static
This now makes the header obsolete too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
12a364a858 tools: Reinstate libshared.la and add it to meson.build too
Removed with commit 863fd1f0eb but now that we
exec each subcommand, the previous per-target compilation flags aren't needed
anymore. Build a static library to avoid rebuilding the source files for each
target.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
319db5b7df doc: update for the new libinput tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
2d42e87deb tools: tidy up the usage() for the tools a bit
Now that the debug-gui is a user-visible tool, make sure the usage reflects
the right command name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
a69294251d Fold the event-gui into the libinput tool
It's common enough for users to want to debug libinput behavior without
interference by the compositor or the X server. Being able to run a GUI
without having to compile from git is helpful.

Note that this changes --enable-event-gui autotools option to
--enable-debug-gui and the event-gui mesonconf option to debug-gui.

This also drops the standalone event-gui binary in both autotools and meson.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
e9fc59efc8 tools: switch the libinput tool to be an exec-ing tool
Chaining args together inside a single binary would be nice, but it gets nasty
quickly (as I found out adding 3, 4 extra commands). Switch over to using a
git-style exec-ing command where libinput merely changes argv[0] and then
executes whatever it assembled. And those binaries can hide in libexec so they
don't clutter up the global namespace.

This also makes it a lot easier to write man pages, adopt the same style as
git uses.

Compatibilty wrapper scripts are provided for libinput-list-devices and
libinput-debug events. These warn the user about the changed command, then
exec the new one. Expect these wrappers to be removed at some point in the
future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
67000f1ae6 tools: drop event-debug
It's the same thing as libinput-debug-events and the newer "libinput
debug-events" command. The only reason it existed after we started providing
libinput-debug-events is the -no-install libtool flag that makes debugging
with gdb bearable.

Now that we're slowly moving to meson, this isn't needed anymore. If you want
to gdb directly in the source tree, build with meson.
Or use "libtool --mode=execute gdb" for an autotools build.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 12:21:35 +10:00
Peter Hutterer
08c622aeb2 meson: add a test setup for valgrind
To run valgrind properly, we need a couple of arguments passed in so we check
for leaks and don't fail on bits of the stack we don't control. Add a
mesontest setup for this, the lot can now be run by

   mesontest --setup=valgrind

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:57 +10:00
Peter Hutterer
3d68e4ede3 meson: drop LITEST_VERBOSE environment variable
Removed from autotools in 1f5c5cf2c but somehow made a comeback

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:54 +10:00
Peter Hutterer
09a8c5b505 test: remove unused litest_handle_events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:53 +10:00
Peter Hutterer
dbe519f176 test: limit the wait_for_event timeout to 2s
No internal timeout we have takes longer than 2s, so we can abort if we don't
succeed. This gives us a better backtrace to figure out where we're hanging
than the SIGABRT that check will eventually send us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:51 +10:00
Peter Hutterer
dcbf2c2a44 test: don't leak test warnings to stdout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:50 +10:00
Peter Hutterer
b5e3fd04b2 evdev: hook up the libevdev log handler
Make sure any messages from libevdev end up in the same place as libinput's
messages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:49 +10:00
Peter Hutterer
e0ac0153f7 test: drop two superfluous empty queue checks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
3108653e0a test: tighten some test cases
Instead of just waiting for events, use a libinput_dispatch() and assume the
event is there when we want it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
2704511c50 test: add an extra assert into litest_wait_for_event_of_type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
89ac7fd24b test: make sure we search for event node, not the parent input device
This explains the heisenbugs when running the test suite. libevdev gives us
the syspath to the /sys/.../input123 node, not the one for the event node.
The device node path is created based on the sysfs tree, so there's a
window where the device node may not exist yet but we already returned the
device node path.

In litest, we're using a udev monitor to wait until the device is ready for
us, but the path interface only takes a device node path. So what happens is:
* libevdev gives us a syspath for the input node and a device path
* the monitor receives the input node udev device and matches the syspath
* we pass that up to the caller litest_add_device_with_overrides()
  which opens the device node and adds it to libinput
* the path interface creates a udev device from the device node, which still
  points to the old device node. Things fail because we don't have the device
  we expect or it doesn't send events and eventually times out [1].

The errors triggered by this are either odd udev property mismatches or
timeouts because events are never processed.

This race is fixed by simply constructing the actual device node path we
expect from the udev device and waiting for the right device.

[1] We rely on the caller to notify us when to remove the device and thus
silently ignore ENODEV.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:34:33 +10:00
Peter Hutterer
f139d8fbc3 Merge branch 'wip/keyboard-integration-property' 2017-05-29 13:20:39 +10:00
Peter Hutterer
d73f252f2a tools: fix minor coding style issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-26 11:15:13 +10:00
Peter Hutterer
fd4427e4ec tools: fix return codes on failure
Leftovers from an earlier version where we had booleans and more function
nesting in the mix. Fix to return integers, and also rename the function name
accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-26 11:15:01 +10:00
Peter Hutterer
0c428d6b77 Revert "lid: force the lid to open when the keyboard device is removed"
This reverts commit 1e2b66fb9a0de8956abc7d996afdd24a11893eb6.
2017-05-23 15:10:10 +10:00
Peter Hutterer
d35d122eb1 lid: force the lid to open when the keyboard device is removed
On unreliable tablets (Surface3), always force the lid switch to open when the
paired keyboard is removed. This way the lid can't be stuck in a closed state
when there's nothing attached that can actually trigger that state.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Benjamin Tissoires
8fbdef3aad lid: setup the keyboard notifier when pairing it
On unreliable LID switches, we might have the LID declared as closed
while it is actually not. We can not wait for the first switch event to setup
the keyboard listener: it will never occur.

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

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Benjamin Tissoires
28fcd2c6d4 lid: track the notifier initial state internally, but not externally
What we do not want is libinput to believe the LID is closed while
it's not. But the internal notifier state need to be in sync with the evdev
node, or it's going to be a pain setting the keyboard listener.

But since we don't know if the state is reliable, we track the internal state
separately from the external state so that we can set up the keyboard listener
when the lid is closed, without having libinput actually send lid closed
events for unreliable devices.

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

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Peter Hutterer
1671c7f4ad lid: tighten the lid-keyboard pairing
Only pair if the keyboard is either tagged as internal device.

This has another (unlikely) behaviour change: previously we would override the
paired keyboards with ones that look more accurate (e.g. a usb keyboard paired
before a serial would be unpaired and the serial keyboard takes its place).
Now we assume there can only be one internal keyboard, once we have it we
ignore all others. This shouldn't matter in real life provided the tagging is
correct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Peter Hutterer
1cfa1f64cf evdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION property
We have heuristics for detecting whether a keyboard is internal or external,
but in some cases (e.g. Surface 3) these heuristics fail. Add a udev property
that we can apply to these cases so we have something that's reliable.

This will likely eventually become ID_INPUT_KEYBOARD_INTEGRATION as shipped by
systemd, similar to the touchpad property.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Peter Hutterer
782a0661d1 lid: add a comment for why we post the switch state there
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:09:40 +10:00
Peter Hutterer
a2a8db261a Merge branch 'wip/libinput-tool-v2' 2017-05-23 13:37:06 +10:00
Peter Hutterer
1daaa07fc3 test: tighten the wakeup-on-key lid test
Having a litest_wait_for_event_of_type() in there causes us to silently
discard anything but the events we're looking for. This is risky, we want to
make sure that if we re-enable the lid that the key events arrive *after* the
lid open event, not before. So let's not paper over those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:42 +10:00
Peter Hutterer
3f6b97d4c4 test: fix a lid test
We were checking for the empty queue on the wrong context, the default context
got drained a few lines above.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:39 +10:00