touchpad: disable jump detection on the Lenovo X1 Gen6 touchpad
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 12 Jul 2020 22:21:19 +0000 (08:21 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 15 Jul 2020 21:58:52 +0000 (21:58 +0000)
This touchpad has firmware that seems to buffer events. In the words of the
reporter:

  In usage, it feels like motions vary between smooth and choppy; slow
  movements are smooth and quick movements are choppy. It's as if the
  touchpad aggregates quick movements and sends one big movement instead
  of sending discrete events. To make the movement more natural, the
  events preceding the jump should be of higher magnitude and the jump
  less pronounced, but that's just not how the touchpad works, it seems.

In the actual event data this looks exactly like a pointer jump: small
movements, one big one, then small ones again. If we filter that large
movement out we prevent the user from moving quickly.

There's no way to detect this or work around this, so let's add a quirk that
disables the jump detection for this device.

Fixes #506

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
quirks/50-system-lenovo.quirks
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h
src/quirks.c
src/quirks.h

index c4d369c..19a3b9e 100644 (file)
@@ -136,6 +136,7 @@ AttrTrackpointMultiplier=1.25
 MatchName=Synaptics TM3288-011
 MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX1Carbon6th:*
 AttrEventCodeDisable=ABS_MT_TOOL_TYPE
+ModelLenovoX1Gen6Touchpad=1
 
 [Lenovo X41 Tablet]
 MatchName=AT Translated Set 2 keyboard
index df74505..9bee760 100644 (file)
@@ -1499,6 +1499,13 @@ tp_detect_jumps(const struct tp_dispatch *tp,
         * were measured from */
        unsigned int reference_interval = ms2us(12);
 
+       /* On some touchpads the firmware does funky stuff and we cannot
+        * have our own jump detection, e.g. Lenovo Carbon X1 Gen 6 (see
+        * issue #506)
+        */
+       if (tp->jump.detection_disabled)
+               return false;
+
        /* We haven't seen pointer jumps on Wacom tablets yet, so exclude
         * those.
         */
@@ -3628,6 +3635,14 @@ tp_init(struct tp_dispatch *tp,
        tp_init_gesture(tp);
        tp_init_thumb(tp);
 
+       /* Lenovo X1 Gen6 buffers the events in a weird way, making jump
+        * detection impossible. See
+        * https://gitlab.freedesktop.org/libinput/libinput/-/issues/506
+        */
+       if (evdev_device_has_model_quirk(device,
+                                        QUIRK_MODEL_LENOVO_X1GEN6_TOUCHPAD))
+               tp->jump.detection_disabled = true;
+
        device->seat_caps |= EVDEV_DEVICE_POINTER;
        if (tp->gesture.enabled)
                device->seat_caps |= EVDEV_DEVICE_GESTURE;
index 3a33a6a..da56926 100644 (file)
@@ -295,6 +295,7 @@ struct tp_dispatch {
        unsigned int fake_touches;
 
        struct {
+               bool detection_disabled;
                struct ratelimit warning;
        } jump;
 
index 04b020f..45d1f55 100644 (file)
@@ -244,6 +244,7 @@ quirk_get_name(enum quirk q)
        case QUIRK_MODEL_LENOVO_T450_TOUCHPAD:          return "ModelLenovoT450Touchpad";
        case QUIRK_MODEL_LENOVO_T480S_TOUCHPAD:         return "ModelLenovoT480sTouchpad";
        case QUIRK_MODEL_LENOVO_T490S_TOUCHPAD:         return "ModelLenovoT490sTouchpad";
+       case QUIRK_MODEL_LENOVO_X1GEN6_TOUCHPAD:        return "ModelLenovoX1Gen6Touchpad";
        case QUIRK_MODEL_LENOVO_X230:                   return "ModelLenovoX230";
        case QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD:     return "ModelSynapticsSerialTouchpad";
        case QUIRK_MODEL_SYSTEM76_BONOBO:               return "ModelSystem76Bonobo";
index 408236e..ee85fe3 100644 (file)
@@ -77,6 +77,7 @@ enum quirk {
        QUIRK_MODEL_LENOVO_T450_TOUCHPAD,
        QUIRK_MODEL_LENOVO_T480S_TOUCHPAD,
        QUIRK_MODEL_LENOVO_T490S_TOUCHPAD,
+       QUIRK_MODEL_LENOVO_X1GEN6_TOUCHPAD,
        QUIRK_MODEL_LENOVO_X230,
        QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD,
        QUIRK_MODEL_SYSTEM76_BONOBO,