platform/upstream/libinput.git
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>
9 years agodoc: expand scrolling documentation
Peter Hutterer [Tue, 28 Apr 2015 00:43:55 +0000 (10:43 +1000)]
doc: expand scrolling documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: upgrade to the Microsoft Surface Type Cover
Peter Hutterer [Fri, 24 Apr 2015 05:27:34 +0000 (15:27 +1000)]
test: upgrade to the Microsoft Surface Type Cover

Almost identical to the one we already had but this one also has ABS_X/Y to
mess things up. Update the existing one, no need to add a separate device here.

The fake MT touch test needs to be updated now though. A fake MT device may be
an absolute device too, so if we use the touch_down() handlers we may generate
abs pointer events. That's valid, we only check for no touch events here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agoevdev: init pointer accel filters when we have rel x/y axes
Peter Hutterer [Fri, 24 Apr 2015 04:59:18 +0000 (14:59 +1000)]
evdev: init pointer accel filters when we have rel x/y axes

Some devices provide abs x/y and rel x/y. We can't know which event the device
will send. The Microsoft Surface Type Cover sends relative events, which
then crashes libinput when we don't have an accel filter set up.

So instead of checking that the device doesn't have ABS_X/Y, check for the
device to have REL_X/Y instead.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agoevdev: reject devices with only REL_X but no REL_Y (or vice versa)
Peter Hutterer [Fri, 24 Apr 2015 05:01:55 +0000 (15:01 +1000)]
evdev: reject devices with only REL_X but no REL_Y (or vice versa)

Not sure if any exists, if they do let's see if a user files a bug report
first so we know what to do with those (they're most likely buttonsets).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: add the MS Surface Type Cover to the list of devices
Peter Hutterer [Fri, 24 Apr 2015 05:07:58 +0000 (15:07 +1000)]
test: add the MS Surface Type Cover to the list of devices

Added in d2842893a828407e3c4d2459a382f8c7179b2f51 but never added to the list
of devices so none of the tests ran against it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: fix features for the MS Surface Cover
Peter Hutterer [Fri, 24 Apr 2015 05:18:17 +0000 (15:18 +1000)]
test: fix features for the MS Surface Cover

LITEST_KEYBOARD is the type, LITEST_KEYS is the feature.
And this device has buttons, so mark it as such.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: drop REP_DELAY from the ms surface cover event codes
Peter Hutterer [Fri, 24 Apr 2015 05:12:09 +0000 (15:12 +1000)]
test: drop REP_DELAY from the ms surface cover event codes

litest doesn't know how to set this up and we don't need it anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: check for event as not null before dereferencing it
Peter Hutterer [Fri, 24 Apr 2015 05:24:11 +0000 (15:24 +1000)]
test: check for event as not null before dereferencing it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: fix a memory leak in the touch test
Peter Hutterer [Sun, 26 Apr 2015 22:56:50 +0000 (08:56 +1000)]
test: fix a memory leak in the touch test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
9 years agotest: add semi-mt 2fg scroll test
Peter Hutterer [Mon, 27 Apr 2015 01:00:24 +0000 (11:00 +1000)]
test: add semi-mt 2fg scroll test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Only use slot 0 deltas for 2fg scrolling on semi-mt touchpads
Hans de Goede [Fri, 24 Apr 2015 14:49:36 +0000 (16:49 +0200)]
touchpad: Only use slot 0 deltas for 2fg scrolling on semi-mt touchpads

Some semi-mt model touchpads have a better accuracy for slot 0 then for
slot 1 (they only have 2), so on semi-mt models only use the movement of
the touch in slot 0 for 2fg scrolling, rather then the average movement of
the 2 touches.

This fixes 2fg scrolling being choppy / jumpy in some cases.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89683
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Also needed: change the touchpad scroll source test to use more separate
events. The current litest semi-mt touch implementation only moves the first
touch on every second move. With 5 movements this isn't enough to fill the
motion history and generate events, so double it to 10 so we're guaranteed to
get scroll events.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: use a different filter for low resolution touchpad on the Lenovo X230
Benjamin Tissoires [Thu, 23 Apr 2015 18:32:40 +0000 (14:32 -0400)]
evdev: use a different filter for low resolution touchpad on the Lenovo X230

Those touchpads presents an actual lower resolution that what is
advertised.

We see some jumps from the cursor due to the big steps in X and Y
when we are receiving data.

For instance, we receive:

E: 13.471932 0003 0000 16366    # EV_ABS / ABS_X                16366
E: 13.471932 0003 0001 9591     # EV_ABS / ABS_Y                9591
E: 13.471932 0000 0000 0000     # ------------ SYN_REPORT (0) ----------
E: 13.479924 0003 0000 16316    # EV_ABS / ABS_X                16316
E: 13.479924 0003 0001 9491     # EV_ABS / ABS_Y                9491
E: 13.479924 0000 0000 0000     # ------------ SYN_REPORT (0) ----------
E: 13.487939 0003 0000 16271    # EV_ABS / ABS_X                16271
E: 13.487939 0003 0001 9403     # EV_ABS / ABS_Y                9403
E: 13.487939 0000 0000 0000     # ------------ SYN_REPORT (0) ----------

-> jumps of ~50 in X in each report, and ~100 for Y.

Apply a factor to minimize those jumps at low speed, and try
keeping the same feeling as regular touchpads at high speed.
It still feels slower but it is usable at least

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add LITEST_KEYS to roccat mouse features
Derek Foreman [Fri, 24 Apr 2015 22:23:13 +0000 (17:23 -0500)]
test: add LITEST_KEYS to roccat mouse features

The mouse can generate key events, so it should be carry that feature bit.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: Add negative test for libinput_device_keyboard_has_key()
Derek Foreman [Fri, 24 Apr 2015 22:21:18 +0000 (17:21 -0500)]
test: Add negative test for libinput_device_keyboard_has_key()

Ensure we get a -1 return for non-keyboard devices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: allow BTN_LEFT in clickfinger mode without touches
Peter Hutterer [Fri, 24 Apr 2015 02:25:50 +0000 (12:25 +1000)]
touchpad: allow BTN_LEFT in clickfinger mode without touches

On the Logitech T650 it's quite easy to trigger a click without touching the
surface. For software buttons we discard those clicks because we can't tell
where the finger is to decide on left vs right click.

It takes effort to trigger a click with two fingers without triggering a touch
though, so in clickfinger mode post a click without touches as single-finger
click.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: minor code cleanup
Peter Hutterer [Fri, 24 Apr 2015 02:36:43 +0000 (12:36 +1000)]
touchpad: minor code cleanup

No functional changes, just reducing to one instance of the call with a
variable parameter.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: don't re-use button variable
Peter Hutterer [Fri, 24 Apr 2015 02:23:45 +0000 (12:23 +1000)]
touchpad: don't re-use button variable

Split into button and area, the latter of which is the bitmask of which area
we're in. No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: indentation and other whitespace fixes
Peter Hutterer [Fri, 24 Apr 2015 02:02:28 +0000 (12:02 +1000)]
touchpad: indentation and other whitespace fixes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: add support for LIBINPUT_MODEL_* udev tags
Peter Hutterer [Mon, 20 Apr 2015 18:29:44 +0000 (14:29 -0400)]
evdev: add support for LIBINPUT_MODEL_* udev tags

Some devices need specific configuration or different defaults.
Push that into udev rules and a hwdb file, that's where detection is the
easiest. The LIBINPUT_MODEL_ prefix is used to determine some type of device
model. Note that this property is a private API and subject to change at
any time without notice.

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-touchpad: Adjust touchpad_edge_scroll_no_2fg test for gesture support
Hans de Goede [Wed, 22 Apr 2015 08:32:38 +0000 (10:32 +0200)]
test-touchpad: Adjust touchpad_edge_scroll_no_2fg test for gesture support

Unlike all the other 2fg scroll tests the touchpad_edge_scroll_no_2fg test
puts the 2 fingers down quite far apart, this makes the pinch vs scroll
gesture detection code in the gestures branch detect a pinch causing the
test to fail.

This commit brings the finger placement in line with the other 2fg scroll
tests fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd libinput_device_keyboard_has_key()
Peter Hutterer [Wed, 22 Apr 2015 04:36:25 +0000 (14:36 +1000)]
Add libinput_device_keyboard_has_key()

Similar to libinput_device_pointer_has_button(), this function returns whether
a given device has a specific keycode.

This enables a caller to determine if the device is really a keyboard (check
for KEY_A-KEY_Z) or just a media key device (check for KEY_PLAY or somesuch),
depending on the context required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
9 years agoevdev: Add support for POINTINGSTICK_CONST_ACCEL udev property
Hans de Goede [Wed, 1 Apr 2015 09:03:19 +0000 (11:03 +0200)]
evdev: Add support for POINTINGSTICK_CONST_ACCEL udev property

There is quite a wide spread in the delta events generated by trackpoints,
some generate deltas of 1-2 under normal use, while others generate deltas
from 1-20.

It is desirable to normalize trackpoint deltas just like we are normalizing
mouse deltas to 1000 dpi, so as to give different model laptops aprox.
the same trackpoint cursor speed ootb.

Recent versions of udev + hwdb set a POINTINGSTICK_CONST_ACCEL udev property
which can be used to adjust trackpoints which are too slow / too fast
ootb, this commit implements support for that property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: use doubles to back the scroll bars
Peter Hutterer [Wed, 22 Apr 2015 05:31:21 +0000 (15:31 +1000)]
tools: use doubles to back the scroll bars

Slow scrolling otherwise won't move them because we keep truncating the
subpixels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.14.1 0.14.1
Peter Hutterer [Tue, 21 Apr 2015 23:19:13 +0000 (09:19 +1000)]
configure.ac: libinput 0.14.1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: distribute the new man page
Peter Hutterer [Tue, 21 Apr 2015 23:18:34 +0000 (09:18 +1000)]
tools: distribute the new man page

Fixes distcheck

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.14.0 0.14.0
Peter Hutterer [Tue, 21 Apr 2015 22:20:56 +0000 (08:20 +1000)]
configure.ac: libinput 0.14.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoUpdate to v4.0 kernel header
Peter Hutterer [Tue, 21 Apr 2015 22:24:27 +0000 (08:24 +1000)]
Update to v4.0 kernel header

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoSort the middle button symbols additions correctly
Peter Hutterer [Tue, 21 Apr 2015 22:20:34 +0000 (08:20 +1000)]
Sort the middle button symbols additions correctly

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add a note that sometimes there's more than one ID_INPUT_* set
Peter Hutterer [Tue, 21 Apr 2015 22:16:42 +0000 (08:16 +1000)]
doc: add a note that sometimes there's more than one ID_INPUT_* set

Just setting one of them on a device doesn't guarantee that libinput takes
that as device type.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add --set-scroll-button as option
Peter Hutterer [Tue, 21 Apr 2015 08:24:39 +0000 (18:24 +1000)]
tools: add --set-scroll-button as option

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: mix mixing of middle buttons state vs config status enum types
Peter Hutterer [Tue, 21 Apr 2015 08:01:26 +0000 (18:01 +1000)]
test: mix mixing of middle buttons state vs config status enum types

Coverity complaint: mixed_enums: Mixing enum types enum
libinput_config_middle_emulation_state and enum libinput_config_status

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: don't post 2fg scrolling when edge scrolling is enabled
Peter Hutterer [Tue, 21 Apr 2015 02:07:55 +0000 (12:07 +1000)]
touchpad: don't post 2fg scrolling when edge scrolling is enabled

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: adjust the movement size for edge scroll timeout testing
Peter Hutterer [Tue, 21 Apr 2015 04:55:49 +0000 (14:55 +1000)]
test: adjust the movement size for edge scroll timeout testing

The goal of this test is to make sure that the deltas are less than 5, which
is the scroll trigger for movement-based edge scrolling. The litest suite
takes percentages of the device, so use a scale factor to change how far we
move on the tablet. The wacom tablet is 141mm, the movement must be smaller to
provide small-enough deltas.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: extend edge scrolling tests to all non-clickpads
Peter Hutterer [Tue, 21 Apr 2015 03:53:55 +0000 (13:53 +1000)]
test: extend edge scrolling tests to all non-clickpads

The single finger requirement dates back to when we couldn't configure the
scroll method. Now we can, so let's run the tests on as many suitable devices
as possible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: enable edge scrolling in all edge scroll tests
Peter Hutterer [Tue, 21 Apr 2015 02:05:36 +0000 (12:05 +1000)]
test: enable edge scrolling in all edge scroll tests

Just to make sure it is enabled (it should be anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: add --set-scroll-method commandline flag
Peter Hutterer [Tue, 21 Apr 2015 01:57:23 +0000 (11:57 +1000)]
tools: add --set-scroll-method commandline flag

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: accept but disable ABS_MISC and above for min/max == 0
Peter Hutterer [Fri, 17 Apr 2015 05:59:36 +0000 (15:59 +1000)]
evdev: accept but disable ABS_MISC and above for min/max == 0

This is sort-of legitimate, so simply disable the axes and continue.
Any real axis we require to have a real range.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: introduce MULTITAP for multi-tap-and-drag
Peter Hutterer [Thu, 16 Apr 2015 00:19:11 +0000 (10:19 +1000)]
touchpad: introduce MULTITAP for multi-tap-and-drag

Once we have a doubletap, enter a loop in the state machine where we can tap
multiple times and either get a multi-click or a multi-click drag-and-drop.

The sequence down/up down/up down/up produces a triple-click. The sequence
down/up down/up down/up down produces a triple-click with a button down for
dragging. Yes, that glorious octuple-tap-and-drag, it is now possible. World
domination has been achieved, thank you for playing.

We don't know when we finish tapping now, so add a timeout to send the last
click event once the finger has been released for the last time. This
guarantees that the timestamp of the last button down is later than the
last release. This avoids the bug fixed in synaptics commit
xf86-input-synaptics-1.8.0-21-g37d34f0 (some application don't handle
doubletap correctly without the timestamps).

This works for double-tap immediately, for multi-tap we need to remember the
timestamp of the first press event and use it for the release event so that
there's a forced gap between the release and the second press.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_is_button_event
Peter Hutterer [Thu, 16 Apr 2015 00:42:16 +0000 (10:42 +1000)]
test: add litest_is_button_event

Makes it easier from a caller to check for common things without all the other
boilerplate code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: middle button emulation tests
Peter Hutterer [Tue, 14 Apr 2015 04:43:53 +0000 (14:43 +1000)]
test: middle button emulation tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: enable middle button emulation on some touchpads
Peter Hutterer [Tue, 14 Apr 2015 04:40:49 +0000 (14:40 +1000)]
touchpad: enable middle button emulation on some touchpads

If the touchpad has left/right physical buttons but no middle button, force
middle button emulation - without a config option, it's always on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: enable middle button configuration on some devices
Peter Hutterer [Tue, 14 Apr 2015 04:41:39 +0000 (14:41 +1000)]
evdev: enable middle button configuration on some devices

Devices that have left and right buttons but no middle button get middle
button emulation (without config). Devices that have a middle button too get
a config option but default to off. Most mice have LMR set as buttons,
regardless whether they have a middle button.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: add support for middle button emulation
Peter Hutterer [Mon, 13 Apr 2015 06:38:44 +0000 (16:38 +1000)]
evdev: add support for middle button emulation

This is just the required framework, it's not hooked up to anything just yet.
Hooking it up comes as separate commit to better detail why/when a device
supports emulation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd middle mouse button emulation config options
Peter Hutterer [Tue, 14 Apr 2015 02:08:33 +0000 (12:08 +1000)]
Add middle mouse button emulation config options

Adds the following quartett of functions to enable/disable middle mouse button
emulation on a device:
libinput_device_config_middle_emulation_is_available()
libinput_device_config_middle_emulation_set_enabled()
libinput_device_config_middle_emulation_get_enabled()
libinput_device_config_middle_emulation_get_default_enabled()

This patch only adds the config framework, it is not hooked up to anything
yet.

Note: like other features this is merely the config option, some devices will
provide middle button emulation without exposing it as configuration. i.e. the
return value of libinput_device_config_middle_emulation_is_available() only
tells you whether you can _configure_ middle button emulation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: add evdev_pointer_notify_physical_button
Peter Hutterer [Mon, 13 Apr 2015 04:47:26 +0000 (14:47 +1000)]
evdev: add evdev_pointer_notify_physical_button

No functional changes at this point, this merely splits up any physical
buttons (i.e. that represent buttons that exist on that device) vs. other
buttons that are emulated in some way or another.

This is in preparation for the addition of middle button emulation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotoucphad: fix a comment for the new min touchpad palm detection size
Peter Hutterer [Tue, 14 Apr 2015 05:18:19 +0000 (15:18 +1000)]
toucphad: fix a comment for the new min touchpad palm detection size

Missing from 26062e84693341d5a6b7b33af91a50a9cd37dfe2

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