[PATCH libinput 4/4] trackpoint: parse a trackpoint range property
Peter Hutterer
peter.hutterer at who-t.net
Wed Jul 12 06:06:18 UTC 2017
Add parsing for a LIBINPUT_ATTR_TRACKPOINT_RANGE property to enable
hardware-dependent ranges. These take precedence over the sensitivity parsing.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/evdev.c b/src/evdev.c
index 991b12db..a1da9144 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2217,6 +2217,20 @@ evdev_get_trackpoint_range(struct evdev_device *device)
return DEFAULT_TRACKPOINT_RANGE;
prop = udev_device_get_property_value(device->udev_device,
+ "LIBINPUT_ATTR_TRACKPOINT_RANGE");
+ if (prop) {
+ if (!safe_atoi(prop, &range) ||
+ (range < 0.0 || range > 100)) {
+ evdev_log_error(device,
+ "trackpoint range property is present but invalid, "
+ "using %d instead\n",
+ DEFAULT_TRACKPOINT_RANGE);
+ range = DEFAULT_TRACKPOINT_RANGE;
+ }
+ goto out;
+ }
+
+ prop = udev_device_get_property_value(device->udev_device,
"POINTINGSTICK_SENSITIVITY");
if (prop) {
int sensitivity;
@@ -2233,6 +2247,8 @@ evdev_get_trackpoint_range(struct evdev_device *device)
sensitivity/DEFAULT_TRACKPOINT_SENSITIVITY;
}
+out:
+ evdev_log_info(device, "trackpoint device set to range %d\n", range);
return range;
}
--
2.13.0
More information about the wayland-devel
mailing list