platform/upstream/libinput.git
7 years agotablet: always enable the no-proximity-out quirk on HUION tablets
Peter Hutterer [Wed, 20 Sep 2017 00:50:19 +0000 (10:50 +1000)]
tablet: always enable the no-proximity-out quirk on HUION tablets

And instead disable it when we do get a proximity out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
7 years agoevdev: update key type check for new key defines
Peter Hutterer [Wed, 20 Sep 2017 23:07:49 +0000 (09:07 +1000)]
evdev: update key type check for new key defines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoinclude: sync linux kernel header files with 4.12
Peter Hutterer [Wed, 20 Sep 2017 23:05:32 +0000 (09:05 +1000)]
include: sync linux kernel header files with 4.12

To get the new key defines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: add a comment to the toggle_touch interface
Peter Hutterer [Tue, 19 Sep 2017 03:23:48 +0000 (13:23 +1000)]
evdev: add a comment to the toggle_touch interface

And remove an unnecessary one

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: drop unused #define DEFAULT_TRACKPOINT_ACCEL
Peter Hutterer [Tue, 19 Sep 2017 03:59:06 +0000 (13:59 +1000)]
evdev: drop unused #define DEFAULT_TRACKPOINT_ACCEL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: drop unused enum value DISPATCH_LID_SWITCH
Peter Hutterer [Tue, 19 Sep 2017 04:00:05 +0000 (14:00 +1000)]
evdev: drop unused enum value DISPATCH_LID_SWITCH

Obsolete since f0f632649066c4fc92ec3178b9da747758cb7bb8

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotablet: support tablet devices without BTN_TOOL_PEN
Peter Hutterer [Mon, 11 Sep 2017 00:32:42 +0000 (10:32 +1000)]
tablet: support tablet devices without BTN_TOOL_PEN

Some devices like the UC Logic WP5540U has BTN_STYLUS but not BTN_TOOL_PEN.
While a kernel bug, let's just handle these correctly anyway.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Yay-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
7 years agotablet: add a quirk for the HUION PenTablet that doesn't send proximity out events
Peter Hutterer [Thu, 22 Dec 2016 02:11:43 +0000 (12:11 +1000)]
tablet: add a quirk for the HUION PenTablet that doesn't send proximity out events

Could be fixed in the kernel, but these tablets are effectively abandoned and
fixing them is a one-by-one issue. Let's put the infrastructure in place to
have this fixed once for this type of device and move on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Yay-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
7 years agotest: remove leftover sleep() for debugging in lid switch test
Peter Hutterer [Tue, 19 Sep 2017 00:51:32 +0000 (10:51 +1000)]
test: remove leftover sleep() for debugging in lid switch test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: remove duplicate device name in log message
Peter Hutterer [Tue, 12 Sep 2017 00:09:51 +0000 (10:09 +1000)]
evdev: remove duplicate device name in log message

evdev_log_* already writes the device name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: don't resume a disabled touchpad
Peter Hutterer [Tue, 5 Sep 2017 04:38:53 +0000 (14:38 +1000)]
touchpad: don't resume a disabled touchpad

A touchpad that was disabled by toggling the sendevents option would come back
normally after a lid resume, despite still being nominally disabled.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add --disable-sendevents option to the debug-events/debug-gui tools
Peter Hutterer [Tue, 5 Sep 2017 04:12:09 +0000 (14:12 +1000)]
tools: add --disable-sendevents option to the debug-events/debug-gui tools

Makes it possible to debug issues with sendevents.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd helper function for time to timeval conversion
Peter Hutterer [Thu, 22 Dec 2016 01:33:19 +0000 (11:33 +1000)]
Add helper function for time to timeval conversion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/ignore-moved-touches'
Peter Hutterer [Sun, 10 Sep 2017 23:43:24 +0000 (09:43 +1000)]
Merge branch 'wip/ignore-moved-touches'

7 years agoMerge branch 'wip/sw-tablet-mode'
Peter Hutterer [Sun, 10 Sep 2017 23:02:14 +0000 (09:02 +1000)]
Merge branch 'wip/sw-tablet-mode'

7 years agofilter: don't allow an accel factor of 0 on the flat profile
Peter Hutterer [Mon, 4 Sep 2017 05:10:58 +0000 (15:10 +1000)]
filter: don't allow an accel factor of 0 on the flat profile

Leave a narrow gap so the mouse moves excruciatingly slow instead of not
moving at all. This allows to recover from overexcited mouse speed slider
movements.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: move the EKR into the parent's device group
Peter Hutterer [Wed, 30 Aug 2017 05:53:01 +0000 (15:53 +1000)]
udev: move the EKR into the parent's device group

If we find an EKR, search for the usb hub of the Cintiq, then find the Cintiq
Pen (or Touch) device and assume that device's product id. This way we end up
in the same device group as the Cintiq.

Co-authored-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: add a safe_atoi_base() function
Peter Hutterer [Wed, 30 Aug 2017 05:52:41 +0000 (15:52 +1000)]
util: add a safe_atoi_base() function

For parsing hex numbers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: if a device has a tablet mode switch, disable the touchpad
Peter Hutterer [Fri, 1 Sep 2017 07:30:08 +0000 (17:30 +1000)]
touchpad: if a device has a tablet mode switch, disable the touchpad

On some devices with a tablet mode switch, the touchpad is inacessible when
in tablet mode and we don't really need this except to avoid possible ghost
touches (none have been mentioned so far). On other devices like the Lenovo
Yoga, the touchpad points to the back of the device and it's hard to use the
device without accidentally using the touchpad. For those, disabling the
touchpad is the best solution.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd support for SW_TABLET_MODE
Peter Hutterer [Fri, 21 Apr 2017 07:52:37 +0000 (17:52 +1000)]
Add support for SW_TABLET_MODE

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: move lid code to the fallback interface
Peter Hutterer [Mon, 4 Sep 2017 00:40:04 +0000 (10:40 +1000)]
evdev: move lid code to the fallback interface

This was originally designed to deal with devices that only have SW_LID. But
it can be moved into the evdev interface to avoid duplication once we have
SW_TABLET_MODE. The original assumption of the lid switch device being a
standalone device with no other switches is not true, having a separate
dispatch hurts us here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: remove a leftover debug printf statement
Peter Hutterer [Tue, 5 Sep 2017 04:03:28 +0000 (14:03 +1000)]
tools: remove a leftover debug printf statement

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd libinput_device_switch_has_switch()
Peter Hutterer [Fri, 21 Apr 2017 06:57:39 +0000 (16:57 +1000)]
Add libinput_device_switch_has_switch()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: make some of the switch tests more generic
Peter Hutterer [Fri, 21 Apr 2017 07:31:49 +0000 (17:31 +1000)]
test: make some of the switch tests more generic

Still hardcoded for lid switches, but easier to change for other switches now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add test for switch capability
Peter Hutterer [Sun, 23 Apr 2017 22:22:08 +0000 (08:22 +1000)]
test: add test for switch capability

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: rename 'sw' to 'dev' for the lid tests
Peter Hutterer [Fri, 21 Apr 2017 07:27:27 +0000 (17:27 +1000)]
test: rename 'sw' to 'dev' for the lid tests

More in line with other tests and allows us to use 'sw' as name for the actual
switch to be toggled later. The variable name 'sw' stays in those tests where
we have touchpad/keyboard/etc. devices as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: remove declarations for two nonexistent functions
Peter Hutterer [Tue, 5 Sep 2017 00:33:23 +0000 (10:33 +1000)]
evdev: remove declarations for two nonexistent functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: restore option handling for the debug gui
Peter Hutterer [Mon, 4 Sep 2017 05:07:05 +0000 (15:07 +1000)]
tools: restore option handling for the debug gui

window_init zeroes out the struct and loses any option parsing done before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: remove unused argument from evdev_tag_lid_switch
Peter Hutterer [Fri, 1 Sep 2017 07:28:33 +0000 (17:28 +1000)]
evdev: remove unused argument from evdev_tag_lid_switch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: rename the lid_switch_listener to just listener
Peter Hutterer [Fri, 1 Sep 2017 07:08:17 +0000 (17:08 +1000)]
touchpad: rename the lid_switch_listener to just listener

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: make the lid action helper function a generic switch action helper
Peter Hutterer [Fri, 21 Apr 2017 06:33:02 +0000 (16:33 +1000)]
test: make the lid action helper function a generic switch action helper

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: rename test-lid.c to test-switch.c
Peter Hutterer [Fri, 21 Apr 2017 02:05:33 +0000 (12:05 +1000)]
test: rename test-lid.c to test-switch.c

So we can add other switch tests to it without confusing too many people.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: use motion speed to ignore accidental 2fg touches
Peter Hutterer [Wed, 21 Jun 2017 02:29:52 +0000 (12:29 +1000)]
touchpad: use motion speed to ignore accidental 2fg touches

Calculate the speed of the touch and compare it against a fixed speed limit.
If a touch exceeds the speed when a second touch is set down, that second
touch is marked as a thumb and ignored (unless it's right next to the other
finger, then it's likely a 2fg scroll).

The speed calculation is simple but has to lag behind by one sample - we reset
the motion history whenever a new finger is set down (to avoid pointer jumps)
so we need to know if the finger was moving fast *before* this happens. Plus,
with the pointer jumps we're more likely to get false positives if we
calculate the speed on actual finger down.

This is the simplest version for now, the speed varies greatly between
movements and should probably be averaged across the last 3-or-so samples.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: store the time in the motion history
Peter Hutterer [Wed, 21 Jun 2017 01:16:27 +0000 (11:16 +1000)]
touchpad: store the time in the motion history

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: ignore thumbs during edge scrolling
Peter Hutterer [Wed, 30 Aug 2017 04:00:09 +0000 (14:00 +1000)]
touchpad: ignore thumbs during edge scrolling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix the litest_touch_move_to() step counter
Peter Hutterer [Wed, 30 Aug 2017 04:49:05 +0000 (14:49 +1000)]
test: fix the litest_touch_move_to() step counter

We were undercounting by one, causing a slight jump by (step-distance * 2) on
the last event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix indentation for palm touch size test
Peter Hutterer [Wed, 30 Aug 2017 03:49:32 +0000 (13:49 +1000)]
test: fix indentation for palm touch size test

Somehow this ended up being spaces instead of tabs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a test for removing a touch device with a finger still down
Peter Hutterer [Mon, 28 Aug 2017 02:03:54 +0000 (12:03 +1000)]
test: add a test for removing a touch device with a finger still down

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: accept accelerometers if they are tagged as other devices too
Peter Hutterer [Thu, 17 Aug 2017 19:32:02 +0000 (05:32 +1000)]
evdev: accept accelerometers if they are tagged as other devices too

Devices tagged as accelerometers may also be other devices like tablet pads.
Only ignore pure accelerometer devices but disable the accelerometer axes for
devices that have multiple types.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
7 years agotest: fix pad ring test for small pad ranges
Peter Hutterer [Sun, 27 Aug 2017 23:16:53 +0000 (09:16 +1000)]
test: fix pad ring test for small pad ranges

The current tests worked because all rings had the same range, so our error
margin covered for that. With the upcoming MobileStudio Pro 16 pad device, the
range is half and our error margins don't work anymore. Switch to a more
reliable approach that tests every integer value the wheel can send, even
though it relies on kernel filtering.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd support for LIBINPUT_IGNORE_DEVICE
Peter Hutterer [Wed, 16 Aug 2017 23:25:24 +0000 (01:25 +0200)]
Add support for LIBINPUT_IGNORE_DEVICE

The recommended way to have libinput ignore specific devices so far was to
remove the ID_INPUT* properties from the device. That may also affect other
pieces of the stack that need access to this device.

For the niche case of a device that should only be ignored by libinput but
otherwise be treated normally by the system, we now support the
LIBINPUT_IGNORE_DEVICE property.

If the property is set to "0", it's equivalent to being unset. This gets
around some technical limitations in udev where unsetting a property is
impossible via a hwdb entry.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: expose litest_create() to test cases
Peter Hutterer [Thu, 17 Aug 2017 00:07:18 +0000 (02:07 +0200)]
test: expose litest_create() to test cases

And make it init the full litest device minus the libinput device. This
enables us to add litest devices that aren't handled by libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: update pressure range for Dell Latitude E6620
Peter Hutterer [Mon, 21 Aug 2017 01:41:19 +0000 (11:41 +1000)]
udev: update pressure range for Dell Latitude E6620

"This gives some more sensitivity to the fingers without introducing spurious
touches and movements."

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agobuild: Add -Iinclude to unit tests
Philip Withnall [Fri, 18 Aug 2017 08:13:33 +0000 (09:13 +0100)]
build: Add -Iinclude to unit tests

It seems the unit tests rely on another part of <linux/input.h> which I
missed in the previous commit (5cf4b35b).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agobuild: Add -Iinclude to libinput and its tools
Philip Withnall [Tue, 15 Aug 2017 14:42:48 +0000 (15:42 +0100)]
build: Add -Iinclude to libinput and its tools

Various files use #include <linux/input.h> and, if the system input.h is
too old, will fail to compile. Use the internal copy by adding -Iinclude
to the build command lines. This was the case in the old autotools build
system.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix typo in test case name
Peter Hutterer [Thu, 17 Aug 2017 00:02:56 +0000 (02:02 +0200)]
test: fix typo in test case name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: when restoring the log handler to defaults, also restore log priority
Peter Hutterer [Wed, 16 Aug 2017 23:28:52 +0000 (01:28 +0200)]
test: when restoring the log handler to defaults, also restore log priority

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: Allow larger palm sizes.
Ronald Tschalär [Fri, 4 Aug 2017 21:38:38 +0000 (14:38 -0700)]
touchpad: Allow larger palm sizes.

On MBP13,3 the touch areas are quite large, and a thumb size easily gets
to 1000+. Hence need to be able to set palm sizes > 1024 (using 1200
currently).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: disable evdev event debugging again
Peter Hutterer [Thu, 3 Aug 2017 16:39:46 +0000 (17:39 +0100)]
evdev: disable evdev event debugging again

This snuck in with 432fbc33cd6a2181ac213eeb66239df8312836a6

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: Enable timestamp smoothing support for bluetooth touchpads
Hans de Goede [Sun, 2 Jul 2017 14:35:36 +0000 (16:35 +0200)]
touchpad: Enable timestamp smoothing support for bluetooth touchpads

Bluetooth wreaks havoc with the timestamp of the input events coming
from the touchpad, enable timestamp smoothing support to counter this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofilter: Add timestamp smoothing support
Hans de Goede [Sun, 2 Jul 2017 14:35:35 +0000 (16:35 +0200)]
filter: Add timestamp smoothing support

Some devices, specifically some bluetooth touchpads generate quite
unreliable timestamps for their events. The problem seems to be that
(some of) these touchpads sample at aprox 90 Hz, but the bluetooth stack
only communicates about every 30 ms (*) and then sends mutiple HID input
reports in one batch.

This results in 2-4 packets / SYNs every 30 ms. With timestamps really
close together. The finger coordinate deltas in these packets change by
aprox. the same amount between each packet when moving a finger at
constant speed. But the time deltas are e.g. 28 ms, 1 ms, 1 ms resulting
in calculate_tracker_velocity returning vastly different speeds for the
1st and 2nd packet, which in turn results in very "jerky" mouse pointer
movement.

*) Maybe it is waiting for a transmit time slot or some such.

This commit adds support for a real simple timestamp smoothing algorithm,
intended *only* for use with touchpads. Since touchpads will send a
contineous stream of events at their sample rate when a finger is down,
this filter simply assumes that any events which are under
event_delta_smooth_threshold us apart are part of a smooth continuous
stream of events with each event being event_delta_smooth_value us apart.

Theoritically a very still finger may send the exact same coordinates
and pressure twice, but even if this happens that is not a problem because
a still finger generates coordinates changes below the hyst treshold so
we ignore it anyways.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agogestures: don't try to pinch for nfingers > slots
Peter Hutterer [Sat, 29 Jul 2017 12:59:40 +0000 (13:59 +0100)]
gestures: don't try to pinch for nfingers > slots

We don't know the position of the third finger on 2-slot touchpads, differing
between swipe and pinch is reliable. Simply disable 3-finger pinch and always
use swipe; 3fg pinch is uncommon anyway and it's better to have one of the
gestures working reliably than both unreliably.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
7 years agolid: disable all types but EV_SYN and EV_SW
Peter Hutterer [Mon, 24 Jul 2017 23:38:46 +0000 (09:38 +1000)]
lid: disable all types but EV_SYN and EV_SW

The lid dispatch interface is a one-trick pony and can only handle SW_LID. It
ignores other switches but crashes on any event type other than EV_SW and
EV_SYN. Disable those types so we just ignore the event instead of asserting.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
7 years agopointer: add button debouncing
Peter Hutterer [Fri, 14 Jul 2017 03:42:53 +0000 (13:42 +1000)]
pointer: add button debouncing

Some devices have worn-out switches or just cheap switches that trigger
multiple button events for each press. These can be identified by unfeasably
short time deltas between the release and the next press event. In the
recordings I've seen so far, that timeout is 8ms.

We have a two-stage behavior: by default, we do not delay any events but we
monitor timestamps. The first time a bouncing button is detected we switch to
debounce mode. From then on, release events are delayed slightly to check for
subsequent button events. If one occurs, the releas and press are filtered. If
none occurs, the release event is passed to the caller.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: always restart the timer loop when we called one of them
Peter Hutterer [Mon, 17 Jul 2017 02:30:25 +0000 (12:30 +1000)]
timer: always restart the timer loop when we called one of them

If a timer_func causes the removal or addition of a different timer, our tmp
pointer from the list_for_each_safe may not be valid anymore.

This was triggered by having the debounce code trigger a middle button state
change, which caused that timer to be cancelled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: if a timer is inactive, do not call the timer func
Peter Hutterer [Mon, 17 Jul 2017 01:58:11 +0000 (11:58 +1000)]
timer: if a timer is inactive, do not call the timer func

Race conditions may happen where code that cancels a timer is called just
as that timer triggers. If we cancel a timer, we assume that we've put the
code into a state where the timer firing will trigger a bug.

This could be observed with the middle button code if the release event was
held back just long enough. The button release code cancelled the timer, set
the state back to idle and then complained when the timeout handling sent a
'timeout' event while being in idle.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: recover from a lost button count
Peter Hutterer [Tue, 18 Jul 2017 06:12:27 +0000 (16:12 +1000)]
evdev: recover from a lost button count

If the kernel sends us a button press for a button that is thought to be down
we have lost track of the state of the button. Ignore the button press event,
in the hope that the next release makes things right again.

A release event may be masked if another process grabs the device for some
period of time, e.g. libinput debug-events --grab.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/trackpoint-accel-v6'
Peter Hutterer [Thu, 20 Jul 2017 03:33:43 +0000 (13:33 +1000)]
Merge branch 'wip/trackpoint-accel-v6'

7 years agotrackpoint: parse a trackpoint range property
Peter Hutterer [Tue, 16 May 2017 03:10:07 +0000 (13:10 +1000)]
trackpoint: parse a trackpoint range property

Add parsing for a LIBINPUT_ATTR_TRACKPOINT_RANGE property to enable
hardware-dependent ranges. These take precedence over the sensitivity parsing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotrackpoint: drop handling of CONST_ACCEL and undo SENSITIVITY
Peter Hutterer [Tue, 16 May 2017 03:01:32 +0000 (13:01 +1000)]
trackpoint: drop handling of CONST_ACCEL and undo SENSITIVITY

This was to counteract hardware that doesn't work well out of the box,
resulting in quite different behavior across devices. Specifically, only
some trackpoints even have the sensitivity setting.

Change to take over all of the pointer acceleration on trackpoints, so we can
control the actual behavior mostly independent of the system setting. So we
drop the CONST_ACCEL parsing (which never was handled as const accel anyway)
and undo the effect that the SENSITIVITY udev property has. [1]

We take a default range at the default sensitivity and multiply it by the
proportion of the current sensitivity. This seems to be accurate enough.

[1] In the future, we should read not only the property but also the sysfs file to
make sure we're handling the right value, but for now this will do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofilter: add a custom trackpoint accelerator
Peter Hutterer [Fri, 12 May 2017 04:39:24 +0000 (14:39 +1000)]
filter: add a custom trackpoint accelerator

Switch to a pure factor with a max scaled after a function. The offset is just
0 now (will be removed eventually). Both are determined with a function based
on a linear/exponential regression of a sample set of data pairs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add a command to analyze trackpoints
Peter Hutterer [Thu, 11 May 2017 07:17:54 +0000 (17:17 +1000)]
tools: add a command to analyze trackpoints

Trackpoints can send very different ranges between the various pressures.
Collect the data and print it out to get an idea of what ranges are realistic.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: drop an unnecessary wait for event
Peter Hutterer [Fri, 30 Jun 2017 10:35:56 +0000 (20:35 +1000)]
test: drop an unnecessary wait for event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-apple-touch-major-v2'
Peter Hutterer [Fri, 14 Jul 2017 03:47:29 +0000 (13:47 +1000)]
Merge branch 'wip/touchpad-apple-touch-major-v2'

7 years agotools: add an extra linebreak in the tap measuring tool
Peter Hutterer [Wed, 12 Jul 2017 04:56:01 +0000 (14:56 +1000)]
tools: add an extra linebreak in the tap measuring tool

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: silence a coverity warning
Peter Hutterer [Wed, 12 Jul 2017 04:41:24 +0000 (14:41 +1000)]
test: silence a coverity warning

Value set but overwritten before use.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd safe_strdup()
Peter Hutterer [Thu, 6 Jul 2017 23:47:06 +0000 (09:47 +1000)]
Add safe_strdup()

Return value is either NULL or a strdup'd string, depending on the input
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoReplace calloc calls with zalloc
Peter Hutterer [Fri, 7 Jul 2017 01:18:40 +0000 (11:18 +1000)]
Replace calloc calls with zalloc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAbort if zalloc ever fails
Peter Hutterer [Thu, 6 Jul 2017 23:42:59 +0000 (09:42 +1000)]
Abort if zalloc ever fails

There's no guarantee that libinput does the right thing if memory allocation
fails and it's such a niche case on the systems we're targeting that it just
doesn't matter. Simply abort if zalloc ever fails.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add a line break
Peter Hutterer [Wed, 12 Jul 2017 00:16:47 +0000 (10:16 +1000)]
doc: add a line break

doxygen ends the @bug command when a new section command (@code) is
encountered, leaving us with an "Example code:" on the Bug List page.

Add an empty line to cut off here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add a tool to measure touch size and orientation
Peter Hutterer [Wed, 5 Jul 2017 08:50:52 +0000 (18:50 +1000)]
tools: add a tool to measure touch size and orientation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: add touch-size-based palm detection
Peter Hutterer [Thu, 23 Mar 2017 04:54:00 +0000 (14:54 +1000)]
touchpad: add touch-size-based palm detection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: add touch-size based touch handling
Peter Hutterer [Wed, 22 Mar 2017 06:16:21 +0000 (16:16 +1000)]
touchpad: add touch-size based touch handling

Apple touchpads don't use ABS_MT_PRESSURE but they are multitouch touchpads,
so the current pressure-based handling code doesn't apply because it expects
slot-based pressure for mt touchpads.

Apple does however send useful data for ABS_MT_WIDTH_MAJOR/MINOR, so let's use
that instead. The data provided in those is more-or-less random, so we need a
hwdb entry to track the acceptable thresholds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: rename the pressure range parser to a more generic range_parser
Peter Hutterer [Wed, 5 Jul 2017 06:25:40 +0000 (16:25 +1000)]
util: rename the pressure range parser to a more generic range_parser

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: loosen up litest to allow major/minor handling
Peter Hutterer [Wed, 29 Mar 2017 02:31:12 +0000 (12:31 +1000)]
test: loosen up litest to allow major/minor handling

The max values on ABS_MT_TOUCH_MAJOR/MINOR aren't hard limits, they basically
represent the size of a finger with (afaict) a suggestion that anything
greater than the max may be a palm. Disable the 0-100% range checks for those
axes so we can send custom events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: force-release major/minor on the default touch up
Peter Hutterer [Tue, 28 Mar 2017 01:22:27 +0000 (11:22 +1000)]
test: force-release major/minor on the default touch up

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: set keyboard to non-active when the keyboard is removed
Peter Hutterer [Tue, 11 Jul 2017 01:41:15 +0000 (11:41 +1000)]
touchpad: set keyboard to non-active when the keyboard is removed

If the keyboard is removed while dwt thinks it is in active state, that state
is never reset and subsequent touches are ignored.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: add a timer name to each timer
Peter Hutterer [Mon, 3 Jul 2017 01:28:18 +0000 (11:28 +1000)]
timer: add a timer name to each timer

So we have something useful to print when we trigger an error in the timer
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoutil: drop an unnecessary declaration
Peter Hutterer [Mon, 3 Jul 2017 02:45:12 +0000 (12:45 +1000)]
util: drop an unnecessary declaration

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoAdd support for CircleCI
Peter Hutterer [Wed, 5 Jul 2017 02:34:40 +0000 (12:34 +1000)]
Add support for CircleCI

This isn't currently hooked up to the fdo repo but it's hooked up to my
github mirror. I had SemaphoreCI hooked up to that before but it only
supports ubuntu 14.04 and the recent meson switch made it a bit hard to setup.

CircleCI supports running docker containers, so let's do that and run against
the most recent released Fedora and a recent Ubuntu. I'm not bothering with
rawhide, it's likely to increase the work for little gain when it's in a
semi-broken state.

Run the default build with a few permutations to test meson options. Run
scan-build too but that's just for the logs, eventually this may turn into a
hard failure.

Ubuntu 17.04's meson is too old, so we have to clone that from git. Install
arguments are taken from the meson.deb package.

Most of this effort was done by Benjamin Tissoires.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>
7 years agoFix a few things scan-build complains about
Peter Hutterer [Thu, 6 Jul 2017 06:45:41 +0000 (16:45 +1000)]
Fix a few things scan-build complains about

Uninitialized variables, potential NULL dereferences, dead assignments and an
unused return value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix flake8 Python style warnings
Peter Hutterer [Mon, 10 Jul 2017 00:07:03 +0000 (10:07 +1000)]
tools: fix flake8 Python style warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: change python sources to use space indentation
Peter Hutterer [Sun, 9 Jul 2017 23:54:34 +0000 (09:54 +1000)]
tools: change python sources to use space indentation

Let's switch to PEP8-compatible format to have a consistent style that matches
other python sources. This will be checked by flake8 which shows a few other
warnings, this patch only changes tabs to 4 spaces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: fix flake8 style warnings
Peter Hutterer [Sun, 9 Jul 2017 23:38:04 +0000 (09:38 +1000)]
udev: fix flake8 style warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: cleanup hwdb parsing
Peter Hutterer [Fri, 7 Jul 2017 05:52:13 +0000 (15:52 +1000)]
udev: cleanup hwdb parsing

Group into similar props, we really only have value-based properties or
type-based properties. Compress those together so it's easier to understand.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: remove unnecessary full stop in man page
Peter Hutterer [Fri, 7 Jul 2017 03:39:01 +0000 (13:39 +1000)]
tools: remove unnecessary full stop in man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: add upper edge into exclusion zone
Ming-Yang Lu [Sun, 2 Jul 2017 10:07:20 +0000 (18:07 +0800)]
touchpad: add upper edge into exclusion zone

This reduces unexpected cursor moves when placing the thumb near the border
of trackpoint buttons and upper edge of touchpad.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: sync the slot state after tp_resume()
Peter Hutterer [Thu, 6 Jul 2017 01:46:12 +0000 (11:46 +1000)]
touchpad: sync the slot state after tp_resume()

If the touchpad is suspended and resumed (e.g. lid switch), the initial slot
state may be out of sync. If a touch happened while the touchpad was suspended
and the next touch down is on exactly the same x and/or y coordinate, our
touch point would still have the coordinates of the most recently seen touch
(i.e. before touchpad suspend). This could cause a pointer jump or test case
failures.

The real-world impact of this is minimal, putting the finger down in exactly
the same spot is virtually impossible. It could cause a test case failure in the
lid_disable_touchpad() test though, the second touch sequence was on the same
y coordinate and the touch location for that whole sequence was x/0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: skip double-initialization of all_tests lists
Peter Hutterer [Thu, 6 Jul 2017 23:34:16 +0000 (09:34 +1000)]
test: skip double-initialization of all_tests lists

Already done in main(), this here is a leftover from having multiple mains fro
different tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix some tap palm detection tests
Peter Hutterer [Wed, 5 Jul 2017 03:51:29 +0000 (13:51 +1000)]
test: fix some tap palm detection tests

Without the timeout we're not guaranteed that the tap button event triggers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add missing check for an empty queue to the palm detection test
Peter Hutterer [Wed, 5 Jul 2017 01:48:11 +0000 (11:48 +1000)]
test: add missing check for an empty queue to the palm detection test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: stop changing argv[0] for forked tests
Peter Hutterer [Wed, 5 Jul 2017 05:45:19 +0000 (15:45 +1000)]
test: stop changing argv[0] for forked tests

This was useful when we had a small number of test-forks with the suites
distributed. It helped debug which one is still running and then which suites
are in it. Now that we simply distributed everything across the forks it
doesn't have a lot of usefulness and it interferes with the ability to
backtrace properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: remove failing thumb edge scroll test
Peter Hutterer [Wed, 5 Jul 2017 06:00:57 +0000 (16:00 +1000)]
test: remove failing thumb edge scroll test

Broken since the merge of palm pressure detection in
25d54b90d, not sure why the test suite succeeded on that one nonetheless.

I'm not 100% sure why the test does what it does but it seems to be testing
that a wide touch on the side still striggers edge scrolling and not the thumb
detection on the bottom of the touchpad. That is obsolete now, it's hard to
generically figure out the small gap between thumb and palm pressure, so this
test almost always triggers palm detection. It's obsolete.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: update the soname, remove the warning
Peter Hutterer [Tue, 4 Jul 2017 23:49:51 +0000 (09:49 +1000)]
doc: update the soname, remove the warning

The soname will remain fixed now, we're going through all the trouble of
having a proper map file so that we don't have to bump it all the time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: fix a few typos
Peter Hutterer [Tue, 4 Jul 2017 23:47:37 +0000 (09:47 +1000)]
doc: fix a few typos

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: move the autotools instructions into their own section
Peter Hutterer [Tue, 4 Jul 2017 23:46:58 +0000 (09:46 +1000)]
doc: move the autotools instructions into their own section

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: expand on the meson build instructions
Peter Hutterer [Tue, 4 Jul 2017 23:39:29 +0000 (09:39 +1000)]
doc: expand on the meson build instructions

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson: fix build with --libwacom=false
Peter Hutterer [Tue, 4 Jul 2017 23:30:59 +0000 (09:30 +1000)]
meson: fix build with --libwacom=false

Triggered an error because we still used dep_libwacom unconditionally:
Meson encountered an error in file meson.build, line 76, column 0:
Unknown variable "dep_libwacom".

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-palm-pressure'
Peter Hutterer [Tue, 4 Jul 2017 03:57:32 +0000 (13:57 +1000)]
Merge branch 'wip/touchpad-palm-pressure'

7 years agoDrop autotools
Peter Hutterer [Tue, 4 Jul 2017 03:02:46 +0000 (13:02 +1000)]
Drop autotools

This also makes the gitignore files shorter and/or obsolete.

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