[PATCH libinput 2/4] touchpad: reset the wobble detection for non-pointer events

Peter Hutterer peter.hutterer at who-t.net
Wed May 2 10:40:52 UTC 2018


On Wed, May 02, 2018 at 12:08:58PM +0300, Konstantin Kharlamov wrote:
> On 30.04.2018 08:33, Peter Hutterer wrote:
> > If we get an event other than a motion event we're not wobbling so we need to
> > reset and restart.
> > 
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> IMO this shouldn't matter, because if a user managed to consciously trigger
> an event other than movement, it would definitely take time more than the
> threshold in milliseconds which is used for detection.

I thought so too at first but when I checked the code I found that's not the
case. Our threshold is 40ms (i.e. 3 events for most touchpads at 80hz). But
we're only comparing against the last motion timestamp, so in the extreme
case this sequence would trigger a false positive:
* x 1
* pressure
* pressure
* x -1
* pressure
* pressure
* x 1

Which is ~120ms and 7 events in total. The above sequence isn't necessarily
jitter and since we only enable it once and for the rest of the session we
need to be as conservative as possible.

> On the other hand I imagine a broken touchpad could send a spurious event
> which would break a detection possibility because we reset.

Yeah, but if it's that broken we can fix it by setting the absfuzz to the
right value, on that device. Enabling the hysteresis for a specific device
is easy now, the automatic detection is difficult.
 
Cheers,
   Peter

> > ---
> >   src/evdev-mt-touchpad.c | 7 ++++++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> > index dc2ed8dc..704d238a 100644
> > --- a/src/evdev-mt-touchpad.c
> > +++ b/src/evdev-mt-touchpad.c
> > @@ -155,9 +155,14 @@ tp_detect_wobbling(struct tp_dispatch *tp,
> >   	int dx, dy;
> >   	uint64_t dtime;
> > -	if (!(tp->queued & TOUCHPAD_EVENT_MOTION) || tp->hysteresis.enabled)
> > +	if (tp->hysteresis.enabled)
> >   		return;
> > +	if (!(tp->queued & TOUCHPAD_EVENT_MOTION)) {
> > +		t->hysteresis.x_motion_history = 0;
> > +		return;
> > +	}
> > +
> >   	if (t->last_point.x == 0) { /* first invocation */
> >   		dx = 0;
> >   		dy = 0;
> > 


More information about the wayland-devel mailing list