platform/upstream/libinput.git
9 years agotouchpad: add helper function to get from tp to the libinput context
Peter Hutterer [Fri, 22 May 2015 05:16:31 +0000 (15:16 +1000)]
touchpad: add helper function to get from tp to the libinput context

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agotouchpad: extend the key blacklist for disable-while-typing
Peter Hutterer [Sun, 24 May 2015 22:48:25 +0000 (08:48 +1000)]
touchpad: extend the key blacklist for disable-while-typing

Alt-tab should not trigger the disable-while-typing timeout, likewise with the
F-keys, multimedia keys, the windows and menu key, etc.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agotouchpad: move disable-while-typing into its own struct
Peter Hutterer [Mon, 25 May 2015 00:07:51 +0000 (10:07 +1000)]
touchpad: move disable-while-typing into its own struct

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agotest: add an extra loop for slow udev initialization
Peter Hutterer [Tue, 26 May 2015 00:44:16 +0000 (20:44 -0400)]
test: add an extra loop for slow udev initialization

On slower machines, e.g. VMs, udev isn't fast enough to get the properties set
up by the time we're trying to get the device going. This fails when we try to
add the device with libinput_path_add_device().

We know that all litest devices will have ID_INPUT set, so check for that
before we continue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: rename evdev_compare_syspath for clarity
Peter Hutterer [Mon, 25 May 2015 22:49:04 +0000 (08:49 +1000)]
evdev: rename evdev_compare_syspath for clarity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd streq() helper to use instead of strcmp() == 0
Peter Hutterer [Mon, 25 May 2015 22:46:05 +0000 (08:46 +1000)]
Add streq() helper to use instead of strcmp() == 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix coverity complaint about unbounded loop
Peter Hutterer [Mon, 25 May 2015 07:27:14 +0000 (17:27 +1000)]
test: fix coverity complaint about unbounded loop

buffer tainted (from fgets()) so tighten the loop conditions a bit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fail if fgets() from addr2line returns NULL
Peter Hutterer [Mon, 25 May 2015 07:04:56 +0000 (17:04 +1000)]
test: fail if fgets() from addr2line returns NULL

Found by Coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: pclose the popened stream
Peter Hutterer [Mon, 25 May 2015 06:50:54 +0000 (16:50 +1000)]
test: pclose the popened stream

Found by Coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: move litest_log/vlog up outside of HAVE_LIBUNWIND
Peter Hutterer [Mon, 25 May 2015 06:38:12 +0000 (16:38 +1000)]
test: move litest_log/vlog up outside of HAVE_LIBUNWIND

Well, the patch looks like the HAVE_LIBUNWIND bit was moved down, which is the
same thing.

litest_log and litest_vlog are called from independent paths, we have a
compiler error otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd a few more exclusions to .gitignore
Peter Hutterer [Sun, 24 May 2015 23:06:32 +0000 (09:06 +1000)]
Add a few more exclusions to .gitignore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd .vimdir for libinput-specific settings
Peter Hutterer [Sun, 24 May 2015 23:02:25 +0000 (09:02 +1000)]
Add .vimdir for libinput-specific settings

To avoid introducing broken indentations when I'm working in different
directories than the standard one add the vimdir with the local settings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix --list for the tests
Peter Hutterer [Sun, 24 May 2015 22:56:53 +0000 (08:56 +1000)]
test: fix --list for the tests

The argument worked, but the test list was empty since b2fd428f96.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fail if the filter leaves us with zero tests
Peter Hutterer [Fri, 22 May 2015 04:56:09 +0000 (14:56 +1000)]
test: fail if the filter leaves us with zero tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add missing filter for function names
Peter Hutterer [Fri, 22 May 2015 04:55:24 +0000 (14:55 +1000)]
test: add missing filter for function names

Was added to other places, missing from here so some tests passed the filter
despite not being selected by it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMerge branch 'litest-filter-tests'
Peter Hutterer [Thu, 21 May 2015 23:06:07 +0000 (09:06 +1000)]
Merge branch 'litest-filter-tests'

The litest-selftest has its own main method and compiles litest.c with special
flags. Use that to ifdef out the litest.c main function, and inline the
litest_run/litest_parse_args functions so gcc doesn't complain about unused
functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: drop leftovers of Check's selective test running
Peter Hutterer [Wed, 20 May 2015 01:04:13 +0000 (11:04 +1000)]
doc: drop leftovers of Check's selective test running

CK_RUN_CASE and CK_RUN_SUITE still work because we're still using check
underneath, but it's better to use the arguments.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add --filter-group argument to match test groups (suites)
Peter Hutterer [Wed, 20 May 2015 01:00:37 +0000 (11:00 +1000)]
test: add --filter-group argument to match test groups (suites)

Same as CK_RUN_SUITE, but supports fnmatch-like globs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add --filter-device argument
Peter Hutterer [Wed, 20 May 2015 00:49:13 +0000 (10:49 +1000)]
test: add --filter-device argument

Similar to the CK_RUN_CASE environment variable, but it does support
fnmatch()-style wildcards, e.g.

./test/test-touchpad --filter-device="synaptics*"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add filtering to litest framework
Peter Hutterer [Wed, 20 May 2015 00:12:39 +0000 (10:12 +1000)]
test: add filtering to litest framework

Complementary to CK_RUN_SUITE and CK_RUN_CASE, this filters on actual test
function names with a simple fnmatch.

./test/test-touchpad --filter-test="*1fg_tap*"

Most of this patch is renaming litest_add_* to _litest_add_* so we can use the
macros to get at the function names.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: move argument parsing into a separate function
Peter Hutterer [Tue, 19 May 2015 23:46:54 +0000 (09:46 +1000)]
test: move argument parsing into a separate function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: move main() into litest
Peter Hutterer [Tue, 19 May 2015 23:36:01 +0000 (09:36 +1000)]
test: move main() into litest

This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: sync the initial touch state
Peter Hutterer [Fri, 8 May 2015 03:30:13 +0000 (13:30 +1000)]
touchpad: sync the initial touch state

Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would
generate a bogus delta on the second event when the touch coordinate jumps
from 0/y or x/0 to the real coordinates.

For touchpads with distance support this is a real issue since the default
value for a touch distance is > 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: sync the initial state for absolute pointer devices
Peter Hutterer [Fri, 8 May 2015 04:41:42 +0000 (14:41 +1000)]
evdev: sync the initial state for absolute pointer devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: sync the initial x/y position for touchscreens
Peter Hutterer [Fri, 8 May 2015 03:06:25 +0000 (13:06 +1000)]
evdev: sync the initial x/y position for touchscreens

Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would generate
a x/0 or 0/y event in libinput.

Sync the slot state on init, at least for Protocol B devices. For Protocol A
devices and mtdev, don't bother.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: add an interface hook to suspend a device
Peter Hutterer [Tue, 19 May 2015 05:57:11 +0000 (15:57 +1000)]
evdev: add an interface hook to suspend a device

The touchpad carries enough state around that calling release_all_keys() isn't
enough to properly suspend it. e.g. a button down after tapping won't be
released by trying to release the physical button for it.

We need to clear the state properly, but that's interface-specific so add a
new hook for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: move release_pressed_keys() up
Peter Hutterer [Tue, 19 May 2015 05:37:18 +0000 (15:37 +1000)]
evdev: move release_pressed_keys() up

Just a move to make the next diff easier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: rename all interface functions for clarity
Peter Hutterer [Tue, 19 May 2015 05:52:17 +0000 (15:52 +1000)]
touchpad: rename all interface functions for clarity

Add "interface" to the name to make things a bit clearer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: log a bug if releasing a key fails, but don't loop forever
Peter Hutterer [Tue, 19 May 2015 04:44:16 +0000 (14:44 +1000)]
evdev: log a bug if releasing a key fails, but don't loop forever

If a physical button is down but releasing said button doesn't actually
release it, we loop endlessly. Detect that and log a bug instead.

Reproducible: trigger a tap-n-drag on a touchpad device, then remove it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add missing linebreak in debug error message
Peter Hutterer [Thu, 21 May 2015 06:40:24 +0000 (16:40 +1000)]
test: add missing linebreak in debug error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoRename MODEL_SYSTEM76_CLEVO to MODEL_CLEVO_W740SU
Jan Alexander Steffens (heftig) [Mon, 18 May 2015 13:13:23 +0000 (15:13 +0200)]
Rename MODEL_SYSTEM76_CLEVO to MODEL_CLEVO_W740SU

The System76 Galago Ultra Pro is a rebranded Clevo W740SU with changed
firmware strings. To my knowledge, the Clevo W740SU and all its rebrands
possess smooth touchpads.

In the original bug report[1], a Galago Ultra Pro was returned to the
original DMI strings by flashing another firmware. This resulted in the
model identified as MODEL_SYSTEM76_CLEVO.

Since the actual manufacturer of the W740SU is Clevo and the CLEVO hwdb
entry already properly identifies other W740SU rebrands like the Schenker
S413, the model should be renamed to match.

[1]: https://bugs.freedesktop.org/show_bug.cgi?id=90170#c3

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

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMerge branch 'litest-backtrace'
Peter Hutterer [Thu, 21 May 2015 01:05:45 +0000 (11:05 +1000)]
Merge branch 'litest-backtrace'

9 years agotest: move opening { to next line
Peter Hutterer [Tue, 19 May 2015 23:21:26 +0000 (09:21 +1000)]
test: move opening { to next line

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: clarify a comment what a "no device" test case means
Peter Hutterer [Wed, 20 May 2015 00:57:11 +0000 (10:57 +1000)]
doc: clarify a comment what a "no device" test case means

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAllow disabling of middle button emulation where it doesn't exist
Peter Hutterer [Tue, 19 May 2015 06:22:14 +0000 (16:22 +1000)]
Allow disabling of middle button emulation where it doesn't exist

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAllow disabling tapping on a device without tapping
Peter Hutterer [Tue, 19 May 2015 06:01:55 +0000 (16:01 +1000)]
Allow disabling tapping on a device without tapping

The doc says this "always succeeds", not "segfaults".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add a note to one of the device tests
Peter Hutterer [Tue, 19 May 2015 00:57:27 +0000 (10:57 +1000)]
test: add a note to one of the device tests

If we get two different sysnames for the device, this test doesn't test
anything much, so it's better to fail here. But add a comment so that when it
fails it's quite obvious why.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: parse the LITEST_VERBOSE environment variable
Peter Hutterer [Tue, 19 May 2015 00:33:24 +0000 (10:33 +1000)]
test: parse the LITEST_VERBOSE environment variable

--verbose only works when running a specific test, sometimes we need make
check to be more verbose. Set this by default for make check, the log becomes
a lot more expressive that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agopath: be more lenient waiting for udev to settle things
Peter Hutterer [Tue, 19 May 2015 00:24:36 +0000 (10:24 +1000)]
path: be more lenient waiting for udev to settle things

Running tests in parallel can exceed the current 100ms max timeout for udev to
settle things. Since this pretty much only triggers in test cases anyway,
let's be more lenient here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: drop unneeded includes
Peter Hutterer [Mon, 18 May 2015 05:59:09 +0000 (15:59 +1000)]
test: drop unneeded includes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: convert all helper functions to use the litest macros
Peter Hutterer [Mon, 4 May 2015 01:40:39 +0000 (11:40 +1000)]
test: convert all helper functions to use the litest macros

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: extract file:line from backtrace with addr2line
Peter Hutterer [Thu, 7 May 2015 23:31:44 +0000 (09:31 +1000)]
test: extract file:line from backtrace with addr2line

libunwind gives us a file and an address and usually a function name. Beyond
that, it's mostly guessing.
Fork off addr2line to resolve the addresses that libunwind gives us, if we
succeed we get a backtrace like this:

Backtrace:
0: litest_fail_comparison_int() (./test/litest.c:268)
1: disable_button_scrolling() (./test/pointer.c:115)
2: middlebutton_doubleclick() (./test/pointer.c:991)
3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f6c12d8c025]
4: litest_run() (./test/litest.c:689)
5: main() (./test/pointer.c:1280)
6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f6c11a73790]
7: ./test/test-pointer (_start+0x29) [0x403d99]
8: ? (?+0x29) [0x29]

Note: I intentionally swapped function/file name in the output to make it
easier to spot which one is fully resolved and which one is the basic
libunwind output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add pointer comparison macros
Peter Hutterer [Thu, 7 May 2015 22:16:39 +0000 (08:16 +1000)]
test: add pointer comparison macros

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add a backtrace facility to litest
Peter Hutterer [Sun, 3 May 2015 23:13:22 +0000 (09:13 +1000)]
test: add a backtrace facility to litest

The check unit test framework isn't particularly suited to having ck_assert*
calls in helper functions. A failed assertion in a helper function or the
litest framework merely gives us a the failed line in litest.c.
which doesn't tell us which test actually failed.

Add a backtracing facility with litest_backtrace(). And since this requires
wrapping all ck_assert macros with litest_assert() this patch ended up
replacing/duplicating a bunch of ck_assert_* bits. So rather than
ck_assert_int_eq() we now use litest_assert_int_eq(), etc. in the litest
framework itself.

The int comparison macros are more type-safe than ck_assert()'s macros which
just cast all the ints to intmax_t.

Backtrace is spewed to stderr, which is good enough for debugging. Example
backtrace:

FAILED COMPARISON: status != expected
Resolved to: 0 != 0
in disable_button_scrolling() (pointer.c:115)

Backtrace:
0: ./test/test-pointer (litest_fail_comparison_int+0xab) [0x40973b]
1: ./test/test-pointer (disable_button_scrolling+0x174) [0x40421b]
2: ./test/test-pointer (middlebutton_middleclick+0x40) [0x40829c]
3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f0e8a277025]
4: ./test/test-pointer (litest_run+0x107) [0x40a42b]
5: ./test/test-pointer (main+0x2fa) [0x4090e7]
6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f0e88f5e790]
7: ./test/test-pointer (_start+0x29) [0x403ce9]
8: ? (?+0x29) [0x29]

litest_backtrace() itself is copied from xserver/os/backtrace.c which git
blame attributes to Marcin.

CC: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: cast to int before integer comparison
Peter Hutterer [Tue, 5 May 2015 01:52:32 +0000 (11:52 +1000)]
test: cast to int before integer comparison

No effect with the current macros since they'll cast to int for us, but this
will change with the litest_assert macros.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: don't use enum values in ck_assert macros directly
Peter Hutterer [Mon, 4 May 2015 01:29:49 +0000 (11:29 +1000)]
test: don't use enum values in ck_assert macros directly

Unfortunately, typeof(enum something) != typeof(ENUM_VALUE) and produces a
-Wsign-compare warning

Preemptively fix this, it'll show up in the upcoming litest_asssert macros
otherwise.

This fix only applies to helper functions, tests themselves wont (yet) be
switched to the new macros and don't need fixing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: type-safe two ck_assert invocations
Peter Hutterer [Mon, 4 May 2015 01:27:25 +0000 (11:27 +1000)]
test: type-safe two ck_assert invocations

unsigned vs signed in both cases, but the ck_assert macros hide that
(everything is cast to intmax_t). The upcoming litest_assert wrappers expose
these warnings, so fix them ahead of time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add some documentation for disable-while-typing
Peter Hutterer [Mon, 18 May 2015 04:54:50 +0000 (14:54 +1000)]
doc: add some documentation for disable-while-typing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: use a two-stage timeout for disable-while-typing
Peter Hutterer [Mon, 20 Apr 2015 06:20:00 +0000 (16:20 +1000)]
touchpad: use a two-stage timeout for disable-while-typing

Hitting a single key triggers a short timeout, just enough to cover the time
to the next key event. Hitting more than one key triggers the longer timeout.

This should improve responsiveness after single key events when the touchpad is
still the main interaction mode and a key needs to be pressed to advance in
the UI. When typing the hands require physical movement to get back to the
touchpad anyway so a longer timeout is acceptable and more reliable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: add timeout-based disable-while-typing
Peter Hutterer [Mon, 20 Apr 2015 05:51:20 +0000 (15:51 +1000)]
touchpad: add timeout-based disable-while-typing

On some touchpads, typing triggers touches in areas of the touchpad that
cannot easily be distinguished from other fingers. Pressure information is
useless too, so we have to go back to a timeout-based handling of touch data.

If we see non-modifier key events, disable the touchpad for a timeout and set
any touches starting during that timeout as palm.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: switch from is_palm to an enum
Peter Hutterer [Mon, 20 Apr 2015 06:09:31 +0000 (16:09 +1000)]
touchpad: switch from is_palm to an enum

Preparation to add different palm detection types. Not all of them need to be
un-done when leaving the edge area so a boolean is not enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoMerge branch 'tap-to-end-drag'
Peter Hutterer [Mon, 18 May 2015 04:07:45 +0000 (14:07 +1000)]
Merge branch 'tap-to-end-drag'

Changed the test merged in to use the new ranged litests functionality

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add test cases for ending drag with a tap
Velimir Lisec [Wed, 6 May 2015 06:42:37 +0000 (08:42 +0200)]
test: add test cases for ending drag with a tap

Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: end tap-and-drag with an extra tap
Velimir Lisec [Wed, 29 Apr 2015 22:13:51 +0000 (00:13 +0200)]
touchpad: end tap-and-drag with an extra tap

Currently for the tap-and-drag gesture to end user has to wait for a
timeout to expire. Make it possible to end the drag gesture by just tapping.

The allowed finger sequences to start and end a drag are thus:
tap, down, .... move ...., up  <wait for timeout>
tap, down, .... move ...., up, tap

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

Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
State diagram changes and a doc change squashed in.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotimer: fix coverity warning about unused return value
Peter Hutterer [Tue, 5 May 2015 23:20:44 +0000 (09:20 +1000)]
timer: fix coverity warning about unused return value

"read(int, void *, size_t)" returns the number of bytes read, but it
is ignored.

We don't really care about the number of bytes, but let's complain if we get
anything but EAGAIN.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: switch the touchpad multitap tests over to ranged tests
Peter Hutterer [Tue, 5 May 2015 22:33:06 +0000 (08:33 +1000)]
test: switch the touchpad multitap tests over to ranged tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: switch the abs ranged tests over to real ranged tests
Peter Hutterer [Tue, 5 May 2015 22:26:47 +0000 (08:26 +1000)]
test: switch the abs ranged tests over to real ranged tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_add_ranged* functionality
Peter Hutterer [Tue, 5 May 2015 22:09:50 +0000 (08:09 +1000)]
test: add litest_add_ranged* functionality

litest_add_ranged* takes a range parameter that serves as the lower/upper
boundary for a loop. This enables tests to be run multiple times, avoiding the
timeouts we triggered by having the loops inside (e.g. see 2bf8d035c and
6dd02468).

This just wraps the underlying check framework, the ranged variable is
available as "_i" in the test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: add middle button emulation to listed capabilities
Peter Hutterer [Thu, 23 Apr 2015 07:33:17 +0000 (17:33 +1000)]
tools: add middle button emulation to listed capabilities

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: use litest_is_button_event() helper
Peter Hutterer [Mon, 4 May 2015 03:57:31 +0000 (13:57 +1000)]
test: use litest_is_button_event() helper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_is_keyboard_event() helper function
Peter Hutterer [Tue, 5 May 2015 05:43:08 +0000 (15:43 +1000)]
test: add litest_is_keyboard_event() helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_is_touch_event() helper function
Peter Hutterer [Mon, 4 May 2015 03:51:39 +0000 (13:51 +1000)]
test: add litest_is_touch_event() helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_is_motion_event() helper
Peter Hutterer [Mon, 4 May 2015 03:17:27 +0000 (13:17 +1000)]
test: add litest_is_motion_event() helper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_is_axis_event() helper
Peter Hutterer [Mon, 4 May 2015 03:11:21 +0000 (13:11 +1000)]
test: add litest_is_axis_event() helper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: re-order the tests to have the likely ones to fail first
Peter Hutterer [Mon, 4 May 2015 10:55:37 +0000 (20:55 +1000)]
test: re-order the tests to have the likely ones to fail first

Run the touchpad tests first, it's the most likely to fail. It also takes the
longest, so it's annoying to have it fail when you spent a minute watching the
other tests succeed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: litest_is_button_event should take an unsigned int
Peter Hutterer [Sun, 3 May 2015 23:30:51 +0000 (09:30 +1000)]
test: litest_is_button_event should take an unsigned int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: add support for per-finger hovering information
Benjamin Tissoires [Wed, 6 May 2015 23:41:25 +0000 (19:41 -0400)]
touchpad: add support for per-finger hovering information

When the device supports true hovering, it reports this
information through ABS_MT_DISTANCE.
When this axis is available, we should rely on it to
(un)hover the touches as BTN_TOUCH is most of the time
unreliable (generated by the mouse emulation in the kernel).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agofilter: add Simon's copyright
Peter Hutterer [Wed, 6 May 2015 03:14:23 +0000 (13:14 +1000)]
filter: add Simon's copyright

This code was largely lifted from the X server in
bb25b2ad297891430606c367bfabc but didn't take the copyright messages that
applied to that code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jonas Ã…dahl <jadahl@gmail.com>
Acked-by: Simon Thum <simon.thum@gmx.de>
9 years agotest: rename hover tests into semi_mt_hover
Benjamin Tissoires [Thu, 30 Apr 2015 20:30:24 +0000 (16:30 -0400)]
test: rename hover tests into semi_mt_hover

The current hover tests are uniquely designed for some Synaptics
touchpad. libinput can handle hovering through ABS_MT_DISTANCE,
so we need to reserve the "hover" name for real hovering devices.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: bcm5974: down should be marked as static
Benjamin Tissoires [Thu, 30 Apr 2015 20:30:23 +0000 (16:30 -0400)]
test: bcm5974: down should be marked as static

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add a page about the test suite
Peter Hutterer [Wed, 6 May 2015 02:16:15 +0000 (12:16 +1000)]
doc: add a page about the test suite

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: return the right value from open_restricted
Peter Hutterer [Wed, 6 May 2015 01:55:48 +0000 (11:55 +1000)]
test: return the right value from open_restricted

fd or negative errno on failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: move a comment to where it belongs
Peter Hutterer [Wed, 6 May 2015 00:49:17 +0000 (10:49 +1000)]
test: move a comment to where it belongs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.15.0 - this time for real 0.15.0
Peter Hutterer [Tue, 5 May 2015 07:20:35 +0000 (17:20 +1000)]
configure.ac: libinput 0.15.0 - this time for real

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.15.0
Peter Hutterer [Tue, 5 May 2015 06:01:59 +0000 (16:01 +1000)]
configure.ac: libinput 0.15.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: split test for invalid ranges into hi/lo
Peter Hutterer [Tue, 5 May 2015 06:46:18 +0000 (16:46 +1000)]
test: split test for invalid ranges into hi/lo

This test can randomly trigger a timeout, depending on how busy the machine
is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add helper function for creating a device not expected to be added
Peter Hutterer [Tue, 5 May 2015 06:44:34 +0000 (16:44 +1000)]
test: add helper function for creating a device not expected to be added

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: when clearing the touchpad state, release fake touches too
Peter Hutterer [Thu, 30 Apr 2015 04:48:42 +0000 (14:48 +1000)]
touchpad: when clearing the touchpad state, release fake touches too

Causes an error message in the device_disable_release_tap_n_drag test. When
the touchpad is suspended, all touches are ended in tp_clear_state. Since the
hovering support was added, this returns the touches to TOUCH_HOVERING, a
subsequent tp_handle_state() will turn them back into TOUCH_BEGIN based on
BTN_TOUCH and BTN_TOOL_FINGER still being down.

Clear the fake touch buttons as well after ending the touches, this way the
touch points are reset to TOUCH_NONE as intended.
Once we do that we don't need to manually change the tap finger count when
releasing taps, we can just let the count reset naturally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: drop the tap finger count
Peter Hutterer [Mon, 4 May 2015 06:22:36 +0000 (16:22 +1000)]
touchpad: drop the tap finger count

Use tp->nfingers_down as trigger when we have no fingers left on the touchpad
and when we should return to idle. If all touchpoints end in the same frame
tp->nfingers is 0. Thus when we handle the first tap release we transition to
IDLE which now needs to handle (and discard) any touch release events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: enable clickfinger by default on some System76 laptops
Peter Hutterer [Wed, 29 Apr 2015 01:03:08 +0000 (11:03 +1000)]
touchpad: enable clickfinger by default on some System76 laptops

Bonobo, Clevo, Galago and Kudu have clickpads and no markings ->
enable clickfinger by default.

Lemur and Gazelle have physical buttons, no need for extra configuration.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: enable clickfinger by default on chromebooks
Peter Hutterer [Thu, 23 Apr 2015 02:06:42 +0000 (12:06 +1000)]
touchpad: enable clickfinger by default on chromebooks

This matches the vendor default.

Board IDs pulled from modinfo chromeos_laptop, touchpad names from a bit of
googling around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: add to, don't replace, the man page list
Peter Hutterer [Mon, 4 May 2015 04:14:54 +0000 (14:14 +1000)]
tools: add to, don't replace, the man page list

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: increase drag timeout
Velimir Lisec [Thu, 30 Apr 2015 09:12:26 +0000 (11:12 +0200)]
touchpad: increase drag timeout

libinput supports lifting a finger during dragging and setting it back down
again to continue the drag. Curently the drag timeout is set to
DEFAULT_TAP_TIMEOUT. That is to short, when we're dragging the finger needs to
have enough time to move from one edge of the touchpad to the other. 180ms is
too short for that and causes false timeouts and thus button releases that
cancel the drag.

Introduce DEFAULT_DRAG_TIMEOUT and set it to 500 ms.

Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: fix double/multitap timeouts
Peter Hutterer [Mon, 27 Apr 2015 23:50:02 +0000 (09:50 +1000)]
touchpad: fix double/multitap timeouts

The current doubletap timeout was incorrect, it gave the user only 180ms to
touch, release, touch, release to recognise a doubletap. But it would also set
a timeout on the second release, delaying the button events by 180ms.

Instead, re-arm the timer on the second touch down. This gives the user 180ms
to release and touch again (or time out). This makes doubletap much more
reliable and reduces the delay between the release and the button events
arriving since the finger down time is already counted.

Same fix for MULTITAP, though we already armed the timer on touch down so we
just have to remove the new timer on touch release which did little but delay
everything.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add timeout_tapndrag()
Peter Hutterer [Sun, 3 May 2015 22:42:44 +0000 (08:42 +1000)]
test: add timeout_tapndrag()

Prep work for the upcoming patch to extend the timeout for tap-and-drag.  And
switch the tests that rely on it over to the new function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: reduce the multitap tests to 5 taps only
Peter Hutterer [Mon, 4 May 2015 00:21:02 +0000 (10:21 +1000)]
test: reduce the multitap tests to 5 taps only

Reduces the risk of accidental timeouts

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix a couple of coding style issues
Peter Hutterer [Fri, 1 May 2015 01:41:12 +0000 (11:41 +1000)]
Fix a couple of coding style issues

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotimer: set O_NONBLOCK on the timerfd
Peter Hutterer [Thu, 30 Apr 2015 23:09:38 +0000 (09:09 +1000)]
timer: set O_NONBLOCK on the timerfd

Resetting a timerfd empties the data on the fd, so if the timer is reset
between triggering and us reading it, we may block trying to read it.

Since we read events off a device in a loop, a device sending a continuous
flow of events may cause the timer to trigger but delay reading it. If one of
the events cause e.g. the tap timer to be set, the timerfd may be empty at the
time of reading.

Suggested-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoSet O_CLOEXEC when opening devices
Derek Foreman [Thu, 30 Apr 2015 16:43:28 +0000 (11:43 -0500)]
Set O_CLOEXEC when opening devices

We'd rather keep these out of the hands of children.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: ship the event-debug tool as an installed libinput-debug-events tool
Peter Hutterer [Thu, 30 Apr 2015 02:41:50 +0000 (12:41 +1000)]
tools: ship the event-debug tool as an installed libinput-debug-events tool

Rebuild the same binary but without the special LDFLAG. The event-debug tool
is left as-is to allow for easy debugging with gdb, the new tool is now
libtool-enabled and can't be run directly in gdb without installing it first.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add a note to the touch double-down event
Peter Hutterer [Wed, 29 Apr 2015 04:53:27 +0000 (14:53 +1000)]
test: add a note to the touch double-down event

libevdev filters the ABS_MT_TRACKING_ID event for a double-touch down like
this so we never see this in libinput. We see an error message from libevdev
but otherwise this test is a false negative.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotimer: drain data on the timerfd when it triggers
Peter Hutterer [Thu, 30 Apr 2015 01:24:48 +0000 (11:24 +1000)]
timer: drain data on the timerfd when it triggers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: fix broken build if builddir != srcdir
Peter Hutterer [Thu, 30 Apr 2015 04:02:30 +0000 (14:02 +1000)]
tools: fix broken build if builddir != srcdir

Introduced in 6b6f8151a41147eb44d08f33de143b43eb004563, libinput-version.h is
in the builddir.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: indentation fix
Peter Hutterer [Thu, 30 Apr 2015 05:34:01 +0000 (15:34 +1000)]
evdev: indentation fix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: fix typo in man page
Peter Hutterer [Thu, 30 Apr 2015 02:36:28 +0000 (12:36 +1000)]
tools: fix typo in man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: print version number in libinput-list-devices
Peter Hutterer [Tue, 28 Apr 2015 21:53:56 +0000 (07:53 +1000)]
tools: print version number in libinput-list-devices

Makes debugging a bit easier when you can just ask users to do that instead of
digging around in whatever packaging system they have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agoevdev: enable button scrolling by default on mice without wheels
Peter Hutterer [Tue, 28 Apr 2015 06:45:35 +0000 (16:45 +1000)]
evdev: enable button scrolling by default on mice without wheels

If we have a middle button but no wheels, enable on-button scrolling for the
middle button by default. This applies e.g. to the Logitech trackball added as
new test device here.

This makes the separate check for POINTINGSTICK obsolete but I'd rather leave
this in to be more explicit about it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: expand the middle button emulation tests
Peter Hutterer [Tue, 28 Apr 2015 06:40:29 +0000 (16:40 +1000)]
test: expand the middle button emulation tests

Instead of excluding the pointing stick devices, disable middle button
scrolling on those and run them anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: change the suite name for two of the pointer button tests
Peter Hutterer [Tue, 28 Apr 2015 06:43:01 +0000 (16:43 +1000)]
test: change the suite name for two of the pointer button tests

No need for a separate test suite group here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix touch up for multitap-n-drag test
Peter Hutterer [Tue, 28 Apr 2015 01:53:11 +0000 (11:53 +1000)]
test: fix touch up for multitap-n-drag test

Released the wrong touch point, causing warnings:
libevdev error in sanitize_event: BUG: Device "litest SynPS/2 Synaptics
TouchPad" received a double tracking ID 6 in slot 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>