Bug 105108

Summary: Lenovo Yoga 11S touchpad is jittery
Product: Wayland Reporter: Daniel van Vugt <daniel.van.vugt>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: low CC: Hi-Angel, michael, peter.hutterer, tomi
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://launchpad.net/bugs/1749689
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 105202, 105303    
Bug Blocks: 104828    
Attachments: yoga11s_one_finger_still.txt (evemu recording)
0001-touchpad-use-the-fuzz-value-if-any-for-the-hysteresi.patch
0001-evdev-change-hysteresis-to-work-across-both-axes.patch

Description Daniel van Vugt 2018-02-15 11:56:02 UTC
Created attachment 137371 [details]
yoga11s_one_finger_still.txt (evemu recording)

Lenovo Yoga 11S touchpad is jittery. The cursor moves a little even when I try to keep my finger still.

This is noticeable after hysteresis has turned off, but libinput hysteresis was definitely not helping since it made the touchpad unusably numb and unresponsive. So the jitter problem I'm talking about here in libinput 1.10 is much better than how it was previously :)

The same jitter happens with the synaptics driver if I turn off hysteresis there. Although synaptics with hysteresis provides a nice experience... seems to be a dramatically lower hysteresis threshold.
Comment 1 Peter Hutterer 2018-02-21 03:52:37 UTC
Created attachment 137490 [details] [review]
0001-touchpad-use-the-fuzz-value-if-any-for-the-hysteresi.patch

Give this one a try please. synaptics was using the fuzz value, so that probably explains the better response.
Comment 2 Daniel van Vugt 2018-02-21 03:56:29 UTC
Will do.

Although, will that fix keep working after hysteresis turns off? Or would it stop hysteresis from turning off?
Comment 3 Peter Hutterer 2018-02-21 04:22:06 UTC
it's unrelated, it just changes how the hysteresis behaves when it's enabled but it doesn't affect when/how it is enabled/disabled. ideally, it should make the touchpad more responsive even when the hysteresis is needed.
Comment 4 Daniel van Vugt 2018-02-21 04:51:43 UTC
Sounds like a good idea, but also like something I can't test unless I add some hacks to stop hysteresis from quickly turning off, right?

Also, even if that worked the patch mentions this bug as if it's a fix. But clearly it would not be a fix for this bug if hysteresis is still turning off. It sounds like the patch needs changing before I even test it. At least to not mention this bug.

Later I guess, if we are lucky enough to find that fuzz solves lots of problems with hysteresis then maybe we could consider never turning it off(!). Then that would be a real fix for this one and other bugs.
Comment 5 Peter Hutterer 2018-02-21 05:36:06 UTC
just comment out the tp_maybe_disable_hysteresis() call for testing. and yes, if that fixes the issue with wobbly pointers but gives reasonable responsiveness, then that's one way to just completely avoid the hysteresis enabling/disabling option.
Comment 6 Daniel van Vugt 2018-02-21 09:57:32 UTC
Confirmed on two machines (Yoga 11S and X1 Carbon gen 5) that using fuzz is a better idea than resolution/2. Just still not as good as completely disabling hysteresis (the cursor still visibly moves in squares, just smaller squares now).

Caveats:
  1. That patch mentions this bug when it shouldn't. It's not a fix for this bug.
  2. That patch assumes fuzz==0 means unknown fuzz. But I suspect for some devices, fuzz=0 is the correct fuzz to use (equivalent to never enabling hysteresis at all). I can't find documentation confirming this theory though.
Comment 7 Peter Hutterer 2018-02-21 23:12:54 UTC
'moves in squares' when you actually move the cursor, right? Does it wobble?

1) fwiw, a bug link is not always a signal that the bug is fixed, but rather a reference to some other documentation so in a year's time we know where we got a patch idea from.

2) fuzz of 0 as "no hysteresis" is used by the synaptics driver, but tbh I'm doubtful that's a correct approach. Devices have a tendency to be outright wrong and 0 is the only default value here. Which means 0 is shared by devices that don't have fuzz and by devices that simply don't fill it in.

Having said that, might be worth just seeing how long it takes for someone to complain :)
Comment 8 Daniel van Vugt 2018-02-22 02:14:32 UTC
The wobble is gone because hysteresis is always enabled (I hardcoded it to enabled). That's not a change introduced by the patch though.

Moving in squares (when the finger moves in circles) is the same old problem with the hysteresis algorithm, not a problem with the hysteresis magnitude.

That all said, I support the idea of committing attachment 137490 [details] [review]. Just remember to not close this bug.

Once we're using fuzz, perhaps it will be possible to tweak the fuzz (hence tweak the hysteresis) for each touchpad externally, like libinput-model-quirks?
Comment 9 Peter Hutterer 2018-02-22 06:19:55 UTC
it's already doable, the EV_ABS lines in 60-evdev.hwdb support fuzz and flat as well (order is x:y:resolution:fuzz:flat).

But before we do that we need a tool to measure what the fuzz would be. Having users just submit entries they think are correct to the system-wide hwdb is bound to be painful in the long run. Oh, and that tool needs to reset fuzz to 0 to make sure the kernel doesn't get in the way of the measurements.
Comment 10 Daniel van Vugt 2018-02-22 06:35:11 UTC
Sounds like a plan:

1. Start using fuzz if available.
2. Never disable hysteresis; and
3. Submit proper measurements and fuzz tweaks per-model.

And maybe in parallel:

Reassess the feasibility of making hysteresis omnidirectional so that circles with the finger don't equate to squares with the cursor.
Comment 11 Peter Hutterer 2018-02-22 06:50:41 UTC
Created attachment 137524 [details] [review]
0001-evdev-change-hysteresis-to-work-across-both-axes.patch

> Reassess the feasibility of making hysteresis omnidirectional so that circles 
> with the finger don't equate to squares with the cursor.

I had a patch for this a year or so ago, but it didn't get any testing or positive test results, can't remember. Attaching here so it's public at least. should apply on 1.9.0 but probably not on master
Comment 12 Peter Hutterer 2018-02-23 05:36:00 UTC
Alright, https://github.com/whot/libinput/tree/wip/hysteresis-wobbles is the compiled branch for all the current hysteresis fixes. Please give it a test. This includes:
* reducing to the fuzz
* enabling hysteresis where fuzz != 0
* wobble detection from Hi-Angel [slightly modified by me, but the functionality is the same]
* hysteresis fixes to work across both axes simultaneously

The last one I'm not 100% sure about, I just finished the code and there may be a massive thinko. Tests and sanity-checks appreciated.
Comment 13 Dustin Spicuzza 2018-02-27 19:03:29 UTC
FWIW, the 1.10 release was a huge improvement for my Lenovo Flex 5-1470 laptop. Unfortunately, I have a Dell Inspiron 15-3531 that has a similar jittery/wobble issue with libinput 1.10 (Fedora).

I built/installed your wip/hystersis branch, and it's a huge improvement over 1.10 on my Dell. However, it seems to wobble if I leave my finger down after moving the pointer. If it's useful, I can make some recordings and post it here (or make a new bug).
Comment 14 Daniel van Vugt 2018-02-28 01:34:15 UTC
Thanks. A new bug would be best since this one is explicitly for the Yoga 11S.
Comment 15 Daniel van Vugt 2018-02-28 04:48:49 UTC
Tested 'wip/hysteresis-wobbles' on Yoga 11S. It seems more broken than any other branch so far. The cursor actually wobbles in directions that the finger isn't going in.
Comment 16 Daniel van Vugt 2018-02-28 04:52:51 UTC
When I say "wobbles", I mean the problems with 'wip/hysteresis-wobbles' are bigger than the problems with 1.10 that I originally called "jitter".
Comment 17 Daniel van Vugt 2018-02-28 04:55:30 UTC
I think the way forward here is:

1. Use fuzz as the hysteresis threshold(s).
2. Modify hysteresis to be omnidirectional (test if raw (dx,dy) is within the ellipse defined by the hysteresis thresholds (hx,hy)).
3. Hysteresis always on.
Comment 18 Peter Hutterer 2018-02-28 05:09:12 UTC
> 1. Use fuzz as the hysteresis threshold(s).

yep, already part of that patchset

> 2. Modify hysteresis to be omnidirectional 

the commit introducing that feature seems to trigger the wobble/jitter/..., see
see https://bugs.freedesktop.org/show_bug.cgi?id=104828#c35
And as pointed out in that comment, I'm out of ideas on having an omnidirectional hysteresis that doesn't add the same issues that we've seen before (circle -> square movement)

> 3. Hysteresis always on.

That's already part of the patchset, provided fuzz is nonzero.
Comment 19 Hi-Angel 2018-02-28 11:42:03 UTC
(In reply to Peter Hutterer from comment #1)
> Created attachment 137490 [details] [review] [review]
> 0001-touchpad-use-the-fuzz-value-if-any-for-the-hysteresi.patch
> 
> Give this one a try please. synaptics was using the fuzz value, so that
> probably explains the better response.

Just curious, what hysteresis algo synaptics been using? Was it the same that libinput have now?
Comment 20 Daniel van Vugt 2018-03-01 01:12:38 UTC
I've never looked into the synaptics algorithm.

However good news: I got omnidirectional (elliptical) hysteresis working yesterday. I will formalise it into a patch today...
Comment 21 Peter Hutterer 2018-03-01 03:24:39 UTC
> what hysteresis algo synaptics been using? Was it the same
> that libinput have now?

yeah, should be the same. The synaptics defaults are fuzz or if fuzz is 0, the 0.5% of the touchpad diagonal. No accommodation for different resolutions.

The functions are the same, see src/synaptics.c hysteresis() and in libinput the  evdev_hysteresis() function. Look different, but return the same values.
Comment 22 Daniel van Vugt 2018-03-01 09:33:30 UTC
See bug 105306.

It's a separate bug because that enhancement alone doesn't fix the other bugs already open. However once combined with:
 - smaller margins (fuzz); and
 - hysteresis always on
then I think we will have a complete fix for this bug and others.
Comment 23 Peter Hutterer 2018-03-05 10:34:06 UTC
I think with the series from https://lists.freedesktop.org/archives/wayland-devel/2018-March/037297.html, this should be it for this bug?
Comment 24 Daniel van Vugt 2018-03-08 06:40:19 UTC
Confirmed the bug is fixed (just OK) using both patches 1 & 2:

https://lists.freedesktop.org/archives/wayland-devel/2018-March/037297.html
https://lists.freedesktop.org/archives/wayland-devel/2018-March/037298.html

BUT it feels surprisingly numb, as if fuzz amount is wrong. Then adding patch 3 does feel better:

https://lists.freedesktop.org/archives/wayland-devel/2018-March/037299.html

P.S. The patches don't apply cleanly and the 3rd one has a minor conflict.
Comment 25 Peter Hutterer 2018-03-09 04:13:15 UTC
thanks for testing, merged and pushed

commit ea7498ef971350454db9c78b9ba160e7d6bb455b
Author: Peter Hutterer <>
Date:   Wed Feb 21 13:41:31 2018 +1000

     touchpad: use the fuzz value (if any) for the hysteresis margin

commit 1b64888a2248af2a287365598cf520e4e2be33fd
Author: Peter Hutterer <>
Date:   Fri Feb 23 11:44:23 2018 +1000

     touchpad: enable hysteresis based on a 0 fuzz value

commit 1523d8bb2e066bec297f7a03ce4a0d8cada8f383
Author: Peter Hutterer <>
Date:   Mon Mar 5 13:17:43 2018 +1000

     Extract and reset the abs fuzz value for the x/y axes
Comment 26 Peter Hutterer 2018-04-02 23:07:41 UTC
*** Bug 105675 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.