[PATCH v2 libinput] touchpad: drop motion hysteresis by default

Hans de Goede hdegoede at redhat.com
Wed Feb 3 09:15:32 CET 2016


Hi,

On 02-02-16 01:16, Peter Hutterer wrote:
> Some older touchpad devices jitter a fair bit when a finger is resting on the
> touchpad. That's why the hysteresis was introduced in the synaptics driver
> back in 2011. However, the default value of the hysteresis in the synaptics
> driver ended up being 0, even though the code looks like it's using a fraction
> of the touchpad diagonal. When the hysteresis code was ported to libinput it
> was eventually set to 0.5mm.
>
> Turns out this is still too high and tiny finger motions are either
> nonreactive or quite jumpy, making it hard to select small targets. Drop the
> default hysteresis by reducing its margin to 0, but leave it in place for
> those devices where we need them (e.g. the cyapa touchpads).
>
> https://bugs.freedesktop.org/show_bug.cgi?id=93503
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - add exception for the cyapa touchpads
>
> I'm purposely only including that one model because we know that it needs
> the hysteresis. Over time, there will be other devices that need it, but
> let's fix those up as we find them rather than erring on the side of
> including a bunch of devices that may not need it, the improvements to slow
> motion are too good to ignore

Ok, lets say how this one plays out:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans




>
>   src/evdev-mt-touchpad.c            | 23 ++++++++++++++++++-----
>   src/evdev.c                        |  1 +
>   src/evdev.h                        |  1 +
>   udev/90-libinput-model-quirks.hwdb |  3 +++
>   4 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index f249116..0f72807 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -1951,13 +1951,29 @@ tp_init_default_resolution(struct tp_dispatch *tp,
>   	return 0;
>   }
>
> +static inline void
> +tp_init_hysteresis(struct tp_dispatch *tp)
> +{
> +	int res_x, res_y;
> +
> +	res_x = tp->device->abs.absinfo_x->resolution;
> +	res_y = tp->device->abs.absinfo_y->resolution;
> +
> +	if (tp->device->model_flags & EVDEV_MODEL_CYAPA) {
> +		tp->hysteresis_margin.x = res_x/2;
> +		tp->hysteresis_margin.y = res_y/2;
> +	} else {
> +		tp->hysteresis_margin.x = 0;
> +		tp->hysteresis_margin.y = 0;
> +	}
> +}
> +
>   static int
>   tp_init(struct tp_dispatch *tp,
>   	struct evdev_device *device)
>   {
>   	int width, height;
>   	double diagonal;
> -	int res_x, res_y;
>
>   	tp->base.interface = &tp_interface;
>   	tp->device = device;
> @@ -1971,8 +1987,6 @@ tp_init(struct tp_dispatch *tp,
>   	if (tp_init_slots(tp, device) != 0)
>   		return -1;
>
> -	res_x = tp->device->abs.absinfo_x->resolution;
> -	res_y = tp->device->abs.absinfo_y->resolution;
>   	width = device->abs.dimensions.x;
>   	height = device->abs.dimensions.y;
>   	diagonal = sqrt(width*width + height*height);
> @@ -1981,8 +1995,7 @@ tp_init(struct tp_dispatch *tp,
>   						       EV_ABS,
>   						       ABS_MT_DISTANCE);
>
> -	tp->hysteresis_margin.x = res_x/2;
> -	tp->hysteresis_margin.y = res_y/2;
> +	tp_init_hysteresis(tp);
>
>   	if (tp_init_accel(tp, diagonal) != 0)
>   		return -1;
> diff --git a/src/evdev.c b/src/evdev.c
> index 66673a8..473ff63 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1678,6 +1678,7 @@ evdev_read_model_flags(struct evdev_device *device)
>   		{ "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD },
>   		{ "LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD", EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD },
>   		{ "LIBINPUT_MODEL_CYBORG_RAT", EVDEV_MODEL_CYBORG_RAT },
> +		{ "LIBINPUT_MODEL_CYAPA", EVDEV_MODEL_CYAPA },
>   		{ NULL, EVDEV_MODEL_DEFAULT },
>   	};
>   	const struct model_map *m = model_map;
> diff --git a/src/evdev.h b/src/evdev.h
> index 8b567a8..b164af8 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -111,6 +111,7 @@ enum evdev_device_model {
>   	EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
>   	EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13),
>   	EVDEV_MODEL_CYBORG_RAT = (1 << 14),
> +	EVDEV_MODEL_CYAPA = (1 << 15),
>   };
>
>   struct mt_slot {
> diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
> index fa668d6..f23a7f9 100644
> --- a/udev/90-libinput-model-quirks.hwdb
> +++ b/udev/90-libinput-model-quirks.hwdb
> @@ -73,6 +73,9 @@ libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*SAMSUNG*:pn*Lumpy*
>   libinput:name:Atmel maXTouch Touchpad:dmi:*svn*GOOGLE*:pn*Samus*
>    LIBINPUT_MODEL_CHROMEBOOK=1
>
> +libinput:name:Cypress APA Trackpad (cyapa):dmi:*
> + LIBINPUT_MODEL_CYAPA=1
> +
>   ##########################################
>   # LENOVO
>   ##########################################
>


More information about the wayland-devel mailing list