Commit 3669fa10 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

trackpoint: drop handling of CONST_ACCEL and undo SENSITIVITY



This was to counteract hardware that doesn't work well out of the box,
resulting in quite different behavior across devices. Specifically, only
some trackpoints even have the sensitivity setting.

Change to take over all of the pointer acceleration on trackpoints, so we can
control the actual behavior mostly independent of the system setting. So we
drop the CONST_ACCEL parsing (which never was handled as const accel anyway)
and undo the effect that the SENSITIVITY udev property has. [1]

We take a default range at the default sensitivity and multiply it by the
proportion of the current sensitivity. This seems to be accurate enough.

[1] In the future, we should read not only the property but also the sysfs file to
make sure we're handling the right value, but for now this will do.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 87b56828
......@@ -2208,32 +2208,32 @@ evdev_read_wheel_tilt_props(struct evdev_device *device)
}
static inline int
evdev_get_trackpoint_dpi(struct evdev_device *device)
evdev_get_trackpoint_range(struct evdev_device *device)
{
const char *trackpoint_accel;
double accel = DEFAULT_TRACKPOINT_ACCEL;
const char *prop;
int range = DEFAULT_TRACKPOINT_RANGE;
/*
* parse the sensitivity property, and undo whatever it does.
*/
if (!(device->tags & EVDEV_TAG_TRACKPOINT))
return DEFAULT_TRACKPOINT_RANGE;
trackpoint_accel = udev_device_get_property_value(
device->udev_device, "POINTINGSTICK_CONST_ACCEL");
if (trackpoint_accel) {
accel = parse_trackpoint_accel_property(trackpoint_accel);
if (accel == 0.0) {
prop = udev_device_get_property_value(device->udev_device,
"POINTINGSTICK_SENSITIVITY");
if (prop) {
int sensitivity;
if (!safe_atoi(prop, &sensitivity) ||
(sensitivity < 0.0 || sensitivity > 255)) {
evdev_log_error(device,
"trackpoint accel property is present but invalid, "
"using %.2f instead\n",
DEFAULT_TRACKPOINT_ACCEL);
accel = DEFAULT_TRACKPOINT_ACCEL;
"trackpoint sensitivity property is present but invalid, "
"using %d instead\n",
DEFAULT_TRACKPOINT_SENSITIVITY);
sensitivity = DEFAULT_TRACKPOINT_SENSITIVITY;
}
evdev_log_info(device, "set to const accel %.2f\n", accel);
range = 1.0 * DEFAULT_TRACKPOINT_RANGE *
sensitivity/DEFAULT_TRACKPOINT_SENSITIVITY;
}
device->trackpoint_range = 20; /* FIXME */
return DEFAULT_MOUSE_DPI / accel;
return range;
}
static inline int
......@@ -2242,13 +2242,8 @@ evdev_read_dpi_prop(struct evdev_device *device)
const char *mouse_dpi;
int dpi = DEFAULT_MOUSE_DPI;
/*
* Trackpoints do not have dpi, instead hwdb may contain a
* POINTINGSTICK_CONST_ACCEL value to compensate for sensitivity
* differences between models, we translate this to a fake dpi.
*/
if (device->tags & EVDEV_TAG_TRACKPOINT)
return evdev_get_trackpoint_dpi(device);
return DEFAULT_MOUSE_DPI;
mouse_dpi = udev_device_get_property_value(device->udev_device,
"MOUSE_DPI");
......@@ -2666,6 +2661,7 @@ evdev_configure_device(struct evdev_device *device)
evdev_tag_external_mouse(device, device->udev_device);
evdev_tag_trackpoint(device, device->udev_device);
device->dpi = evdev_read_dpi_prop(device);
device->trackpoint_range = evdev_get_trackpoint_range(device);
device->seat_caps |= EVDEV_DEVICE_POINTER;
......
......@@ -53,6 +53,8 @@
/* The HW DPI rate we normalize to before calculating pointer acceleration */
#define DEFAULT_MOUSE_DPI 1000
#define DEFAULT_TRACKPOINT_RANGE 20
#define DEFAULT_TRACKPOINT_SENSITIVITY 128
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
#define ANSI_RED "\x1B[0;31m"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment