platform/upstream/libinput.git
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>
7 years agoutil: fix container_of() macro
Peter Hutterer [Wed, 10 May 2017 02:33:10 +0000 (12:33 +1000)]
util: fix container_of() macro

Fixes a bunch of warnings of the kind
../src/evdev.h:378:32: warning: variable 'f' is uninitialized when used here [-Wuninitialized]
        return container_of(dispatch, f, base);

Just typecasting NULL means we can ignore sample but for the type.

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

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 agoutil: drop GCC specifics for container_of
Peter Hutterer [Wed, 10 May 2017 02:29:47 +0000 (12:29 +1000)]
util: drop GCC specifics for container_of

clang supports __typeof__ which was the only real difference. Not sure any
other compilers matter (that don't support __typeof__)

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 agotest: suppress Python3 valgrind errors
Peter Hutterer [Mon, 8 May 2017 02:18:51 +0000 (12:18 +1000)]
test: suppress Python3 valgrind errors

Running through mesontest also runs parse-hwdb through valgrind and
gives us a bunch of leaks that originate within Python somewhere - we don't
care about those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: disable coredumps during test suite runs
Peter Hutterer [Mon, 8 May 2017 03:35:07 +0000 (13:35 +1000)]
test: disable coredumps during test suite runs

Running valgrind through mesontest produces coredumps for a lot of tests
(unclear why, the core dump merely shows a call to abort). But even without
mesontest, creating a core dump for each failed test is a bad idea - if one
fails, most likely many others fail and the coredumps quickly fill up the file
system.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agolid: remove the keyboard listener on remove and re-init the listener
Peter Hutterer [Thu, 4 May 2017 04:50:31 +0000 (14:50 +1000)]
lid: remove the keyboard listener on remove and re-init the listener

If the event listener is added, then removed again on a lid switch on/off
event, the list is set to null. This can trigger two crashes:
* when the keyboard is removed first, the call to
  libinput_device_remove_event_listener() dereferences the null pointer
* when the switch is removed first, the call to device_destroy will find a
  remaining event listener and assert

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: remove the lid switch listener on device_removed
Peter Hutterer [Fri, 5 May 2017 02:48:35 +0000 (12:48 +1000)]
touchpad: remove the lid switch listener on device_removed

Sequence triggered by the xorg driver, but basically: if the touchpad is
destroyed before the lid switch, the event listener wasn't removed and an
assertion was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: add asserts with useful error messages to catch uninitialized lists
Peter Hutterer [Thu, 4 May 2017 04:52:09 +0000 (14:52 +1000)]
util: add asserts with useful error messages to catch uninitialized lists

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add build instructions for meson
Peter Hutterer [Thu, 4 May 2017 03:30:02 +0000 (13:30 +1000)]
doc: add build instructions for meson

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd meson.build file
Peter Hutterer [Wed, 30 Nov 2016 07:59:17 +0000 (17:59 +1000)]
Add meson.build file

v2:
- meson 0.40 requirement
- add_project_arguments() instead of add_global_arguments()
- use cc.get_define('static_assert')
- use config.set10 and config.set_quoted instead of manual handling
- more use of join_paths
- use files() for model quirks hwdb check
- update options to all state 'true' as default instead of variations of
  'true', 'enabled' and 'yes'

v3:
- drop -Wall -Wextra and -g, let meson set that with warning_level/debug build
- add meson files to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: switch from #ifdef to #if HAVE_LIBUNWIND
Peter Hutterer [Thu, 27 Apr 2017 00:23:45 +0000 (10:23 +1000)]
test: switch from #ifdef to #if HAVE_LIBUNWIND

We use #if everywhere else and it allows building with '-Wundef -Werror=undef'
to avoid accidental misuse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: drop checks for a few flags
Peter Hutterer [Wed, 26 Apr 2017 01:09:14 +0000 (11:09 +1000)]
configure.ac: drop checks for a few flags

These were added in 2013 for old enterprise distributions (centos 5.5, see fdo
bz 63360), it's now 4 years later and these checks seems a bit superfluous.

If those bits are missing, compilation will fail anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: allow running the symbols-leak-test.in script directly
Peter Hutterer [Wed, 26 Apr 2017 00:55:53 +0000 (10:55 +1000)]
test: allow running the symbols-leak-test.in script directly

With autotools, we replace the @top_srcdir@ during configure and then run teh
resulting scripts.

With meson, it's easier to just pass top-srcdir it in as argument.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agodoc: drop the explicit input from the doxygen.in
Peter Hutterer [Wed, 26 Apr 2017 00:33:37 +0000 (10:33 +1000)]
doc: drop the explicit input from the doxygen.in

We pass in the input via the commandline, so having the files here is
misleading. Replace it with an @INPUT@ - in autotools that one is ignored but
it'll help meson.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRename man pages to .1 suffix for meson's benefit
Peter Hutterer [Wed, 7 Dec 2016 01:14:07 +0000 (11:14 +1000)]
Rename man pages to .1 suffix for meson's benefit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: update build instructions for lack of autodetection
Peter Hutterer [Thu, 4 May 2017 03:22:03 +0000 (13:22 +1000)]
doc: update build instructions for lack of autodetection

Since we dropped autodetection of features in configure, these instructions
were incorrect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix compiler warning
Peter Hutterer [Thu, 4 May 2017 02:44:25 +0000 (12:44 +1000)]
test: fix compiler warning

test-tablet.c: In function ‘proximity_in_out’:
test-tablet.c:797:20: warning: increment of a boolean expression [-Wbool-operation]
    have_tool_update++;

And tighten the test so we fail for multiple prox in events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: undef ck_assert_double before redefining it
Peter Hutterer [Thu, 4 May 2017 02:42:23 +0000 (12:42 +1000)]
test: undef ck_assert_double before redefining it

check 0.11 has those macros, but they don't work the same way as our homemade
ones. So for now just #undef them

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-tap-timestamps'
Peter Hutterer [Thu, 4 May 2017 01:51:36 +0000 (11:51 +1000)]
Merge branch 'wip/touchpad-tap-timestamps'

7 years agolid: fix some indentation
Peter Hutterer [Wed, 3 May 2017 11:08:14 +0000 (21:08 +1000)]
lid: fix some indentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: make use of use tp_for_each_touch
Marcos Paulo de Souza [Wed, 3 May 2017 01:54:03 +0000 (22:54 -0300)]
touchpad: make use of use tp_for_each_touch

Instead of reimplementing a for loop every time.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: fix doxygen group for libinput_event_tablet_pad_get_time
Peter Hutterer [Tue, 2 May 2017 05:34:58 +0000 (15:34 +1000)]
doc: fix doxygen group for libinput_event_tablet_pad_get_time

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: document the event timestamps
Peter Hutterer [Mon, 1 May 2017 09:58:13 +0000 (19:58 +1000)]
doc: document the event timestamps

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: Add specific pressure range for the ASUS ZenBook UX21E
Paul Kocialkowski [Fri, 28 Apr 2017 13:29:04 +0000 (15:29 +0200)]
udev: Add specific pressure range for the ASUS ZenBook UX21E

This adds specific pressure range values for the Elantech touchpad
found in the ASUS ZenBook UX21E.

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

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: Select more generic pressure range values for Elantech touchpads
Paul Kocialkowski [Fri, 28 Apr 2017 13:29:03 +0000 (15:29 +0200)]
udev: Select more generic pressure range values for Elantech touchpads

The current pressure values for Elantech touchpads are too high for
various devices and make the touchpad almost unusable on them.

Decreasing the pressure range values makes those devices usable again.

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: Remove unused Elantech touchpad model binding
Paul Kocialkowski [Fri, 28 Apr 2017 13:29:02 +0000 (15:29 +0200)]
udev: Remove unused Elantech touchpad model binding

The Elantech touchpad model binding in udev is currently unused, since
pressure values were moved to a udev binding of their own.

This gets rid of the deprecated model binding.

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 agoPut a check in to make sure our events have correct timestamps
Peter Hutterer [Fri, 28 Apr 2017 03:44:59 +0000 (13:44 +1000)]
Put a check in to make sure our events have correct timestamps

This is for debugging purposes only, we cannot guarantee that event timestamps
always go up - at least not across devices. Example: tapping on a touchpad may
delay an event until a timeout expires, but that event is then sent with the
original touch timestamps (i.e. in the past). If any other device produces
events during that timeout period, our timestamps are out-of-order.

This isn't really a bug because we are forced to do that, but for bug-fixing
it can be useful to detect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: add touch state debugging helper
Peter Hutterer [Wed, 26 Apr 2017 04:40:11 +0000 (14:40 +1000)]
touchpad: add touch state debugging helper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: for 2/3-finger tap, use the last finger down as press time
Peter Hutterer [Fri, 28 Apr 2017 04:51:06 +0000 (14:51 +1000)]
touchpad: for 2/3-finger tap, use the last finger down as press time

This makes the tapping times shorter and hopefully more obvious. It also fixes
a bug where repeated tripletap (by tapping with one finger while leaving the
other two down) could cause incorrect timestamps.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: send multitap button events with the correct timestamps
Peter Hutterer [Fri, 28 Apr 2017 03:52:07 +0000 (13:52 +1000)]
touchpad: send multitap button events with the correct timestamps

For multitap, we're one tap behind with the button clicks, i.e. we send the
first full click button on the second tap, etc. Remember the timestamps of the
touches so we can send the events with the right timestamps. This makes
tapping more accurate because the time between taps and various timeouts
matter less for double-click detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: enable drag lock for multitap tests
Peter Hutterer [Fri, 28 Apr 2017 03:34:56 +0000 (13:34 +1000)]
test: enable drag lock for multitap tests

Without this enabled, we stay in the single/double tap part of the state
machine and a triple tap is just a double tap followed by a single tap.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: fix the button timestamps for double/tripletap
Peter Hutterer [Thu, 27 Apr 2017 04:12:11 +0000 (14:12 +1000)]
touchpad: fix the button timestamps for double/tripletap

Both events had the same timestamp but we have the timestamp from the original
event - use it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add a faq for synclient/syndaemon
Peter Hutterer [Fri, 28 Apr 2017 00:11:01 +0000 (10:11 +1000)]
doc: add a faq for synclient/syndaemon

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-custom-pressure-values'
Peter Hutterer [Wed, 26 Apr 2017 02:38:28 +0000 (12:38 +1000)]
Merge branch 'wip/touchpad-custom-pressure-values'

7 years agotouchpad: drop the unused touchpad_model enum
Peter Hutterer [Mon, 24 Apr 2017 05:58:22 +0000 (15:58 +1000)]
touchpad: drop the unused touchpad_model enum

A leftover from synaptics where we do this detection in the driver. libinput
pushes this to the hwdb and sets the model flags accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add documentation for touchpad pressure detection
Peter Hutterer [Wed, 19 Apr 2017 04:11:45 +0000 (14:11 +1000)]
doc: add documentation for touchpad pressure detection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: move the pressure range to a hwdb entry
Peter Hutterer [Wed, 19 Apr 2017 03:45:34 +0000 (13:45 +1000)]
touchpad: move the pressure range to a hwdb entry

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-mt-tool-palm'
Peter Hutterer [Wed, 26 Apr 2017 02:23:24 +0000 (12:23 +1000)]
Merge branch 'wip/touchpad-mt-tool-palm'

7 years agoconfigure.ac: quote the xyes for the libunwind check
Peter Hutterer [Tue, 25 Apr 2017 22:31:15 +0000 (08:31 +1000)]
configure.ac: quote the xyes for the libunwind check

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: move some checks out of the libwacom section
Peter Hutterer [Tue, 25 Apr 2017 22:30:44 +0000 (08:30 +1000)]
configure.ac: move some checks out of the libwacom section

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRename README to README.md, include properly from doxygen
Peter Hutterer [Thu, 20 Apr 2017 05:54:55 +0000 (15:54 +1000)]
Rename README to README.md, include properly from doxygen

As of doxygen 1.8.3 (Dec 2012) doxygen can include a README.md directly as
mainpage. This avoids the ugly doxygen bits we have in the current README.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd doc to discourage use of libinput_device_get_output_name()
Peter Hutterer [Thu, 20 Apr 2017 22:47:31 +0000 (08:47 +1000)]
Add doc to discourage use of libinput_device_get_output_name()

This is a leftover from when libinput was part of weston and we could
interpret properties correctly. Realistically, the only way this could work
with libinput as external library is if we define precisely what the
definition of an output is. Practically, it's a lot easier to just throw up
our hands and leave it all to the caller.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>