Commit graph

1954 commits

Author SHA1 Message Date
Jonas Ådahl
240d669bba test: Handle 32 bit msec time overflows
The libinput_*_get_time() returns a 32 bit unsigned integer, but in the
tests we compared them to a 64 bit unsigned integer. This means that
when the 32 bit integer overflowed, we'd still compare to a
non-overflowed 64 bit integer, causing the tests to fail.

This commit fixes this by always casting the millisecond 64 bit unsigned
integer to a 32 unsigned integer, triggering the same overflow.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:25 +10:00
Peter Hutterer
f44de7cc4f doc: minor fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 12:49:01 +10:00
Peter Hutterer
abcb99a597 test: fix printf for unexpected tablet events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 11:11:19 +10:00
Peter Hutterer
ecd6a0803e tools: print the button name for tablet button events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 11:11:15 +10:00
Peter Hutterer
c420747be4 test: reduce the default abs-max range to avoid ENOMEM
This path is hit when we set up an abs device without setting specific axis
ranges. Usually because we only care that the axis is there, not the values,
see the tests of invalid devices.

0xffff is fine as max for most axes but setting it for ABS_MT_SLOT can cause
allocation errors. Reduce to 100 because we don't care about the range anyway
and 100 is still big enough for basic tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-08 08:05:52 +10:00
Eric Engestrom
7a81ba9cc2 Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-06 07:42:03 +10:00
Peter Hutterer
e7efd150a1 Merge branch 'wip/touchpad-middle-button' 2016-04-06 07:32:46 +10:00
Peter Hutterer
886b5a2cd8 touchpad: add a middle button software area
Middle button interaction is most commonly to paste and it is a single-event
interaction (button press). We provided middle button in software button mode
by emulating it with a two-finger press with L+R down at the same time. This
is also what many touchpads are spectacularly bad at, it is very common to
detect the physical button down event before the second finger registers,
resulting in left or right clicks where a middle button should be triggered.

Unless the fingers are resting on the touchpad for at least one scanout, the
success rate for middle button emulation is only at 70% or so.

This patch adds a 25%-width middle button area between the left and the right
software button, everything else stays the same. To avoid immediate breakage,
the middle button emulation remains but may be removed in the future.
The doc is updated to only refer to the middle button area now.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-05 10:13:56 +10:00
Peter Hutterer
bdf442024e Merge branch 'wip/t450-jumping-cursor-fixes' 2016-04-04 12:17:22 +10:00
Peter Hutterer
ef48c07a96 touchpad: reset the motion history on significant negative pressure changes
Resetting the motion history has the side-effect of swallowing movements, we
don't calculate deltas until we have 4 motion events. During a finger release,
we're likely to get a large pressure change between two events, resetting the
motion history prevents the cursor from jumping on release.

The value of 7 found by trial-and-error, tested on the T440 and T450 hardware.
The absolute value is highly variable but recordings show that the pressure
changes only by 1 or 2 units during normal interaction. Higher pressure
changes are during finger position changes but since those should not cause a
jump anyway, we tend to win there too.

Currently only enabled for negative pressure changes, let's see how we go with
that. This is enabled for all touchpads now, but the value may need
device-specific thresholds in the future.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-04 12:11:30 +10:00
Peter Hutterer
f53d4f1f36 Merge branch 'wip/t450-jumping-cursor-fixes' 2016-04-04 11:54:23 +10:00
Peter Hutterer
1ecf6d7a60 touchpad: fix left-handed top software trackpoint buttons
The previous code would swap the top software buttons depending on the
touchpad's left-handed setting, not the trackpoint setting. Changing both
devices to left-handed resulted in a double-swap, i.e. the trackpoint was
always right-handed.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-01 07:34:32 +10:00
Peter Hutterer
aa90121125 touchpad: reset the motion history on significant negative pressure changes
Resetting the motion history has the side-effect of swallowing movements, we
don't calculate deltas until we have 4 motion events. During a finger release,
we're likely to get a large pressure change between two events, resetting the
motion history prevents the cursor from jumping on release.

The value of 7 found by trial-and-error, tested on the T440 and T450 hardware.
The absolute value is highly variable but recordings show that the pressure
changes only by 1 or 2 units during normal interaction. Higher pressure
changes are during finger position changes but since those should not cause a
jump anyway, we tend to win there too.

Currently only enabled for negative pressure changes, let's see how we go with
that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-30 14:07:26 +10:00
Peter Hutterer
b5527fa4c7 test: add a test for the T450 dropped motion events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-30 11:10:12 +10:00
Peter Hutterer
bc17185f42 touchpad: only post motion events if we have motion
Because our delta calculation factors in previous events on touchpads (to
reduce jitter) we may get a nonzero delta if we have an event that doesn't
actually change x or y.

Drop the t->dirty workaround introduced in a608d9d, an event that virtually
disappears can mess up our state machines.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-29 15:48:17 +10:00
Peter Hutterer
31d0464c4a test: apply the new t450 model flag to our X1 3rd test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-03-29 11:59:41 +10:00
Peter Hutterer
455498e9d7 Fix two doxygen groupings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-29 08:33:34 +10:00
Peter Hutterer
a1d8687a79 touchpad: drop unused parameter
Left over from an earlier version of the t450 quirk (see a608d9dc2c) and
unused in the merged version.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-17 09:35:19 +10:00
Peter Hutterer
ae7b2f7772 configure.ac: libinput 1.2.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-15 10:23:42 +10:00
Peter Hutterer
a608d9dc2c touchpad: add quirk for the T450 and T460 generation hardware
The touchpad's sensors are too far apart (or the firmware interferes), causing
in a jerky movement visible especially on slow motion. We get a bunch of
normal motion events, then only ABS_MT_PRESSURE updates without x/y updates.
After about one mm of movement x/y updates resume, with the first event
covering the distance between the last motion event. That event is usually
accelerated and thus causes a large jump. Subsequent events are sufficiently
fine-grained again.

This patch counts the number of non-motion events. Once we hit 10 in a row, we
mark the first motion update as non-dirty, effectively discarding the motion
and thus stopping the pointer jumps.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2016-03-11 10:02:26 +10:00
Peter Hutterer
5d904b6319 tablet: reject mislabelled tablet devices
The HUION 580 has a "consumer control" event node that has an ABS_VOLUME, keys
and a REL_HWHEEL. It has the same VID/PID as the pen tablet and libwacom
labels it as ID_INPUT_TABLET. This causes a crash later when we try to init
pointer acceleration for a device that doesn't have axes.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-07 13:05:26 +10:00
Peter Hutterer
b4a74bcebc Assert that the interface is actually filled in.
Had this in a private bug report recently. Missing hooks for open/close just
segfault with little information to debug. Add an assert, this is definitely a
bug in the caller and we don't need to recover from that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-07 13:05:26 +10:00
Peter Hutterer
00a9b05da7 test: add two path tests for invalid devices
One test for an actual file (so far we only tested /tmp, the directory) and
one for a kernel dev that returns a udev device and thus gets one step further
in the error handling code.

Plus, I saw test code doing this (opening /dev/uinput) and it crashed (for
other reasons), so we might as well test it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-03 09:19:36 +10:00
Peter Hutterer
a60afbeec3 touchpad: use the udev property over a compile-time vendor ID check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-02 11:49:32 +10:00
Peter Hutterer
2bb0678a00 tablet: sanitize button mask passing
We have a struct, use it. Better than passing arrays and array lengths around.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-01 16:00:47 +10:00
Peter Hutterer
21fe11fb11 configure.ac: libinput 1.2.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-29 08:35:41 +10:00
Peter Hutterer
dbb85f6739 touchpad: only trigger immediate pinch detection for three fingers
If the fingers are vertically apart by more than 20mm we used to assume a
pinch gesture immediately. This is too close together for some users during
two-finger scrolling. Since we should always bias towards scrolling, only
trigger this detection for three fingers, the rest has to go through the
movement detection.

The reason for the pinch detection here was to differentiate from 3fg swipe
gestures (83f3dbd1), hence we're still in spirit of that patch.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-28 20:35:59 +10:00
Peter Hutterer
45e5847bf3 configure.ac: libinput 1.2.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-23 16:13:11 +10:00
Peter Hutterer
0e17dc58aa tablet: use the tilt resolution if we have it
A nonzero resolution on the tilt axes is units/rad so we can calculate the
physical min/max based. Uneven min/max ranges are supported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-02-23 14:42:35 +10:00
Peter Hutterer
79139ebcd1 touchpad: move the tapping exclusion zone to the top edge of the button
We previously used the half-way mark of the touchpad's y axis to decide where
to ignore tapping. Move this down to the top edge of the software buttons
instead. Users may tap with a finger in the software button areas, on the rest
of the touchpad it's unlikely that they tap within 5% of the edge.

On touchpads with physical buttons or if clickfinger is enabled, the
no-tapping zone extends to the bottom of the touchpad. This required splitting
the tests into clickfinger, softbuttons and hardbuttons.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-18 10:38:20 +10:00
Peter Hutterer
d6b889852a touchpad: add synaptics semi-mt devices to those needing hysteresis
https://bugs.freedesktop.org/show_bug.cgi?id=94097

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-18 09:56:00 +10:00
Peter Hutterer
cc0c3e8598 configure.ac: libinput 1.2rc2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-15 17:13:01 +10:00
Peter Hutterer
3d1b17e1fd test: add tablet test for out-of-bounds motion coordinates
The newer Cintiqs have a minimum value of 400/400 advertised by the kernel but
the actual sensor goes past the 0/0 origin. Test this, make sure that a value
outside the boundaries generates negative mm values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-11 16:03:13 +10:00
Peter Hutterer
197bad1676 test: add Wacom Cintiq 24HD Pen
One test now gets close enough to 100% of the axis value that
ck_assert_double_lt() is not fine-grained enough. Switch to a direct x < 100.0
check.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-11 16:02:22 +10:00
Peter Hutterer
9356d9b97d doc: update tablet svg to show tilt as angle
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 15:06:12 +10:00
Peter Hutterer
0c0832d06c test: add a simple test to guard against wrong library version changes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 15:03:25 +10:00
Peter Hutterer
c6a082dfd9 tablet: move left-handed initialization into tablet_init
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 13:57:10 +10:00
Peter Hutterer
61c4ed9d7a Indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 13:54:04 +10:00
Peter Hutterer
4bf8365a02 tablet: fix artpen rotation on left-handed tablets
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 12:05:16 +10:00
Peter Hutterer
6bd2a4a5f1 test: add test for left-handed mouse rotation on tablets
Should be offset by 180 degrees

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 12:05:16 +10:00
Peter Hutterer
d8eced2afe tablet: move clearing the tilt bits up to where we reset the axes
No functional change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 12:05:16 +10:00
Peter Hutterer
ebe02cb19e tablet: delay initial proximity in event until we have a serial
If the tablet is already in proximity on startup, we used to immediately sent
a proximity event. We can't fetch MSC_SERIAL from the kernel, so that tool
always had a serial of 0, followed by events with the real serial. Since
clients are supposed to use the serial for the tracking of tools, this is
suboptimal.

When the tablet is added, merely set the internal proximity flags. This way we
wait until the first real event from the device (which includes the serial
number) and convert that into a proximity event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 12:02:08 +10:00
Peter Hutterer
07420eec05 touchpad: init a default hysteresis for ALPS rushmore touchpads
https://bugs.freedesktop.org/show_bug.cgi?id=90590

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-10 08:08:31 +10:00
Peter Hutterer
1f304763b4 udev: fix ALPS firmware detection
The firmware version is in id.version, not id.model which is always
PSMOUSE_ALPS for ALPS devices.

The various fw versions are listed in <kernel>/drivers/input/mouse/alps.h and
are all hex numbers. Version 8 is actually 0x800, change the match
accordingly.

Expected side-effect: earlier versions of ALPS touchpads now lose their
(erroneous) size assignment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-10 08:08:31 +10:00
Peter Hutterer
c9abcb2e1c tablet: change tilt axes to use degrees
The Wacom tilt range is 64 degrees so we map everything into that until we
know otherwise.

This commit also switches the tilt axes around to align the angles with the
x/y orientation, i.e. tilting the top of the stylus towards the positive x
axis now generates a positive x tilt.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-02-09 12:19:12 +10:00
Peter Hutterer
0e87dc9af2 touchpad: fix dwt disabling while a key is still down
If dwt is disabled on the commandline, e.g. by setting an xinput property it
may be disabled before the release event comes in. This caused the timer to
refresh indefinitely since the key state mask was still on for that key.
Always updating the key state mask (even when dwt is disabled) fixes that.

If a key is held down while dwt is disabled, this can still cause a indefinite
timer refresh, so in the timer func, check if dwt is enabled before refreshing
the timer.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-09 07:40:04 +10:00
Peter Hutterer
4392cb5796 Indentation fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-05 15:39:58 +10:00
Peter Hutterer
cbf775ba3d tools: fix output to say TABLET_TOOL instead of just tablet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-05 15:34:25 +10:00
Peter Hutterer
0b0150e08d touchpad: if we have a serio keyboard, override any previous dwt pairing
If a USB keyboard like the YubiKey is found before the internal keyboard, it
will be paired with the touchpad when it is seen. The internal keyboard is
seen later bug ignored because we already have a keyboard paired with the
touchpad.

This is obviously wrong. For now, give priority to serio keyboards, and
override existing dwt pairings with the new keyboard.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-05 07:43:25 +10:00
Peter Hutterer
b27f04689e touchpad: while a key is held down, don't disable dwt
If a key enables dwt and is held down when the timeout expires, re-issue the
timeout.

There is a corner case where dwt may not work as expected:
1. key down and held down
2. dwt timer expires, dwt is re-issued
3. touch starts
4. key is released
5. dwt timer expires
6. touch now starts moving the pointer

This is an effect of the smart touch detection. A touch starting after the
last key press is released for pointer motion once dwt turns off again. This
is what happens in the above case, the dwt timer expiring is the last virtual
key press. This is a corner case and likely hard to trigger by a real user.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-02-05 07:40:51 +10:00