From a4036a33ca6ca8da7d2417cac6b840a89b295e5f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 23 Mar 2018 11:00:46 +1000 Subject: [PATCH] udev: copy the trackpoint sensitivity directly from sysfs Rather than going the roundabout way of having systemd set the sensitivity followed by us reading that udev property and hoping, just take the sensitivity directly from sysfs. This makes us basically independent of what systemd does (or the lack of systemd, where that is a problem). It does remove the chance of users to trick libinput by manually adjusting the sensitivity after the udev rules kicked in, but seriously, we should work on fixing acceleration properly in that case. Signed-off-by: Peter Hutterer --- src/evdev.c | 4 ++-- udev/90-libinput-model-quirks.rules.in | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 4f69d8e0..5537408c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1220,7 +1220,7 @@ evdev_get_trackpoint_range(struct evdev_device *device) HTTP_DOC_LINK); prop = udev_device_get_property_value(device->udev_device, - "POINTINGSTICK_SENSITIVITY"); + "LIBINPUT_ATTR_TRACKPOINT_SENSITIVITY"); if (prop) { int sensitivity; @@ -1236,7 +1236,7 @@ evdev_get_trackpoint_range(struct evdev_device *device) sensitivity/DEFAULT_TRACKPOINT_SENSITIVITY; evdev_log_debug(device, - "trackpoint udev sensitivity is %d\n", + "trackpoint sensitivity is %d\n", sensitivity); } diff --git a/udev/90-libinput-model-quirks.rules.in b/udev/90-libinput-model-quirks.rules.in index 5ddc0ba4..7c73f0a6 100644 --- a/udev/90-libinput-model-quirks.rules.in +++ b/udev/90-libinput-model-quirks.rules.in @@ -48,4 +48,8 @@ KERNELS=="input*", \ KERNELS=="input*", \ IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:dt:$attr{[devicetree/base]model}'" +ENV{ID_INPUT_POINTINGSTICK}=="1", \ + ATTRS{sensitivity}=="?*", \ + ENV{LIBINPUT_ATTR_TRACKPOINT_SENSITIVITY}="$attr{sensitivity}" + LABEL="libinput_model_quirks_end"