platform/upstream/libinput.git
7 years agoevdev: add a wrapper to get the evdev device from a libinput device
Peter Hutterer [Mon, 30 Jan 2017 09:48:33 +0000 (19:48 +1000)]
evdev: add a wrapper to get the evdev device from a libinput device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: improve type-safety on dispatch switches
Peter Hutterer [Mon, 30 Jan 2017 08:01:09 +0000 (18:01 +1000)]
evdev: improve type-safety on dispatch switches

Set the dispatch type on creation, then check that whenever we try to get the
dispatch struct. This avoids a potential mismatch between the backends.

Plus, use of container_of means we're not dependent on the exact layout
anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: for surface 3 tablets, write the lid open to the device
Peter Hutterer [Mon, 30 Jan 2017 02:58:37 +0000 (12:58 +1000)]
switch: for surface 3 tablets, write the lid open to the device

These tablets only ever give us a close event, the open event is broken. So
when we detect keyboard events, fix the kernel device's state by writing the
event to the fd.

We still sync the lid state manually, in case this fails and we don't get the
SW_LID through the normal event sequence. If it works fine, the real open
event will just be ignored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix two test udev rules
Peter Hutterer [Mon, 30 Jan 2017 03:27:40 +0000 (13:27 +1000)]
test: fix two test udev rules

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: mark all laptops as lid switch reliable
Peter Hutterer [Wed, 25 Jan 2017 07:41:54 +0000 (17:41 +1000)]
udev: mark all laptops as lid switch reliable

If the chassis type is 9 or 10 (Laptop, Notebook) let's assume that our lid
switch works. On anything else we leave it at unknown.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: hook up to keyboard events to fix the lid switch state
Peter Hutterer [Wed, 25 Jan 2017 05:21:52 +0000 (15:21 +1000)]
switch: hook up to keyboard events to fix the lid switch state

Extra insurance against broken lid switches. Listen to events from the
(internal) keyboard when we are logically closed. If any, assume we're open
after all and update accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd a helper function for initializing an event listener
Peter Hutterer [Wed, 25 Jan 2017 05:19:50 +0000 (15:19 +1000)]
Add a helper function for initializing an event listener

Not needed right now as everything assumes the listener was added before it
was removed. This helper is for the cases where we may call listener_remove
before it was ever added.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: move the lid switch bits into their own file
Peter Hutterer [Wed, 25 Jan 2017 04:31:05 +0000 (14:31 +1000)]
switch: move the lid switch bits into their own file

Keep this separate from the other code so it's easier to read

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: only sync the initial state if we know the state is reliable
Peter Hutterer [Wed, 25 Jan 2017 03:24:31 +0000 (13:24 +1000)]
switch: only sync the initial state if we know the state is reliable

This changes the default behavior to "disable the touchpad on the first lid
close event", thus filtering any laptops where the switch state is buggy and
always in "on" state. Devices where we know the lid switch state is
reliable can be marked as such.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: prevent switches to send the same event twice
Peter Hutterer [Wed, 25 Jan 2017 03:48:01 +0000 (13:48 +1000)]
switch: prevent switches to send the same event twice

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoswitch: sync the initial state of the switch on startup
Peter Hutterer [Tue, 24 Jan 2017 05:04:39 +0000 (15:04 +1000)]
switch: sync the initial state of the switch on startup

This is the default behavior, based on the theory of hardware actually doing
the right thing. That's not always the case, follow-up patches will change
when we do the theoretically ideal thing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoClarify the default 'off' position of a switch
Peter Hutterer [Tue, 24 Jan 2017 04:58:17 +0000 (14:58 +1000)]
Clarify the default 'off' position of a switch

So we don't need to send an "off" event for every switch on startup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: check for a switch type before handling the event
Peter Hutterer [Tue, 24 Jan 2017 02:16:08 +0000 (12:16 +1000)]
touchpad: check for a switch type before handling the event

Don't call get_switch_event immediately, doing so for non-switch events is
documented as a bug. Check the event type instead, if that one is correct then
we can assume the rest works.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: move the lid switch process functions together
Peter Hutterer [Tue, 24 Jan 2017 02:14:01 +0000 (12:14 +1000)]
evdev: move the lid switch process functions together

Don't sprinkle them across the file

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add tests for lid switch
James Ye [Fri, 20 Jan 2017 05:54:16 +0000 (16:54 +1100)]
test: add tests for lid switch

Ship a custom udev rule for the test device until systemd v333 is commonplace.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoPair touchpad and lid_switch for disable
James Ye [Fri, 20 Jan 2017 05:54:15 +0000 (16:54 +1100)]
Pair touchpad and lid_switch for disable

Add listener for lid switch events, disable touchpad on switch event.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd evdev_dispatch interface for lid switch
James Ye [Fri, 20 Jan 2017 05:54:14 +0000 (16:54 +1100)]
Add evdev_dispatch interface for lid switch

Create a lid_switch_interface to handle lid switch events, so the touchpad can
be disabled when lid is closed.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd a "switch" interface for parts of the SW_* range
James Ye [Fri, 20 Jan 2017 05:54:13 +0000 (16:54 +1100)]
Add a "switch" interface for parts of the SW_* range

This will allow switch devices known to libinput to be exposed. Currently,
this is SW_LID.

libinput also handles switch events internally, e.g. a laptop touchpad will
be disabled autmoatically when the lid is closed. This is transparent to
the caller, although the caller will also receive the event. See
https://bugs.freedesktop.org/show_bug.cgi?id=86223
This features is intended to be the main driver for the interface.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: James Ye <jye836@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoautogen.sh: exec the configure script
Peter Hutterer [Thu, 26 Jan 2017 04:31:19 +0000 (14:31 +1000)]
autogen.sh: exec the configure script

No point in waiting for it here, might as well pass the baton.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoautogen: add default patch prefix
Mihail Konev [Thu, 26 Jan 2017 04:00:21 +0000 (14:00 +1000)]
autogen: add default patch prefix

Signed-off-by: Mihail Konev <k.mvc@ya.ru>
7 years agotouchpad: use a helper function for the libinput context
Peter Hutterer [Wed, 25 Jan 2017 05:19:22 +0000 (15:19 +1000)]
touchpad: use a helper function for the libinput context

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: fix an error message
Peter Hutterer [Wed, 25 Jan 2017 03:03:28 +0000 (13:03 +1000)]
evdev: fix an error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoDrop normalized_get_direction, use physical distances instead
Peter Hutterer [Mon, 23 Jan 2017 00:43:04 +0000 (10:43 +1000)]
Drop normalized_get_direction, use physical distances instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotouchpad: convert normalized_length to physical coordinates
Peter Hutterer [Mon, 23 Jan 2017 00:29:56 +0000 (10:29 +1000)]
touchpad: convert normalized_length to physical coordinates

Now that the acceleration code doesn't use dpi-normalized coordinates anymore,
we don't need to use them in the touchpad code. Switch to physical distances
instead, it makes debugging a lot saner.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotouchpad: mask out ABS_MT if we don't have or disable MT
Peter Hutterer [Sun, 22 Jan 2017 23:55:03 +0000 (09:55 +1000)]
touchpad: mask out ABS_MT if we don't have or disable MT

Make sure the events we deal with are the ones we actually honor. This reduces
the chance that we accidentally process events we weren't event supposed to
get based on some earlier device decision.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoMerge branch 'wip/wheel-tilt-source'
Peter Hutterer [Fri, 20 Jan 2017 02:33:53 +0000 (12:33 +1000)]
Merge branch 'wip/wheel-tilt-source'

7 years agotest: add wheel tilt tests
Peter Hutterer [Mon, 28 Nov 2016 01:08:01 +0000 (11:08 +1000)]
test: add wheel tilt tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoMerge branch 'gcov'
Peter Hutterer [Fri, 20 Jan 2017 00:35:55 +0000 (10:35 +1000)]
Merge branch 'gcov'

7 years agotest: add test to set tap map on unsupported devices
Peter Hutterer [Mon, 16 Jan 2017 05:00:00 +0000 (15:00 +1000)]
test: add test to set tap map on unsupported devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: check the pad button state in litest_is_pad_button_event
Peter Hutterer [Mon, 16 Jan 2017 04:51:19 +0000 (14:51 +1000)]
test: check the pad button state in litest_is_pad_button_event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add tests for tablet buttons and button seat count
Peter Hutterer [Mon, 16 Jan 2017 04:50:07 +0000 (14:50 +1000)]
test: add tests for tablet buttons and button seat count

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add more tests for tap-drag config
Peter Hutterer [Mon, 16 Jan 2017 04:34:57 +0000 (14:34 +1000)]
test: add more tests for tap-drag config

Including one to get/set it on unsupported devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: ad calls to check whether pressure has changed
Peter Hutterer [Mon, 16 Jan 2017 04:23:49 +0000 (14:23 +1000)]
test: ad calls to check whether pressure has changed

Nothing actually called that function, sprinkle a few calls into existing
tests to make sure it actually works.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: test absence of scroll events on keyboards
Peter Hutterer [Mon, 16 Jan 2017 04:20:23 +0000 (14:20 +1000)]
test: test absence of scroll events on keyboards

Executes the paths to set invalid scroll methods.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add device size/no size checks
Peter Hutterer [Fri, 13 Jan 2017 07:01:33 +0000 (17:01 +1000)]
test: add device size/no size checks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a test for the tool ID
Peter Hutterer [Mon, 16 Jan 2017 00:57:56 +0000 (10:57 +1000)]
test: add a test for the tool ID

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a test for tablet pad event timestamps
Peter Hutterer [Mon, 16 Jan 2017 00:51:10 +0000 (10:51 +1000)]
test: add a test for tablet pad event timestamps

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for tablet_tool_get/set_user_data
Peter Hutterer [Sun, 15 Jan 2017 23:29:29 +0000 (09:29 +1000)]
test: add test for tablet_tool_get/set_user_data

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a tablet tool capability check
Peter Hutterer [Fri, 13 Jan 2017 06:44:15 +0000 (16:44 +1000)]
test: add a tablet tool capability check

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a test to force a destroy for the path backend
Peter Hutterer [Fri, 13 Jan 2017 05:57:45 +0000 (15:57 +1000)]
test: add a test to force a destroy for the path backend

The test suite (and tests) we have now all clean up nicely before calling the
final libinput_unref(). Add one where there's at least one device still
connected.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add some device capability checks
Peter Hutterer [Fri, 13 Jan 2017 05:50:23 +0000 (15:50 +1000)]
test: add some device capability checks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for fetching invalid pointer axes
Peter Hutterer [Fri, 13 Jan 2017 05:44:33 +0000 (15:44 +1000)]
test: add test for fetching invalid pointer axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: test for libinput_device_get/set_user_data
Peter Hutterer [Fri, 13 Jan 2017 05:39:07 +0000 (15:39 +1000)]
test: test for libinput_device_get/set_user_data

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add tests for checking for buttons for a non-pointer device
Peter Hutterer [Fri, 13 Jan 2017 02:18:43 +0000 (12:18 +1000)]
test: add tests for checking for buttons for a non-pointer device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: make all property parsing helpers ignore NULL strings
Peter Hutterer [Fri, 13 Jan 2017 02:03:29 +0000 (12:03 +1000)]
util: make all property parsing helpers ignore NULL strings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for invalid path operations on udev backends
Peter Hutterer [Fri, 13 Jan 2017 01:46:38 +0000 (11:46 +1000)]
test: add test for invalid path operations on udev backends

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for invalid udev_assign_seat on path context
Peter Hutterer [Fri, 13 Jan 2017 01:28:47 +0000 (11:28 +1000)]
test: add test for invalid udev_assign_seat on path context

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add helper function to install a "bug expected" log handler
Peter Hutterer [Fri, 13 Jan 2017 01:44:28 +0000 (11:44 +1000)]
test: add helper function to install a "bug expected" log handler

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a test for keyboard LED updates
Peter Hutterer [Fri, 13 Jan 2017 01:24:14 +0000 (11:24 +1000)]
test: add a test for keyboard LED updates

Not much we can check for here anyway, but at least we can trigger the code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoHook up gcov for coverage reports
Peter Hutterer [Thu, 5 Jan 2017 05:21:24 +0000 (15:21 +1000)]
Hook up gcov for coverage reports

./configure --enable-gcov adds the required flags to link everything ready for
gcov. A new make gcov target runs the test suite, then pulls all the gcov bits
together into ./test/gcov-reports/ including a summary file.

The script to pull everything out is used in libevdev too, we just have an
extra condition here to ignore the selftest gcov bits (it overwrites the
useful litest.c coverage output).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: libinput 1.6.0 1.6.0
Peter Hutterer [Thu, 19 Jan 2017 22:29:28 +0000 (08:29 +1000)]
configure.ac: libinput 1.6.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofilter: normalize deltas before processing or returning them
Peter Hutterer [Wed, 18 Jan 2017 07:58:36 +0000 (17:58 +1000)]
filter: normalize deltas before processing or returning them

When the filter code switched to raw device coordinates (bdd4264d) the input
data remained in device coordinates. Since the factor for touchpads was still
based on the physical velocity (and thus all touchpads get the same
acceleration factor for identical moves), the actual delta was dependent on
the resolution. e.g.

touchpad with 40u/mm: delta of 2/2 * accel factor 2 -> accel delta of 4/4
touchpad with 20u/mm: delta of 1/1 * accel factor 2 -> accel delta of 2/2

The normalized coordinates should be independent of the touchpad's resolution
though.

Affected by this was the standard mouse accel code and the touchpad accel
code, other filters always returned unnormalized coordinates (separate bug,
not addressed here).

This patch restores the correct behaviour for mice and touchpads
while leaving the special filters untouched. For comparision:
* 1000+dpi mice: accelerate normalized, return normalized
* touchpads: accelerate unnormalized, return normalized
* low-dpi mice: accelerate unnormalized, return unnormalized
* trackpoints: accelerate unnormalized, return unnormalized
* x230: don't touch, already does the right thing

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agofilter: change the tracker delta type to device-units
Peter Hutterer [Wed, 18 Jan 2017 07:22:30 +0000 (17:22 +1000)]
filter: change the tracker delta type to device-units

We were just switching type here without actual normalization, the filter code
is in device units as of bdd4264d6150f4a6248eec7.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agogitignore: add test suite runner binary to gitignore
Peter Hutterer [Tue, 17 Jan 2017 23:10:12 +0000 (09:10 +1000)]
gitignore: add test suite runner binary to gitignore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoUpdate gitignore for new test source names
Peter Hutterer [Tue, 17 Jan 2017 05:59:26 +0000 (15:59 +1000)]
Update gitignore for new test source names

Fallout from 5d66edc9f413a35d

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoFix typos in Documentation
Rohith Mukku [Tue, 17 Jan 2017 19:41:22 +0000 (01:11 +0530)]
Fix typos in Documentation

Signed-off-by: Rohith Mukku <rohithmukku@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: check if left-handed is available for the left-handed tests
Peter Hutterer [Tue, 10 Jan 2017 00:50:52 +0000 (10:50 +1000)]
test: check if left-handed is available for the left-handed tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix some tablet tests' unreached code
Peter Hutterer [Fri, 6 Jan 2017 02:46:53 +0000 (12:46 +1000)]
test: fix some tablet tests' unreached code

These conditions were never triggered by our test suite, so let's tighten up
the tests to match what we expect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix pointer accel defaults test
Peter Hutterer [Thu, 5 Jan 2017 10:27:18 +0000 (20:27 +1000)]
test: fix pointer accel defaults test

Loop immediately exited, this code was never triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: simplify some checks in the path test
Peter Hutterer [Thu, 5 Jan 2017 10:15:56 +0000 (20:15 +1000)]
test: simplify some checks in the path test

The first event is always a device added event, skip the loops that would
paper over this. If we ever change this, the tests *should* fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: remove some untriggered code from the keyboard tests
Peter Hutterer [Thu, 5 Jan 2017 10:11:26 +0000 (20:11 +1000)]
test: remove some untriggered code from the keyboard tests

The second condition was never triggered because we shouldn't get anything but
keyboard events here. Drain the initial event burst and remove the two
skipping conditions that won't happen anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoFix doxygen references for natural scroll config
Peter Hutterer [Mon, 16 Jan 2017 06:24:02 +0000 (16:24 +1000)]
Fix doxygen references for natural scroll config

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: libinput 1.6rc2 1.5.902
Peter Hutterer [Mon, 16 Jan 2017 03:08:52 +0000 (13:08 +1000)]
configure.ac: libinput 1.6rc2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: fix parse_hwdb.py to work with pyparsing 2.1.10
Peter Hutterer [Mon, 16 Jan 2017 02:57:27 +0000 (12:57 +1000)]
udev: fix parse_hwdb.py to work with pyparsing 2.1.10

From systemd commit f644a6da7a: "pyparsing 2.1.10 fixed the handling of
LineStart to really just apply to line starts and not ignore whitespace and
comments any more. Adjust EMPTYLINE to this."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: rename wacom test devices to a consistent naming scheme
Peter Hutterer [Mon, 16 Jan 2017 01:11:45 +0000 (11:11 +1000)]
test: rename wacom test devices to a consistent naming scheme

Use the model names in the file name and append pad/pen/finger as appropriate

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRevert "Remove the workaround for libevdev pre 1.3"
Peter Hutterer [Mon, 16 Jan 2017 00:23:59 +0000 (10:23 +1000)]
Revert "Remove the workaround for libevdev pre 1.3"

I'm using semaphore CI for build testing and that only provides Ubuntu 14.04
which doesn't have libevdev 1.3 or later.

Since this is a minor workaround for an error case only, revert the commit
again and leave the handling in. Less effort than having to patch around it in
semaphore.

This reverts commit 1e0736daf3bc4c728a5bc8ecd1b55e25c67f1410.

7 years agotest: remove tablet axis normalization test
Peter Hutterer [Fri, 6 Jan 2017 03:13:00 +0000 (13:13 +1000)]
test: remove tablet axis normalization test

gcov analysis showed that none of the actual testing conditions were hit, so
the test succeeded despite not actually testing anything. Which is good,
because testing for tilt normalization isn't correct anyway, tilt is in
physical degrees,

Drop the test and replace it with a test for pressure normalization instead.
We already have a similar one to check for [0, 1] range, this new one
explicitly tests for the extents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix a comment regarding uinput's resolution assignment
Peter Hutterer [Fri, 13 Jan 2017 06:03:55 +0000 (16:03 +1000)]
test: fix a comment regarding uinput's resolution assignment

This isn't true anymore with kernel 4.5 and libevdev 1.5.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRemove the workaround for libevdev pre 1.3
Peter Hutterer [Fri, 13 Jan 2017 06:01:40 +0000 (16:01 +1000)]
Remove the workaround for libevdev pre 1.3

1.3 has been out since Sep 2014, that's enough time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: move check for seat_id down
Peter Hutterer [Fri, 13 Jan 2017 01:48:49 +0000 (11:48 +1000)]
udev: move check for seat_id down

Don't access the struct until we've verified it is what we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: prefix all test source files with "test-"
Peter Hutterer [Fri, 13 Jan 2017 00:25:56 +0000 (10:25 +1000)]
test: prefix all test source files with "test-"

They weren't originally prefixed but the various tests were, but now that we
only have one test runner binary anyway, the prefix helps sorting the files
easily within e.g. gcov results.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRename path.(c|h) to path-seat.(c|h)
Peter Hutterer [Fri, 13 Jan 2017 00:18:22 +0000 (10:18 +1000)]
Rename path.(c|h) to path-seat.(c|h)

More consistency with udev-seat.(c|h) and no filename conflict with
test/path.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: use some helper functions
Peter Hutterer [Wed, 11 Jan 2017 07:34:23 +0000 (17:34 +1000)]
test: use some helper functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix some empty queue handling
Peter Hutterer [Wed, 11 Jan 2017 06:17:33 +0000 (16:17 +1000)]
test: fix some empty queue handling

Use the litest_assert_empty_queue() instead of manual checking, and remove the
manual checks after the function call.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: skip a few unnecessary base event conversions
Peter Hutterer [Wed, 11 Jan 2017 05:22:36 +0000 (15:22 +1000)]
test: skip a few unnecessary base event conversions

These were just there so we didn't have an unused variable warning, but
there's no reason even assigning to anything in the first place

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a synaptics RMI4 test device
Peter Hutterer [Thu, 12 Jan 2017 03:37:43 +0000 (13:37 +1000)]
test: add a synaptics RMI4 test device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: mark Asus X555LAB as touchpad with visible marker
Peter Hutterer [Mon, 9 Jan 2017 22:20:52 +0000 (08:20 +1000)]
udev: mark Asus X555LAB as touchpad with visible marker

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotouchpad: add a model tag to mark touchpads with visible marker
Peter Hutterer [Mon, 9 Jan 2017 01:27:06 +0000 (11:27 +1000)]
touchpad: add a model tag to mark touchpads with visible marker

We used to mark dell touchpads this way but let's make this more generic.
Nothing else used the dell touchpad model flag, so we can simply replace it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoRemove a couple of double semicolons
Peter Hutterer [Tue, 10 Jan 2017 23:59:59 +0000 (09:59 +1000)]
Remove a couple of double semicolons

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoconfigure.ac: libinput 1.6rc1 1.5.901
Peter Hutterer [Mon, 9 Jan 2017 05:33:27 +0000 (15:33 +1000)]
configure.ac: libinput 1.6rc1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: swap order for selftest and test suite
Peter Hutterer [Mon, 9 Jan 2017 01:01:59 +0000 (11:01 +1000)]
test: swap order for selftest and test suite

Making sure the test suite behaves as expected should be done before we use
it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: add support for wheel tilt
Peter Hutterer [Mon, 28 Nov 2016 00:52:16 +0000 (10:52 +1000)]
evdev: add support for wheel tilt

This is added on top of the click angle handling, so the actual axis values
simply fall back onto whatever is set by udev, including the default fallbacks
to 15 and whatnot.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoevdev: add helper function to parse a udev flag
Peter Hutterer [Mon, 28 Nov 2016 00:17:03 +0000 (10:17 +1000)]
evdev: add helper function to parse a udev flag

Only allow values of 0 and 1 for udev flags. Not that I'm aware of anyone
using anything else (i.e. his shouldn't break anything) but it's best to be as
restrictive as possible here.

Bonus effect: it's now possible to unset LIBINPUT_MODEL_* tags as well,
previously any value (including 0) was counted as "yes".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoAdd wheel tilt as axis source
Peter Hutterer [Sun, 27 Nov 2016 23:44:04 +0000 (09:44 +1000)]
Add wheel tilt as axis source

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotools: reduce some spacing to compress the output a bit
Peter Hutterer [Tue, 3 Jan 2017 00:12:32 +0000 (10:12 +1000)]
tools: reduce some spacing to compress the output a bit

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: align device notify output better
Peter Hutterer [Tue, 3 Jan 2017 00:03:47 +0000 (10:03 +1000)]
tools: align device notify output better

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: size in mm is enough, no need for sub-mm precision here
Peter Hutterer [Tue, 3 Jan 2017 00:01:06 +0000 (10:01 +1000)]
tools: size in mm is enough, no need for sub-mm precision here

Also changes from W/H to WxH format

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add allowed range to --set-speed help output
Peter Hutterer [Mon, 2 Jan 2017 21:58:18 +0000 (07:58 +1000)]
tools: add allowed range to --set-speed help output

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for the vertical position-dependent pinch
Peter Hutterer [Tue, 20 Dec 2016 23:44:27 +0000 (09:44 +1000)]
test: add test for the vertical position-dependent pinch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agogestures: if fingers don't move, force a gesture by finger position
Peter Hutterer [Tue, 20 Dec 2016 00:36:37 +0000 (10:36 +1000)]
gestures: if fingers don't move, force a gesture by finger position

If the fingers rest on the touchpad without moving for a timeout, switch to
pinch or swipe based on the finger position. We already switched to two-finger
scrolling based on the timeout, now we also do so for 3 and 4 finger gestures.
This gives us better reaction to small movements.

This also fixes previously unreachable code: the test for the finger position
required at least 3 fingers down but was within a condition that ensured only
2 fingers were down. This was introduced in 11917061fe320c.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotablet: ignore MSC_SCAN
Peter Hutterer [Tue, 13 Sep 2016 23:43:39 +0000 (09:43 +1000)]
tablet: ignore MSC_SCAN

Sent by some HUION tablets

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: reduce the tap movement threshold to 1.3mm
Peter Hutterer [Fri, 2 Dec 2016 01:45:44 +0000 (11:45 +1000)]
touchpad: reduce the tap movement threshold to 1.3mm

When a finger moves less than the movement threshold, motion is filtered until
the timeout is hit. If the threshold is too high the responsiveness of the
pointer suffers.

Event analysis from several users showed that 95% of the touches move less
than 1.3mm long. Reducing the threshold should have almost no impact on most
tapping users but improves the reaction time of the pointer for normal
movements.

For a more details see:
http://who-t.blogspot.com/2016/12/libinput-touchpad-tap-analysis.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotouchpad: reduce the initial timeout for tapping after touch
Peter Hutterer [Fri, 2 Dec 2016 01:35:51 +0000 (11:35 +1000)]
touchpad: reduce the initial timeout for tapping after touch

This is the timeout before we decide "this is just a finger down, not a tap".
Until this timeout is hit a finger's movement is filtered. To allow for a more
responsive touchpad, we want that timeout as short as possible.

Event analysis from several users showed that 95% of the touches are less than
100ms long. Reducing the threshold should have almost no impact on most
tapping users but improves the reaction time of the pointer for normal
movements.

For a more details see:
http://who-t.blogspot.com/2016/12/libinput-touchpad-tap-analysis.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agoMerge branch 'touchpad-pointer-accel-revamp'
Peter Hutterer [Wed, 21 Dec 2016 01:34:37 +0000 (11:34 +1000)]
Merge branch 'touchpad-pointer-accel-revamp'

7 years agofilter: tweak the magic slowdown
Peter Hutterer [Wed, 14 Dec 2016 09:51:13 +0000 (19:51 +1000)]
filter: tweak the magic slowdown

Could be confirmation bias, but it feels better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agodoc: update the touchpad pointer acceleration svg
Peter Hutterer [Mon, 19 Dec 2016 02:18:42 +0000 (12:18 +1000)]
doc: update the touchpad pointer acceleration svg

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agofilter: revamp the touchpad's acceleration code
Peter Hutterer [Wed, 14 Dec 2016 09:40:18 +0000 (19:40 +1000)]
filter: revamp the touchpad's acceleration code

The previous code had three main issues:
* acceleration kicked in too early, so even slow movements were accelerated
* acceleration kicked in too quickly, there was only a very narrow window
  where we would have less than the max acceleration factor
* the max accel factor was too low for fast movements, so they still fell
  short of expectations

This patch revamps most of the acceleration though it keeps the basic shape of
the acceleration curve.

* The threshold is increased significantly so that faster movement
  still map to the finger movement. Acceleration doesn't kick in until we get
  to something that's really fast like a flick.
* The incline is dropped, so acceleration kicks in slower than before, i.e.
  the difference between the first speed that is accelerated and the speed
  that reaches the maximum is higher than before.
* The maximum acceleration is increased so ever faster movements get ever
  faster. The max is effectively out of reach now, if you move fast enough to
  hit this speed, your cursor will end up on the moon anyway.

A couple of other changes apply now too, specifically:
* The incline remains the same regardless of the speed
* The max accel factor remains the same regardless of the speed

The caculated factor changes with the speed set so that the base speed changes
with the desired speed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agotools: switch the ptraccel-debug printf to use mm/s
Peter Hutterer [Thu, 15 Dec 2016 22:22:54 +0000 (08:22 +1000)]
tools: switch the ptraccel-debug printf to use mm/s

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agofilter: work the touchpad magic slowdown into the various parameters
Peter Hutterer [Thu, 15 Dec 2016 06:23:57 +0000 (16:23 +1000)]
filter: work the touchpad magic slowdown into the various parameters

We have everything separate from the mouse now, so having a magic slowdown
isn't needed, we can work this into our parameters. So the acceleration
function now uses everything adjusted, but the factor is still multiplied by
the slowdown in the end.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agofilter: change touchpad accel code to use mm/s
Peter Hutterer [Thu, 15 Dec 2016 04:15:22 +0000 (14:15 +1000)]
filter: change touchpad accel code to use mm/s

That's something human brains can map to because mapping a touchpad to
equivalent units of a 1000dpi mouse requires a lot of mental acrobatics. And
I'm getting older and my physio told me acrobatics is more something for the
youngens, possibly those on my lawn listening to terrible music, etc.

The various numbers are converted either times 25.4/1000 or times 1000/25.4,
depending on the usage. Somewhere I made a mistake or a rounding error or
something, so the acceleration curve is not exactly the same, but it's close
enough that it shouldn't matter. The difference shows up in a gnuplot of the
curve but it may not even perceivable anyway. And these values will be
overhauled soon anyway, so meh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>