Bug 96409

Summary: MacBook Air clickpad is too sensitive
Product: Wayland Reporter: Damián Nohales <damiannohales>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: at-xorg, peter.hutterer
Version: 1.2.x   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 99355, 100309    
Bug Blocks:    
Attachments: no-pressure.txt
low-pressure.txt
normal-pressure.txt
high-pressure.txt
0001-touchpad-set-apple-specific-pressure-values.patch

Description Damián Nohales 2016-06-06 17:03:29 UTC
In Apple clickpads, or at least in my specific clickpad (from a MacBook Air 13" mid 2013), I have response from the device when de finger is not touching the clickpad but is really close to it (a millimeter or less). I'm able to move the cursor by moving my finger steady over the clickpad without even touching it, there is even a visual separation between my finger and the clickpad.

This causes many misbehaviour when using the clickpad:

- Unintentional cursor moves.
- Unintentional two finger tap when trying to do one finger tap (the middle finger is usually really close to the clickpad when doing a tap with the index finger).
- I don't know if this is the cause of unintentional clicks when typing.

I'll attach four evemu-record outputs for a move of the cursor through the X axis with different pressures:

no-pressure.txt: I move the cursor trying to not touch de clickpad at all (I accidentally touched it for a moment though).
low-pressure.txt: Touching the clickpad with lower pressure than I usually do in my regular usage.
normal-pressure.txt: Touching the clickpad like a usually do in my regular usage.
high-pressure.txt More pressure than I usually do in my regular usage.

Using Fedora 23 with libinput-1.2.4-1.fc23.x86_64.
Comment 1 Damián Nohales 2016-06-06 17:04:33 UTC
Created attachment 124366 [details]
no-pressure.txt
Comment 2 Damián Nohales 2016-06-06 17:04:53 UTC
Created attachment 124367 [details]
low-pressure.txt
Comment 3 Damián Nohales 2016-06-06 17:05:15 UTC
Created attachment 124368 [details]
normal-pressure.txt
Comment 4 Damián Nohales 2016-06-06 17:05:36 UTC
Created attachment 124369 [details]
high-pressure.txt
Comment 5 Peter Hutterer 2016-06-10 10:46:04 UTC
basic problem: BTN_TOUCH is sent by the touchpad regardless of the pressure (afaict). That causes libinput to assume that there is a finger on the touchpad.

we change this to support hovering, but that means we need a pressure threshold and they are notoriously had to get right and we don't have the hooks for this in libinput just yet.

from what I can tell by looking at your recordings:
no pressure: max 69
low pressure: max 108
normal pressure: max 156
high pressure: max 172

but there's a fair bit of overlap. I suspect the magic point is around the 100 mark. 


The ABS_MT_WIDTH_MAJOR/MINOR is effectively useless, the touches are all in the 20-23mm mark. No pressure has a few in the 18-19 mark but there's at least one with 24x22mm in there (which is more than any of the high-pressure ones)

ABS_MT_TOUCH_MAJOR/MINOR may be useful, but I have yet to figure out what those numbers mean, they are always a bit random

so to get anywhere here, we'd need a lower pressure threshold to support hovering on these devices.
Comment 6 Damián Nohales 2016-06-10 15:47:00 UTC
Thanks,

(In reply to Peter Hutterer from comment #5)
> but there's a fair bit of overlap. I suspect the magic point is around the
> 100 mark. 

I was doing an extra little test by grepping the word "ABS_PRESSURE" of the evemu-record output, so I can see effectively at which pressure I start to touch the clickpad.

Just by resting my finger in the clickpad, without moving, I feel that I can touch it (with very little pressure, but touching it) around the ABS_PRESSURE = 60.

Maybe that's a good threshold.

Also, I can perform a tap with max pressures of 76. 

Anyway, once we have some way to test it, we could suggest a better number.
Comment 7 Peter Hutterer 2016-06-12 23:44:06 UTC
https://github.com/whot/input-data-analysis

Have a look at this repo, it's a bunch of python scripts that analyse the events recorded by evemu. There's already one for touchpad pressure, if you know basic python it should be easy to knock up more scripts to look at and analyse whatever you want.

I don't think 60 is a good threshold btw, as I said above your "no pressure" recording went to 69. If in doubt I'd rather have the threshold a bit higher so it requires a definitive touch rather, that's more useful than having phantom touches. And the use-case for moving the pointer with a ever-so-faint touch is limited anyway.
Comment 8 Peter Hutterer 2017-02-21 22:42:24 UTC
we have the pressure-detection bits in libinput now, so if you can provide me with a good number for touch detection, I can add that.
Comment 9 Peter Hutterer 2017-03-02 06:12:27 UTC
Created attachment 130022 [details] [review]
0001-touchpad-set-apple-specific-pressure-values.patch

how's this one working?
Comment 10 Damián Nohales 2017-03-02 12:19:31 UTC
Hello Peter. I'm on vacation now without my personal laptop so I couldn't tell just right now. I'm gonna be back on 14th so I can test it. Thanks for working on this.
Comment 11 Peter Hutterer 2017-03-15 23:22:46 UTC
please test this soon, the 1.7 release is currently stalling on this, thanks
Comment 12 Peter Hutterer 2017-03-21 00:37:39 UTC
Debugged this with Damián on IRC - problem is that the bcm5974 doesn't send ABS_MT_PRESSURE, only ABS_PRESSURE even though it is a multi-touch touchpad. So the pressure thresholds don't get used, libinput treats it as a non-pressure-capable touchpad.

For the bcm5974 devices, the better solution is to rely on ABS_MT_WIDTH or ABS_MT_TOUCH_MAJOR/MINOR instead of hacking something up to use pressure across the slots. So this patch is obsolete for now until we have support for those bits.
Comment 14 Peter Hutterer 2017-08-17 22:07:32 UTC
Patch is upstream, closing this bug. If it's still an issue we need to tweak the thresholds.

commit 432fbc33cd6a2181ac213eeb66239df8312836a6
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Mar 22 16:16:21 2017 +1000

    touchpad: add touch-size based touch handling

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.