mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-07 06:30:15 +01:00
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:
parent
3669fa10df
commit
2cadb5f487
1 changed files with 16 additions and 0 deletions
16
src/evdev.c
16
src/evdev.c
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue