[PATCH libinput 8/9] touchpad: default to a 69x50mm sized touchpad
Hans de Goede
hdegoede at redhat.com
Wed Jul 8 05:36:59 PDT 2015
Hi,
On 01-07-15 08:08, Peter Hutterer wrote:
> The previous approach of using the axis ranges and approximating parameters
> based on the x/y axis range clutters up the code and is generally unreliable.
> If we look at Synaptics touchpads, the resolution ranges from 42 to 130 while
> the axes stay the same axis range. Other touchpads likely have a similar
> variation across the various models.
>
> Let's make this simpler in code: unless we know otherwise, simply assume a
> default-sized touchpad.
> Anything that deviates from that can be fixed with the new hwdb entries to
> provide a more correct setting.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
LGTM: Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> src/evdev-mt-touchpad.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 2474340..8692612 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1505,6 +1505,43 @@ error:
> }
>
> static int
> +tp_init_default_resolution(struct tp_dispatch *tp,
> + struct evdev_device *device)
> +{
> + const int touchpad_width_mm = 69, /* 1 under palm detection */
> + touchpad_height_mm = 50;
> + int xres, yres;
> +
> + if (!device->abs.fake_resolution)
> + return 0 ;
> +
> + /* we only get here if
> + * - the touchpad provides no resolution
> + * - the udev hwdb didn't override the resoluion
> + * - no ATTR_SIZE_HINT is set
> + *
> + * The majority of touchpads that triggers all these conditions
> + * are old ones, so let's assume a small touchpad size and assume
> + * that.
> + */
> + log_info(tp_libinput_context(tp),
> + "%s: no resolution or size hints, assuming a size of %dx%dmm\n",
> + device->devname,
> + touchpad_width_mm,
> + touchpad_height_mm);
> +
> + xres = device->abs.dimensions.x/touchpad_width_mm;
> + yres = device->abs.dimensions.y/touchpad_height_mm;
> + libevdev_set_abs_resolution(device->evdev, ABS_X, xres);
> + libevdev_set_abs_resolution(device->evdev, ABS_Y, yres);
> + libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_X, xres);
> + libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_Y, yres);
> + device->abs.fake_resolution = 0;
> +
> + return 0;
> +}
> +
> +static int
> tp_init(struct tp_dispatch *tp,
> struct evdev_device *device)
> {
> @@ -1517,6 +1554,9 @@ tp_init(struct tp_dispatch *tp,
> if (tp_sanity_check(tp, device) != 0)
> return -1;
>
> + if (tp_init_default_resolution(tp, device) != 0)
> + return -1;
> +
> if (tp_init_slots(tp, device) != 0)
> return -1;
>
>
More information about the wayland-devel
mailing list