platform/upstream/libinput.git
7 years agoREADME: fix link to libinput-debug-events
Peter Hutterer [Tue, 27 Jun 2017 01:15:59 +0000 (11:15 +1000)]
README: fix link to libinput-debug-events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: libinput 1.7.902 1.7.902
Peter Hutterer [Mon, 26 Jun 2017 09:04:08 +0000 (19:04 +1000)]
configure.ac: libinput 1.7.902

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix invocation of subtools
Peter Hutterer [Mon, 26 Jun 2017 04:05:56 +0000 (14:05 +1000)]
tools: fix invocation of subtools

One dash too many. Oops.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: add preceding spaces before colons where needed
Peter Hutterer [Mon, 26 Jun 2017 03:51:44 +0000 (13:51 +1000)]
meson: add preceding spaces before colons where needed

Meson does not have a single style but the "foo : bar" style is more common in
the docs and in our meson.build file. Make it consistent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: strdup the suite and test name
Peter Hutterer [Thu, 22 Jun 2017 04:04:47 +0000 (14:04 +1000)]
test: strdup the suite and test name

The check framework takes and stores the pointer and expects it to be live for
the livetime of the test but it doesn't strdup it. We have to keep those
pointers around ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: split the configuration option parsing out
Peter Hutterer [Mon, 19 Jun 2017 08:38:33 +0000 (18:38 +1000)]
tools: split the configuration option parsing out

We had one shared parsing function for all config options so tools parse
options that don't actually make sense (e.g. --quiet or --show-keycodes for
libinput-list-devices).

This patch splits the actual libinput device configuration out and reshuffles
everything to make use of that. One large patch, because splitting this up is
more confusing than dumping it all.

This means the actual option parsing is partially duplicated between debug-gui
and debug-events but hey, not everything in life is perfect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: ignore the tap motion threshold if fingers > slots
Peter Hutterer [Thu, 15 Jun 2017 04:13:26 +0000 (14:13 +1000)]
touchpad: ignore the tap motion threshold if fingers > slots

Do so on the synaptics serial touchpads at least, they're known to cause
cursor jumps when the third finger is down. Not detecting a tap move means
three-finger taps get more reliable on these touchpads.

This change affects gestures who now effectively have to wait for the tap
timeout to happen. It's a trade-off.

https://bugs.freedesktop.org/show_bug.cgi?id=101435
https://bugzilla.redhat.com/show_bug.cgi?id=1455443

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: swap libinput dependencies
Peter Hutterer [Fri, 23 Jun 2017 05:13:20 +0000 (15:13 +1000)]
meson: swap libinput dependencies

Since meson commit ae9b238 "ninja: De-dup libraries and use --start/end-group"
we get linker errors with the tools. The duplication is apparently a bit too
agressive, swapping the order here make sure libinput isn't removed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reported-by: Michel Dänzer <michel@daenzer.net>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoSkip restorecon if it cannot be found
Peter Hutterer [Thu, 22 Jun 2017 23:35:27 +0000 (09:35 +1000)]
Skip restorecon if it cannot be found

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: shorten the --help output for the commands
Peter Hutterer [Mon, 19 Jun 2017 07:13:38 +0000 (17:13 +1000)]
tools: shorten the --help output for the commands

The full information is now in the man page, the usage() now just tells you
how to use it. This way there's only one place to maintain it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: remove duplicate test
Peter Hutterer [Thu, 22 Jun 2017 02:57:21 +0000 (12:57 +1000)]
test: remove duplicate test

Copy/paste error, no functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: update the timestamp even when we only get other axes
Peter Hutterer [Wed, 21 Jun 2017 01:39:08 +0000 (11:39 +1000)]
touchpad: update the timestamp even when we only get other axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: rename tp_touch->millis to tp_touch->time
Peter Hutterer [Wed, 21 Jun 2017 01:02:48 +0000 (11:02 +1000)]
touchpad: rename tp_touch->millis to tp_touch->time

This is in µs and hasn't been in ms for a long time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: restore the SELinux context for our .so file on install
Peter Hutterer [Tue, 20 Jun 2017 23:16:06 +0000 (09:16 +1000)]
meson: restore the SELinux context for our .so file on install

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agodoc: update build instructions for Arch
Eric Engestrom [Tue, 20 Jun 2017 13:06:08 +0000 (14:06 +0100)]
doc: update build instructions for Arch

`abs` has been deprecated, and shut down last month. [1]
`asp` replaces it, so rewrite the instructions to use this instead.

Also, add `--noextract` to the makepkg command, as there is no point
downloading and extracting the sources since they're not going to be
built here.

[1] https://www.archlinux.org/news/deprecation-of-abs/

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add instructions for handling SELinux denials
Peter Hutterer [Mon, 12 Jun 2017 05:12:06 +0000 (15:12 +1000)]
doc: add instructions for handling SELinux denials

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agotools: add the compat scripts installer script to the tarball
Peter Hutterer [Tue, 20 Jun 2017 01:18:10 +0000 (11:18 +1000)]
tools: add the compat scripts installer script to the tarball

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomeson: build docs by default, but allow disabling it
Peter Hutterer [Tue, 20 Jun 2017 01:17:39 +0000 (11:17 +1000)]
meson: build docs by default, but allow disabling it

This is the behavior of configure as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomeson: rename 'enable-tests' option to just 'tests'
Peter Hutterer [Tue, 20 Jun 2017 01:14:25 +0000 (11:14 +1000)]
meson: rename 'enable-tests' option to just 'tests'

All the other config options have a simple true/false as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodoc: Fix mistake in Matrix example to relect only X along Y axis
Philippe Coval [Fri, 16 Jun 2017 23:13:28 +0000 (01:13 +0200)]
doc: Fix mistake in Matrix example to relect only X along Y axis

On some devices, X coordinate is not working well, like if it is swapped:
click on right, pointer appear on left and vice versa.

To sort this issue, coordinates should be reflected on Y axis:
- new X position is changed (width is subtracted by X position)
- Y is unchanged (it was wrongly set to X)

In landscape (or portrait) mode:

                [  x  ]
                [  y  ]
                [  1  ]
              *    =
  [ -1 0 1  ]   [  x' ] = -x + 0*y + 1*width
  [  0 1 0  ]   [  y' ] = 0*x + 1*y + 0*height
  [  0 0 1  ]   [  1  ]

This was verified using this touch screen (usb="0eef:0001")

  E: ID_VENDOR=eGalax_Inc.
  E: ID_VENDOR_ENC=eGalax\x20Inc.
  E: ID_VENDOR_ID=0eef

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

Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: use the "is internal keyboard" tag to enable dwt
Peter Hutterer [Fri, 2 Jun 2017 03:32:46 +0000 (13:32 +1000)]
touchpad: use the "is internal keyboard" tag to enable dwt

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: drop the Fedora "ninja-build" note
Peter Hutterer [Mon, 19 Jun 2017 03:11:58 +0000 (13:11 +1000)]
doc: drop the Fedora "ninja-build" note

The packages have been in stable for 6 weeks as of this patch, let's not worry
about the old ones.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: assert on malloc failure
Peter Hutterer [Mon, 19 Jun 2017 02:15:54 +0000 (12:15 +1000)]
tools: assert on malloc failure

No need for proper recovery here in this debugging tool.
Also sneak in a whitespace fix while we're here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: default to log error priority
Peter Hutterer [Mon, 19 Jun 2017 00:37:36 +0000 (10:37 +1000)]
evdev: default to log error priority

Fixes compiler warning:
evdev.c:2899:2: warning: 'pri' may be used uninitialized in this function
[-Wmaybe-uninitialized]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: libinput 1.7.901 1.7.901
Peter Hutterer [Thu, 15 Jun 2017 08:01:13 +0000 (18:01 +1000)]
configure.ac: libinput 1.7.901

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: grab the pointer in the debug gui
Peter Hutterer [Tue, 13 Jun 2017 05:18:56 +0000 (15:18 +1000)]
tools: grab the pointer in the debug gui

Because it's too annoying to trigger the hot corner every few seconds while
pointer debugging.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agogitignore: drop test/test-* pattern
Peter Hutterer [Wed, 14 Jun 2017 05:35:28 +0000 (15:35 +1000)]
gitignore: drop test/test-* pattern

Obsolete since the libinput-test-suite-runner was added

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRemove vestiges of the event-gui
Peter Hutterer [Wed, 14 Jun 2017 02:57:19 +0000 (12:57 +1000)]
Remove vestiges of the event-gui

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: note that the touchpad-tap measuring tool picks a touchpad
Peter Hutterer [Tue, 13 Jun 2017 03:53:10 +0000 (13:53 +1000)]
tools: note that the touchpad-tap measuring tool picks a touchpad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: use the same formatting for the gcc command as for everything else
Peter Hutterer [Tue, 13 Jun 2017 02:32:43 +0000 (12:32 +1000)]
doc: use the same formatting for the gcc command as for everything else

Without the @code tag, the font size differs to everything else in this file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: update building notes with the bug to ninja vs ninja-build on Fedora
Peter Hutterer [Tue, 13 Jun 2017 02:30:35 +0000 (12:30 +1000)]
doc: update building notes with the bug to ninja vs ninja-build on Fedora

Up-to-date Fedora doesn't need to use ninja-build anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: update the publish-doc tool to use ninja
Peter Hutterer [Tue, 13 Jun 2017 02:28:37 +0000 (12:28 +1000)]
tools: update the publish-doc tool to use ninja

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add a short blurb regarding lid switch handling
Peter Hutterer [Tue, 13 Jun 2017 02:20:34 +0000 (12:20 +1000)]
doc: add a short blurb regarding lid switch handling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: decouple our tests/test suites from the ones used by check
Peter Hutterer [Wed, 7 Jun 2017 03:30:48 +0000 (13:30 +1000)]
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>
7 years agotools: free the tap data on error
Peter Hutterer [Mon, 12 Jun 2017 22:33:12 +0000 (08:33 +1000)]
tools: free the tap data on error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add missing toffset copy from src to dest while duplicating
Peter Hutterer [Mon, 12 Jun 2017 22:31:15 +0000 (08:31 +1000)]
tools: add missing toffset copy from src to dest while duplicating

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: point out that measuring taps may be different to what libinput sees
Peter Hutterer [Fri, 9 Jun 2017 05:00:36 +0000 (15:00 +1000)]
tools: point out that measuring taps may be different to what libinput sees

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: localise the open/close function counter in the path tests
Peter Hutterer [Fri, 9 Jun 2017 02:25:50 +0000 (12:25 +1000)]
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>
7 years agotest: use unique names for all the test suite names
Peter Hutterer [Fri, 2 Jun 2017 06:59:09 +0000 (16:59 +1000)]
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>
7 years agotest: remove unused devices field from struct test
Peter Hutterer [Wed, 7 Jun 2017 01:43:40 +0000 (11:43 +1000)]
test: remove unused devices field from struct test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: Add specific pressure range for the Chromebook R13 CB5-312T
Paul Kocialkowski [Fri, 28 Apr 2017 13:33:01 +0000 (15:33 +0200)]
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>
7 years agoudev: Add generic pressure range values for I2C Elan touchpads
Paul Kocialkowski [Fri, 28 Apr 2017 13:33:00 +0000 (15:33 +0200)]
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>
7 years agoudev: Add support for device-tree-based model selection
Paul Kocialkowski [Fri, 28 Apr 2017 13:32:59 +0000 (15:32 +0200)]
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>
7 years agotools: fix linker error with the debug-gui
Peter Hutterer [Tue, 6 Jun 2017 07:54:18 +0000 (17:54 +1000)]
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>
7 years agotools: link libinput.la for libshared.la
Peter Hutterer [Tue, 6 Jun 2017 05:20:40 +0000 (15:20 +1000)]
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>
7 years agoconfigure.ac: require libevdev 1.3 or later
Peter Hutterer [Tue, 6 Jun 2017 04:26:33 +0000 (14:26 +1000)]
configure.ac: require libevdev 1.3 or later

b5e3fd04b2ab667e844e34 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>
7 years agotools: escape all dashes in man pages (for commands and options)
Peter Hutterer [Fri, 2 Jun 2017 02:15:50 +0000 (12:15 +1000)]
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>
7 years agotools: man page cleanup - lowercase all command names
Peter Hutterer [Fri, 2 Jun 2017 02:10:03 +0000 (12:10 +1000)]
tools: man page cleanup - lowercase all command names

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add "libinput measure touchpad-tap"
Peter Hutterer [Tue, 23 May 2017 05:07:31 +0000 (15:07 +1000)]
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>
7 years agoAdd tv2us helper function
Peter Hutterer [Thu, 25 May 2017 22:56:29 +0000 (08:56 +1000)]
Add tv2us helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: link to the online documentation from the libinput(1) man page
Peter Hutterer [Thu, 25 May 2017 07:46:07 +0000 (17:46 +1000)]
tools: link to the online documentation from the libinput(1) man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: split the install_man() up for better grouping of tools
Peter Hutterer [Thu, 25 May 2017 07:33:03 +0000 (17:33 +1000)]
tools: split the install_man() up for better grouping of tools

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: make the libinput tool usage static
Peter Hutterer [Thu, 25 May 2017 06:07:14 +0000 (16:07 +1000)]
tools: make the libinput tool usage static

This now makes the header obsolete too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: Reinstate libshared.la and add it to meson.build too
Peter Hutterer [Thu, 25 May 2017 05:47:19 +0000 (15:47 +1000)]
tools: Reinstate libshared.la and add it to meson.build too

Removed with commit 863fd1f0ebf145dc2b3a59e2a3e57dbc4ce77eaf 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>
7 years agodoc: update for the new libinput tool
Peter Hutterer [Wed, 24 May 2017 01:12:28 +0000 (11:12 +1000)]
doc: update for the new libinput tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: tidy up the usage() for the tools a bit
Peter Hutterer [Thu, 25 May 2017 05:42:46 +0000 (15:42 +1000)]
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>
7 years agoFold the event-gui into the libinput tool
Peter Hutterer [Wed, 24 May 2017 00:36:44 +0000 (10:36 +1000)]
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>
7 years agotools: switch the libinput tool to be an exec-ing tool
Peter Hutterer [Thu, 25 May 2017 00:12:26 +0000 (10:12 +1000)]
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>
7 years agotools: drop event-debug
Peter Hutterer [Wed, 24 May 2017 00:17:46 +0000 (10:17 +1000)]
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>
7 years agomeson: add a test setup for valgrind
Peter Hutterer [Thu, 1 Jun 2017 23:35:56 +0000 (09:35 +1000)]
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>
7 years agomeson: drop LITEST_VERBOSE environment variable
Peter Hutterer [Thu, 1 Jun 2017 22:32:22 +0000 (08:32 +1000)]
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>
7 years agotest: remove unused litest_handle_events
Peter Hutterer [Thu, 1 Jun 2017 22:14:26 +0000 (08:14 +1000)]
test: remove unused litest_handle_events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: limit the wait_for_event timeout to 2s
Peter Hutterer [Thu, 1 Jun 2017 05:43:14 +0000 (15:43 +1000)]
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>
7 years agotest: don't leak test warnings to stdout
Peter Hutterer [Thu, 1 Jun 2017 05:00:27 +0000 (15:00 +1000)]
test: don't leak test warnings to stdout

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: hook up the libevdev log handler
Peter Hutterer [Thu, 1 Jun 2017 05:26:51 +0000 (15:26 +1000)]
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>
7 years agotest: drop two superfluous empty queue checks
Peter Hutterer [Tue, 30 May 2017 03:02:28 +0000 (13:02 +1000)]
test: drop two superfluous empty queue checks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: tighten some test cases
Peter Hutterer [Tue, 30 May 2017 00:13:32 +0000 (10:13 +1000)]
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>
7 years agotest: add an extra assert into litest_wait_for_event_of_type
Peter Hutterer [Tue, 30 May 2017 05:26:16 +0000 (15:26 +1000)]
test: add an extra assert into litest_wait_for_event_of_type

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: make sure we search for event node, not the parent input device
Peter Hutterer [Wed, 31 May 2017 02:01:16 +0000 (12:01 +1000)]
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>
7 years agoMerge branch 'wip/keyboard-integration-property'
Peter Hutterer [Mon, 29 May 2017 03:20:39 +0000 (13:20 +1000)]
Merge branch 'wip/keyboard-integration-property'

7 years agotools: fix minor coding style issue
Peter Hutterer [Thu, 25 May 2017 05:34:30 +0000 (15:34 +1000)]
tools: fix minor coding style issue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix return codes on failure
Peter Hutterer [Wed, 24 May 2017 23:32:13 +0000 (09:32 +1000)]
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>
7 years agoRevert "lid: force the lid to open when the keyboard device is removed"
Peter Hutterer [Tue, 23 May 2017 03:06:44 +0000 (13:06 +1000)]
Revert "lid: force the lid to open when the keyboard device is removed"

This reverts commit 1e2b66fb9a0de8956abc7d996afdd24a11893eb6.

7 years agolid: force the lid to open when the keyboard device is removed
Peter Hutterer [Mon, 22 May 2017 06:00:20 +0000 (16:00 +1000)]
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>
7 years agolid: setup the keyboard notifier when pairing it
Benjamin Tissoires [Fri, 19 May 2017 10:57:23 +0000 (12:57 +0200)]
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>
7 years agolid: track the notifier initial state internally, but not externally
Benjamin Tissoires [Fri, 19 May 2017 10:55:54 +0000 (12:55 +0200)]
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>
7 years agolid: tighten the lid-keyboard pairing
Peter Hutterer [Mon, 22 May 2017 03:51:11 +0000 (13:51 +1000)]
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>
7 years agoevdev: read LIBINPUT_ATTR_KEYBOARD_INTEGRATION property
Peter Hutterer [Mon, 22 May 2017 03:34:10 +0000 (13:34 +1000)]
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>
7 years agolid: add a comment for why we post the switch state there
Peter Hutterer [Mon, 22 May 2017 04:28:31 +0000 (14:28 +1000)]
lid: add a comment for why we post the switch state there

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/libinput-tool-v2'
Peter Hutterer [Tue, 23 May 2017 03:37:06 +0000 (13:37 +1000)]
Merge branch 'wip/libinput-tool-v2'

7 years agotest: tighten the wakeup-on-key lid test
Peter Hutterer [Mon, 22 May 2017 04:21:40 +0000 (14:21 +1000)]
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>
7 years agotest: fix a lid test
Peter Hutterer [Mon, 22 May 2017 04:03:38 +0000 (14:03 +1000)]
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>
7 years agoRemove write-only CYAPA model tag
Peter Hutterer [Fri, 19 May 2017 05:27:42 +0000 (15:27 +1000)]
Remove write-only CYAPA model tag

Obsolete since we moved pressure into the hwdb in
8d5f4decb4086e2b7982c3cd1e24afd9c11f551f

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: define the various files litest needs to copy rules/hwdb in place
Peter Hutterer [Wed, 17 May 2017 04:01:02 +0000 (14:01 +1000)]
meson: define the various files litest needs to copy rules/hwdb in place

This was motivated by the need to run the test runner from any directory, so
we need absolute paths to the files we copy.

Unfortunately, we can't get the absolute path from the object returned by
configure_file() and we can't feed that directly into join_paths() either.
So let' make it at least easier to handle: create a configure_file for all the
files we need (so they all end up in builddir/) and simply hardcode the name
for join_paths. Define the lot in config.h, no need to pass compiler flags
around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: hook libinput-debug-events into the libinput tool
Peter Hutterer [Thu, 11 May 2017 03:44:36 +0000 (13:44 +1000)]
tools: hook libinput-debug-events into the libinput tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add a 'libinput' tool
Peter Hutterer [Thu, 11 May 2017 03:11:23 +0000 (13:11 +1000)]
tools: add a 'libinput' tool

This tool will eventually replace the different libinput tools we ship atm
with the various functionalities being commands to the single tool, rather
than multiple tools.

Right now, we still build both tools separately.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: rename a source file to match the future common file name paradigm
Peter Hutterer [Thu, 11 May 2017 03:52:39 +0000 (13:52 +1000)]
tools: rename a source file to match the future common file name paradigm

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: drop libshared.la
Peter Hutterer [Fri, 12 May 2017 03:26:05 +0000 (13:26 +1000)]
tools: drop libshared.la

Include the source files directly, we'll need per-target compiler flags that
affect different tools differently in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: harmonize container_of() definition with linux kernel one
Gabriel Laskar [Mon, 15 May 2017 11:08:17 +0000 (13:08 +0200)]
util: harmonize container_of() definition with linux kernel one

commit 3925936 introduced changes to container_of, this is hopefully the
last part of it.

In the linux kernel, container_of() takes a type name, and not a
variable. Without this, in some cases it is needed to declare an unused
variable in order to call container_of().

example:

return container_of(dispatch, struct fallback_dispatch, base);

instead of:

struct fallback_dispatch *p;
return container_of(dispatch, p, base);

This introduce also list_first_entry(), a simple wrapper around
container_of() to retrieve the first element of a non empty list. It
allows to simplify list_for_each() and list_for_each_safe().

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev/hwdb_parser.py: use python3 from env instead of /usr/bin
Gabriel Laskar [Sun, 14 May 2017 14:33:17 +0000 (16:33 +0200)]
udev/hwdb_parser.py: use python3 from env instead of /usr/bin

python installation does not always lives in /usr/bin, this allows to
use virtualenv for example.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: use offsetof in container_of
Gabriel Laskar [Sun, 14 May 2017 14:33:16 +0000 (16:33 +0200)]
util: use offsetof in container_of

gcc and clang supports offsetof (defined in stddef.h) as defined by C99
and POSIX.1-2001, use it in container_of.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: make the initial copy file error messages more sensible
Peter Hutterer [Sun, 14 May 2017 23:02:32 +0000 (09:02 +1000)]
test: make the initial copy file error messages more sensible

This is most likely the first error message a developer encounters when
running the test suite and the /run/udev/rules.d directory already exists.
Make it more meaningful than the current generic integer comparison failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: don't use ck_abort_msg outside of test runs
Peter Hutterer [Sun, 14 May 2017 22:57:27 +0000 (08:57 +1000)]
test: don't use ck_abort_msg outside of test runs

This function used to be called inside a test run a long time ago but moved to
a pre-setup stage without switching to the more generic litest_abort_msg.
The only error message we got is "check_msg.c:80: No messaging setup".

https://github.com/libcheck/check/issues/18#issuecomment-301217615

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoInclude config.h from event-debug.c
Peter Hutterer [Thu, 11 May 2017 03:58:54 +0000 (13:58 +1000)]
Include config.h from event-debug.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: install the litest device groups file
Peter Hutterer [Thu, 11 May 2017 01:39:55 +0000 (11:39 +1000)]
test: install the litest device groups file

We never installed the device groups file for the tests, effectively relying
on a system copy to be installed already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: add missing trailing slash to udev test path
Peter Hutterer [Thu, 11 May 2017 01:47:47 +0000 (11:47 +1000)]
meson: add missing trailing slash to udev test path

Otherwise the absolute path to our test binary is invalid

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: pull the tap exclusion zone down to the full edge zone
Peter Hutterer [Tue, 9 May 2017 05:07:20 +0000 (15:07 +1000)]
touchpad: pull the tap exclusion zone down to the full edge zone

This was originally left outside of the button areas in case users tap in
those zones, but we're getting false tap events in that zone.

On a 100mm touchpad, the edge zone is merely 5mm, it's acceptable to ignore
taps in that area even in the software button. We can revisit this if we see
tap detection failures in the future.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoevdev: replace null sentinel with ARRAY_SIZE
Eric Engestrom [Wed, 10 May 2017 03:06:32 +0000 (13:06 +1000)]
evdev: replace null sentinel with ARRAY_SIZE

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoEnsure enums are size int
Peter Hutterer [Wed, 10 May 2017 02:50:21 +0000 (12:50 +1000)]
Ensure enums are size int

Because otherwise things go boom, but unless you passed -fshort-enums this
shouldn't happen anyway. And gcc's documentation says don't do that. So don't
do that, or we'll scream at you.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoFix va_start compiler warning
Peter Hutterer [Wed, 10 May 2017 02:39:26 +0000 (12:39 +1000)]
Fix va_start compiler warning

../src/libinput.c:56:17: warning: passing an object that undergoes default
argument promotion to 'va_start' has undefined behavior [-Wvarargs]

The enum's size is compiler-defined, so the enum gets promoted to whatever the
compiler chose. That promotion is undefined, so let's use an int here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Tested-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>