touchpad: reset the wobble detection history for y-only changes

Otherwise we may detect wobble despite having a series of valid y movements,
e.g. the following sequence was detected as wobble:
	x: 1 y: 0
	x: 0 y: 1
	x: 0 y: 2
	x: 0 y: 2
	x: 0 y: 1
	x: -1 y: 0
	x: 1 y: 0

Avoid this by resetting the history when we get a dx == 0 event. It'll take
longer for real wobble to be detected but it reduces the number of false
positives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-04-24 10:34:21 +10:00
parent 795657a0a1
commit be69bcef2c

View file

@ -171,10 +171,7 @@ tp_detect_wobbling(struct tp_dispatch *tp,
tp->hysteresis.last_motion_time = time;
t->last_point = t->point;
if (dx == 0 && dy != 0) /* ignore y-only changes */
return;
if (dtime > ms2us(40)) {
if ((dx == 0 && dy != 0) || dtime > ms2us(40)) {
t->hysteresis.x_motion_history = 0;
return;
}