touchpad: ignore the ALPS jump to 4095/0

Some ALPS touchpad send the occasional 4095/0 event on slot 1 during
two-finger interaction before snapping back to the actual position of the
finger. There doesn't seem to be a specific heuristic to predict this so let's
hardcode those values. When detected, overwrite the current touch point with
the position of the last point. This will likely cause a small pointer jump
when the finger later moves to the real position but based on #492 this could
be a second later, so all bets are off anyway.

Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/492

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-26 11:59:47 +10:00
parent 9f8b9f5f53
commit 0c51121556
2 changed files with 27 additions and 0 deletions

View file

@ -64,3 +64,17 @@ See :ref:`reporting_bugs` for more details.
Note that it most cases, libinput cannot actually fix the issue. Filing a
bug is useful to figure out if there are other factors at play or whether
there are heuristics we can employ to reduce the impact.
------------------------------------------------------------------------------
AlpsPS/2 ALPS DualPoint TouchPad jumping to 4095/0
------------------------------------------------------------------------------
A special case of pointer jumps happens on ``AlpsPS/2 ALPS DualPoint TouchPad``
devices found in the Lenovo ThinkPad E465 and E550 and likely others with
the same touchpad hardware. On those devices, the touchpad occasionally
sends an event for the second finger to move to position 4095/0 before
moving back to the original position. libinput detects this movement and
removes it but depending on the interaction this may cause a smaller jump
later when the coordinates reset to the new position of the finger.
Some more information is available in `Gitlab Issue #492 <https://gitlab.freedesktop.org/libinput/libinput/-/issues/492>`__.

View file

@ -1549,6 +1549,19 @@ tp_detect_jumps(const struct tp_dispatch *tp,
abs_distance = hypot(mm.x, mm.y) * reference_interval/tdelta;
rel_distance = abs_distance - t->jumps.last_delta_mm;
/* Special case for the ALPS devices in the Lenovo ThinkPad E465,
* E550. These devices send occasional 4095/0 events on two fingers
* before snapping back to the correct position.
* https://gitlab.freedesktop.org/libinput/libinput/-/issues/492
* The specific values are hardcoded here, if this ever happens on
* any other device we can make it absmax/absmin instead.
*/
if (tp->device->model_flags & EVDEV_MODEL_ALPS_SERIAL_TOUCHPAD &&
t->point.x == 4095 && t->point.y == 0) {
t->point = last->point;
return true;
}
/* Cursor jump if:
* - current single-event delta is >20mm, or
* - we increased the delta by over 7mm within a 12ms frame.