[systemd-devel] [PATCH 2/5] udev: Add rules and hwdb files for setting trackpoint properties

Hans de Goede hdegoede at redhat.com
Thu Apr 2 02:48:48 PDT 2015


There is quite a wide spread in the delta events generated by trackpoints,
some generate deltas of 1-2 under normal use, while others generate deltas
from 1-20.

This commit adds a set of rules + a hwdb file which allows specifying a
per model TRACKPOINT_CONST_ACCEL value which can be used by the userspace
input stack to normalize the deltas so that all trackpoints get the same
speed/feeling ootb.

The hwdb matching is modelled after 60-keyboard.rules, rather then after
70-mouse.rules, as trackpoints are typically (but not always) found integrated
into laptops and the keyboard matching rules are a better match to this.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hwdb/70-trackpoint.hwdb   | 59 +++++++++++++++++++++++++++++++++++++++++++++++
 rules/70-mouse.rules      |  1 +
 rules/70-trackpoint.rules | 16 +++++++++++++
 3 files changed, 76 insertions(+)
 create mode 100644 hwdb/70-trackpoint.hwdb
 create mode 100644 rules/70-trackpoint.rules

diff --git a/hwdb/70-trackpoint.hwdb b/hwdb/70-trackpoint.hwdb
new file mode 100644
index 0000000..f2f8364
--- /dev/null
+++ b/hwdb/70-trackpoint.hwdb
@@ -0,0 +1,59 @@
+# This file is part of systemd.
+#
+# Trackpoint const-accel configuration, to make different brand / model
+# laptop trackpoints have the same speed / feel, and per model adjustment
+# of the IBM TrackPoint driver's sensitivty setting
+#
+# The lookup keys are composed in:
+#   70-trackpoint.rules
+#
+# Note: The format of the "trackpoint:" prefix match key is a
+# contract between the rules file and the hardware data, it might
+# change in later revisions to support more or better matches, it
+# is not necessarily expected to be a stable ABI.
+#
+# Supported hardware matches are:
+#  - Generic input devices match:
+#      trackpoint:input:bZZZZvYYYYpXXXXeWWWW-VVVV
+#    This matches on the kernel modalias of the input-device, mainly:
+#    ZZZZ is the bus-id (see /usr/include/linux/input.h BUS_*), YYYY, XXXX and
+#    WWW are the 4-digit hex uppercase vendor, product and version ID and VVVV
+#    is an arbitrary length input-modalias describing the device capabilities.
+#
+#  - Input driver device name and DMI data match:
+#      trackpoint:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn*
+#    <input device name> is the name device specified by the driver,
+#    <vendor> is the firmware-provided string from the kernel DMI modalias.
+#
+# To add local entries, create a new file
+#   /etc/udev/hwdb.d/71-trackpoint-local.hwdb
+# and add your rules there. To load the new rules execute (as root):
+#   udevadm hwdb --update
+#   udevadm trigger /dev/input/eventXX
+# where /dev/input/eventXX is the trackpoint in question. If in
+# doubt, simply use /dev/input/event* to reload all input rules.
+#
+# If your changes are generally applicable, open a bug report on
+#   http://bugs.freedesktop.org/enter_bug.cgi?product=systemd
+# and include your new rules, a description of the device, and the
+# output of
+#   udevadm info /dev/input/eventXX
+# (or /dev/input/event*).
+#
+# Allowed properties are:
+#   TRACKPOINT_CONST_ACCEL
+#
+#########################################
+#        TRACKPOINT_CONST_ACCEL         #
+#########################################
+#
+# Trackpoint const accel settings are specified as
+#    TRACKPOINT_CONST_ACCEL=<accel>
+#
+# Where <accel> is a floating point number, using a '.' seperator, specifying
+# by how much to multiply deltas generated by the trackpoint to get
+# normalized deltas.
+#
+
+#
+# Sort by by brand, model
diff --git a/rules/70-mouse.rules b/rules/70-mouse.rules
index 3ea743a..c47a1b1 100644
--- a/rules/70-mouse.rules
+++ b/rules/70-mouse.rules
@@ -3,6 +3,7 @@
 ACTION=="remove", GOTO="mouse_end"
 KERNEL!="event*", GOTO="mouse_end"
 ENV{ID_INPUT_MOUSE}=="", GOTO="mouse_end"
+ENV{ID_INPUT_TRACKPOINT}=="1", GOTO="mouse_end"
 
 # mouse:<subsystem>:v<vid>p<pid>:name:<name>:*
 KERNELS=="input*", ENV{ID_BUS}=="usb", \
diff --git a/rules/70-trackpoint.rules b/rules/70-trackpoint.rules
new file mode 100644
index 0000000..8ecbde6
--- /dev/null
+++ b/rules/70-trackpoint.rules
@@ -0,0 +1,16 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION=="remove", GOTO="trackpoint_end"
+KERNEL!="event*", GOTO="trackpoint_end"
+ENV{ID_INPUT_TRACKPOINT}=="", GOTO="trackpoint_end"
+
+# skip later rules when we find something for this input device
+IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=trackpoint:", \
+  GOTO="trackpoint_end"
+
+# device matching the input device name and the machine's DMI data
+KERNELS=="input*", \
+  IMPORT{builtin}="hwdb 'trackpoint:name:$attr{device/name}:$attr{[dmi/id]modalias}'", \
+  GOTO="trackpoint_end"
+
+LABEL="trackpoint_end"
-- 
2.3.4



More information about the systemd-devel mailing list