trackpoint: parse a trackpoint range property
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@who-t.net>
This commit is contained in:
1 parent
3669fa10df
commit
2cadb5f487
1 file changed
+16
+16
@@ -2216,6 +2216,20 @@ evdev_get_trackpoint_range(struct evdev_device *device)
|
||||
if (!(device->tags & EVDEV_TAG_TRACKPOINT))
|
||||
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) {
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user