From a74dcf965a86251aed75420a0308b337e2fdbd7f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 30 Jun 2015 13:00:10 +1000 Subject: [PATCH] udev: add ALPS firmware detection and size properties Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- udev/90-libinput-model-quirks.hwdb | 4 ++++ udev/libinput-model-quirks.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index fd9efa81..129f567f 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -22,6 +22,10 @@ libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:* libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:* LIBINPUT_MODEL_ALPS_TOUCHPAD=1 +libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:8 +libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:8 + LIBINPUT_ATTR_SIZE_HINT=100x55 + ########################################## # Apple ########################################## diff --git a/udev/libinput-model-quirks.c b/udev/libinput-model-quirks.c index 3c51a378..fc3dbe85 100644 --- a/udev/libinput-model-quirks.c +++ b/udev/libinput-model-quirks.c @@ -50,9 +50,35 @@ prop_value(struct udev_device *device, return prop_value; } +static void +handle_touchpad_alps(struct udev_device *device) +{ + const char *product; + int bus, vid, pid, version; + + product = prop_value(device, "PRODUCT"); + if (!product) + return; + + if (sscanf(product, "%x/%x/%x/%x", &bus, &vid, &pid, &version) != 4) + return; + + /* ALPS' firmware version is the PID */ + if (pid) + printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%d\n", pid); +} + static void handle_touchpad(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); } int main(int argc, char **argv)