Blame 0001-evdev-disable-ABS_MT_TOOL_PALM-on-the-Lenovo-X1-Carb.patch

Peter Hutterer 09a826f
From 4fb3f9e1d4de48853e2cdc43300e4d1fa41550b3 Mon Sep 17 00:00:00 2001
Peter Hutterer a8a7e75
From: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer a8a7e75
Date: Thu, 19 Apr 2018 11:00:51 +1000
Peter Hutterer a8a7e75
Subject: [PATCH libinput] evdev: disable ABS_MT_TOOL_PALM on the Lenovo X1
Peter Hutterer a8a7e75
 Carbon 6th gen
Peter Hutterer a8a7e75
Peter Hutterer a8a7e75
This device randomly decides that a touch is now a palm, based on
Peter Hutterer a8a7e75
the moon phase, the user's starsign and possibly what the dog had for
Peter Hutterer a8a7e75
breakfast. Since libinput assumes that a touchpad that labels a touch as palm
Peter Hutterer a8a7e75
has reasons to do so, let's unassume this for this device by disabling that
Peter Hutterer a8a7e75
axis altogether and relying on the touch pressure only.
Peter Hutterer a8a7e75
Peter Hutterer a8a7e75
https://bugzilla.redhat.com/show_bug.cgi?id=1565692
Peter Hutterer a8a7e75
Peter Hutterer a8a7e75
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer a8a7e75
(cherry picked from commit 762c1726f1b633d46ce0415a43fcee93453b8b7a)
Peter Hutterer a8a7e75
---
Peter Hutterer a8a7e75
 src/evdev.c                        | 8 ++++++++
Peter Hutterer a8a7e75
 src/evdev.h                        | 1 +
Peter Hutterer a8a7e75
 udev/90-libinput-model-quirks.hwdb | 4 ++++
Peter Hutterer a8a7e75
 3 files changed, 13 insertions(+)
Peter Hutterer a8a7e75
Peter Hutterer a8a7e75
diff --git a/src/evdev.c b/src/evdev.c
Peter Hutterer 09a826f
index 13b2b13c..a145a03b 100644
Peter Hutterer a8a7e75
--- a/src/evdev.c
Peter Hutterer a8a7e75
+++ b/src/evdev.c
Peter Hutterer 09a826f
@@ -1272,6 +1272,7 @@ evdev_read_model_flags(struct evdev_device *device)
Peter Hutterer a8a7e75
 		MODEL(LOGITECH_MARBLE_MOUSE),
Peter Hutterer a8a7e75
 		MODEL(TABLET_NO_PROXIMITY_OUT),
Peter Hutterer a8a7e75
 		MODEL(MS_NANO_TRANSCEIVER),
Peter Hutterer a8a7e75
+		MODEL(LENOVO_CARBON_X1_6TH),
Peter Hutterer a8a7e75
 #undef MODEL
Peter Hutterer a8a7e75
 		{ "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL },
Peter Hutterer a8a7e75
 		{ NULL, EVDEV_MODEL_DEFAULT },
Peter Hutterer 09a826f
@@ -1868,6 +1869,13 @@ evdev_pre_configure_model_quirks(struct evdev_device *device)
Peter Hutterer a8a7e75
 	/* Logitech Marble Mouse claims to have a middle button */
Peter Hutterer a8a7e75
 	if (device->model_flags & EVDEV_MODEL_LOGITECH_MARBLE_MOUSE)
Peter Hutterer a8a7e75
 		libevdev_disable_event_code(device->evdev, EV_KEY, BTN_MIDDLE);
Peter Hutterer a8a7e75
+
Peter Hutterer a8a7e75
+	/* Lenovo Carbon X1 6th gen sends bogus ABS_MT_TOOL_TYPE events for
Peter Hutterer a8a7e75
+	 * MT_TOOL_PALM */
Peter Hutterer a8a7e75
+	if (device->model_flags & EVDEV_MODEL_LENOVO_CARBON_X1_6TH)
Peter Hutterer a8a7e75
+		libevdev_disable_event_code(device->evdev,
Peter Hutterer a8a7e75
+					    EV_ABS,
Peter Hutterer a8a7e75
+					    ABS_MT_TOOL_TYPE);
Peter Hutterer a8a7e75
 }
Peter Hutterer a8a7e75
 
Peter Hutterer a8a7e75
 static void
Peter Hutterer a8a7e75
diff --git a/src/evdev.h b/src/evdev.h
Peter Hutterer 09a826f
index 496bea7f..cdcaf8f9 100644
Peter Hutterer a8a7e75
--- a/src/evdev.h
Peter Hutterer a8a7e75
+++ b/src/evdev.h
Peter Hutterer 09a826f
@@ -112,6 +112,7 @@ enum evdev_device_model {
Peter Hutterer a8a7e75
 	EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
Peter Hutterer 09a826f
 	EVDEV_MODEL_LOGITECH_K400 = (1 << 11),
Peter Hutterer a8a7e75
 	EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
Peter Hutterer a8a7e75
+	EVDEV_MODEL_LENOVO_CARBON_X1_6TH = (1 << 13),
Peter Hutterer a8a7e75
 	EVDEV_MODEL_CYBORG_RAT = (1 << 14),
Peter Hutterer a8a7e75
 	EVDEV_MODEL_HP_STREAM11_TOUCHPAD = (1 << 16),
Peter Hutterer a8a7e75
 	EVDEV_MODEL_LENOVO_T450_TOUCHPAD= (1 << 17),
Peter Hutterer a8a7e75
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
Peter Hutterer 09a826f
index 7470973f..6f625017 100644
Peter Hutterer a8a7e75
--- a/udev/90-libinput-model-quirks.hwdb
Peter Hutterer a8a7e75
+++ b/udev/90-libinput-model-quirks.hwdb
Peter Hutterer 09a826f
@@ -232,6 +232,10 @@ libinput:keyboard:input:b0003v17EFp6047*
Peter Hutterer 09a826f
 libinput:name:*ALPS TrackPoint*:svnLENOVO:*:pvrThinkPadX280:*
Peter Hutterer 09a826f
  LIBINPUT_ATTR_TRACKPOINT_RANGE=70
Peter Hutterer a8a7e75
 
Peter Hutterer a8a7e75
+# Lenovo Carbon X1 6th gen (RMI4 only, PS/2 is broken on this device)
Peter Hutterer a8a7e75
+libinput:name:Synaptics TM3288-010:dmi:*svnLenovo:*pvrThinkPadX1Carbon6th:*
Peter Hutterer a8a7e75
+ LIBINPUT_MODEL_LENOVO_CARBON_X1_6TH=1
Peter Hutterer a8a7e75
+
Peter Hutterer a8a7e75
 ##########################################
Peter Hutterer a8a7e75
 # Logitech
Peter Hutterer a8a7e75
 ##########################################
Peter Hutterer a8a7e75
-- 
Peter Hutterer a8a7e75
2.14.3
Peter Hutterer a8a7e75