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 c4d369c14c001af0461723b17b171ca6dea4d1b2..19a3b9e5442986ab67868ec71b5b42703b262ef2 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 df745054d967d5ecb2dcf8aa52f4daf8f218b385..9bee760613c40e30cc3ae9118c670ae497624c3a 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 3a33a6a40e1781598cc9b604d434bd389bcaf54b..da56926432eee002e4bfa7fd6a5dd3e83b8c26ce 100644 (file)
@@ -295,6 +295,7 @@ struct tp_dispatch {
        unsigned int fake_touches;
 
        struct {
+               bool detection_disabled;
                struct ratelimit warning;
        } jump;
 
index 04b020f82a85aec3dfa978d4dd2228e447af779a..45d1f554bc3b74790299bfa9a96b05c492a498bc 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 408236ee5cc043b529714ad7af1508cf19165f82..ee85fe3bf50e8ec1d14545d0a88a00cda3fd184d 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,