Jan Synacek 55323e
From 85dcfad639fab203564eca0070ce3303c5942bde Mon Sep 17 00:00:00 2001
Jan Synacek 55323e
From: Fedora systemd team <systemd-maint@redhat.com>
Jan Synacek 55323e
Date: Thu, 5 Feb 2015 08:55:03 +0100
Jan Synacek 55323e
Subject: [PATCH] hwdb: add a touchpad hwdb
Jan Synacek 55323e
Jan Synacek 55323e
Currently used to tag devices in the new Lenovo *50 series and the X1 Carbon
Jan Synacek 55323e
3rd. These laptops re-introduced the physical trackpoint buttons that were
Jan Synacek 55323e
missing from the *40 series but those buttons are now wired up to the
Jan Synacek 55323e
touchpad.
Jan Synacek 55323e
Jan Synacek 55323e
The touchpad now sends BTN_0, BTN_1 and BTN_2 for the trackpoint. The same
Jan Synacek 55323e
button codes were used in older touchpads that had dedicated scroll up/down
Jan Synacek 55323e
buttons. Input drivers need to work around this and thus know what they're
Jan Synacek 55323e
dealing with.
Jan Synacek 55323e
Jan Synacek 55323e
For the previous gen we introduced INPUT_PROP_TOPBUTTONPAD in the kernel, but
Jan Synacek 55323e
the resulting mess showed that these per-device quirks should really live in
Jan Synacek 55323e
userspace.
Jan Synacek 55323e
Jan Synacek 55323e
The list currently includes the X1 Carbon 3rd PNPID, others will be added as
Jan Synacek 55323e
get to know which PNPID they have.
Jan Synacek 55323e
Jan Synacek 55323e
(Cherry-picked from 001a247324b44c0e0b8fdba41a6fc66e7465b8b6)
Jan Synacek 55323e
---
Jan Synacek 55323e
 Makefile.am             |  4 +++-
Jan Synacek 55323e
 hwdb/70-touchpad.hwdb   | 39 +++++++++++++++++++++++++++++++++++++++
Jan Synacek 55323e
 rules/70-touchpad.rules | 12 ++++++++++++
Jan Synacek 55323e
 3 files changed, 54 insertions(+), 1 deletion(-)
Jan Synacek 55323e
 create mode 100644 hwdb/70-touchpad.hwdb
Jan Synacek 55323e
 create mode 100644 rules/70-touchpad.rules
Jan Synacek 55323e
Jan Synacek 55323e
diff --git a/Makefile.am b/Makefile.am
Jan Synacek 55323e
index ac7924e..2b0128f 100644
Jan Synacek 55323e
--- a/Makefile.am
Jan Synacek 55323e
+++ b/Makefile.am
Jan Synacek 55323e
@@ -3389,6 +3389,7 @@ dist_udevrules_DATA += \
Jan Synacek 55323e
 	rules/60-drm.rules \
Jan Synacek 55323e
 	rules/60-keyboard.rules \
Jan Synacek 55323e
 	rules/70-mouse.rules \
Jan Synacek 55323e
+	rules/70-touchpad.rules \
Jan Synacek 55323e
 	rules/60-persistent-storage-tape.rules \
Jan Synacek 55323e
 	rules/60-persistent-serial.rules \
Jan Synacek 55323e
 	rules/60-persistent-input.rules \
Jan Synacek 55323e
@@ -3416,7 +3417,8 @@ dist_udevhwdb_DATA = \
Jan Synacek 55323e
 	hwdb/20-OUI.hwdb \
Jan Synacek 55323e
 	hwdb/20-net-ifname.hwdb \
Jan Synacek 55323e
 	hwdb/60-keyboard.hwdb \
Jan Synacek 55323e
-	hwdb/70-mouse.hwdb
Jan Synacek 55323e
+	hwdb/70-mouse.hwdb \
Jan Synacek 55323e
+	hwdb/70-touchpad.hwdb
Jan Synacek 55323e
 
Jan Synacek 55323e
 udevconfdir = $(sysconfdir)/udev
Jan Synacek 55323e
 dist_udevconf_DATA = \
Jan Synacek 55323e
diff --git a/hwdb/70-touchpad.hwdb b/hwdb/70-touchpad.hwdb
Jan Synacek 55323e
new file mode 100644
Jan Synacek 55323e
index 0000000..bbf44db
Jan Synacek 55323e
--- /dev/null
Jan Synacek 55323e
+++ b/hwdb/70-touchpad.hwdb
Jan Synacek 55323e
@@ -0,0 +1,39 @@
Jan Synacek 55323e
+# This file is part of systemd.
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# The lookup keys are composed in:
Jan Synacek 55323e
+#   70-touchpad.rules
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# Note: The format of the "touchpad:" prefix match key is a
Jan Synacek 55323e
+# contract between the rules file and the hardware data, it might
Jan Synacek 55323e
+# change in later revisions to support more or better matches, it
Jan Synacek 55323e
+# is not necessarily expected to be a stable ABI.
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# Match string format:
Jan Synacek 55323e
+# touchpad:pnpid:<pnpid>:
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# To add local entries, create a new file
Jan Synacek 55323e
+#   /etc/udev/hwdb.d/71-touchpad-local.hwdb
Jan Synacek 55323e
+# and add your rules there. To load the new rules execute (as root):
Jan Synacek 55323e
+#   udevadm hwdb --update
Jan Synacek 55323e
+#   udevadm trigger /dev/input/eventXX
Jan Synacek 55323e
+# where /dev/input/eventXX is the touchpad in question. If in
Jan Synacek 55323e
+# doubt, simply use /dev/input/event* to reload all input rules.
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# If your changes are generally applicable, open a bug report on
Jan Synacek 55323e
+#   http://bugs.freedesktop.org/enter_bug.cgi?product=systemd
Jan Synacek 55323e
+# and include your new rules, a description of the device, and the
Jan Synacek 55323e
+# output of
Jan Synacek 55323e
+#   udevadm info /dev/input/eventXX
Jan Synacek 55323e
+# (or /dev/input/event*).
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# Allowed properties are:
Jan Synacek 55323e
+#    TOUCHPAD_HAS_TRACKPOINT_BUTTONS=1
Jan Synacek 55323e
+#
Jan Synacek 55323e
+# If the TOUCHPAD_HAS_TRACKPOINT_BUTTONS property is set, this
Jan Synacek 55323e
+# device has # the trackpoint buttons wired up to the touchpad as
Jan Synacek 55323e
+# BTN_0, BTN_1 and BTN_2. This affects the Lenovo X1 Carbon 3rd
Jan Synacek 55323e
+# and the *50 series (T450, T550, etc.)
Jan Synacek 55323e
+
Jan Synacek 55323e
+# Lenovo X1 Carbon 3rd
Jan Synacek 55323e
+touchpad:pnpid:*LEN0048*:
Jan Synacek 55323e
+ TOUCHPAD_HAS_TRACKPOINT_BUTTONS=1
Jan Synacek 55323e
diff --git a/rules/70-touchpad.rules b/rules/70-touchpad.rules
Jan Synacek 55323e
new file mode 100644
Jan Synacek 55323e
index 0000000..88e6fd2
Jan Synacek 55323e
--- /dev/null
Jan Synacek 55323e
+++ b/rules/70-touchpad.rules
Jan Synacek 55323e
@@ -0,0 +1,12 @@
Jan Synacek 55323e
+# do not edit this file, it will be overwritten on update
Jan Synacek 55323e
+
Jan Synacek 55323e
+ACTION=="remove", GOTO="touchpad_end"
Jan Synacek 55323e
+KERNEL!="event*", GOTO="touchpad_end"
Jan Synacek 55323e
+ENV{ID_INPUT_TOUCHPAD}=="", GOTO="touchpad_end"
Jan Synacek 55323e
+
Jan Synacek 55323e
+# touchpad:pnpid:<pnpid>:*
Jan Synacek 55323e
+KERNELS=="serio1", \
Jan Synacek 55323e
+    IMPORT{builtin}="hwdb 'touchpad:pnpid:$attr{firmware_id}:'", \
Jan Synacek 55323e
+    GOTO="touchpad_end"
Jan Synacek 55323e
+
Jan Synacek 55323e
+LABEL="touchpad_end"
Jan Synacek 55323e
-- 
Jan Synacek 55323e
2.1.0
Jan Synacek 55323e