summaryrefslogtreecommitdiff
path: root/udev
diff options
context:
space:
mode:
authorMartin Wilck <mwilck@suse.com>2018-05-29 09:28:09 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2018-05-30 09:42:06 +1000
commitc5bfa00760737bfa7456a449a588c84430d0a4aa (patch)
treef92e0087b97ef67e4de047fcaea262b62963a5f2 /udev
parent198c53650afe63e0cd3cac140b43f372bc6d507b (diff)
downloadlibinput-c5bfa00760737bfa7456a449a588c84430d0a4aa.tar.gz
udev: support firmware detection for pointing sticks
Add support for firmware detection on pointing stick devices. This is needed for ALPS only at this time. Signed-off-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'udev')
-rw-r--r--udev/90-libinput-model-quirks.rules.in16
-rw-r--r--udev/libinput-model-quirks.c15
2 files changed, 25 insertions, 6 deletions
diff --git a/udev/90-libinput-model-quirks.rules.in b/udev/90-libinput-model-quirks.rules.in
index 7c73f0a6..f29cb8a2 100644
--- a/udev/90-libinput-model-quirks.rules.in
+++ b/udev/90-libinput-model-quirks.rules.in
@@ -11,18 +11,22 @@
ACTION!="add|change", GOTO="libinput_model_quirks_end"
KERNEL!="event*", GOTO="libinput_model_quirks_end"
-# Touchpad firmware detection, two-stage process.
+# Firmware detection, two-stage process.
# First, run the program and import the LIBINPUT_MODEL_FIRMWARE_VERSION
# environment (if any)
KERNELS=="*input*", \
- IMPORT{program}="@UDEV_TEST_PATH@libinput-model-quirks %S%p"
-
-# Second, match on anything with that env set and import from the hwdb
-KERNELS=="*input*", \
ENV{ID_INPUT_TOUCHPAD}=="1", \
- ENV{LIBINPUT_MODEL_FIRMWARE_VERSION}!="", \
+ ENV{.DETECT_FWVERSION}="1"
+KERNELS=="*input*", \
+ ENV{ID_INPUT_POINTINGSTICK}=="1", \
+ ENV{.DETECT_FWVERSION}="1"
+ENV{.DETECT_FWVERSION}!="1", GOTO="skip_fwversion"
+
+IMPORT{program}="@UDEV_TEST_PATH@libinput-model-quirks %S%p"
+ENV{LIBINPUT_MODEL_FIRMWARE_VERSION}!="", \
IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:fwversion:$env{LIBINPUT_MODEL_FIRMWARE_VERSION}'"
# End of touchpad firmware detection
+LABEL="skip_fwversion"
# libinput:touchpad:<modalias>
ENV{ID_INPUT_TOUCHPAD}=="1", \
diff --git a/udev/libinput-model-quirks.c b/udev/libinput-model-quirks.c
index d1d5a68a..9eb15054 100644
--- a/udev/libinput-model-quirks.c
+++ b/udev/libinput-model-quirks.c
@@ -108,6 +108,19 @@ handle_touchpad(struct udev_device *device)
handle_touchpad_synaptics(device);
}
+static void
+handle_pointingstick(struct udev_device *device)
+{
+ const char *name = NULL;
+
+ name = prop_value(device, "NAME");
+ if (!name)
+ return;
+
+ if (strstr(name, "AlpsPS/2 ALPS") != NULL)
+ handle_touchpad_alps(device);
+}
+
/**
* For a non-zero fuzz on the x/y axes, print that fuzz as property and
* reset the kernel's fuzz to 0.
@@ -187,6 +200,8 @@ int main(int argc, char **argv)
if (prop_value(device, "ID_INPUT_TOUCHPAD"))
handle_touchpad(device);
+ if (prop_value(device, "ID_INPUT_POINTINGSTICK"))
+ handle_pointingstick(device);
rc = 0;