Tuesday, July 4, 2017

libinput and pressure-based palm detection

I (finally!) merged a patchset to detect palms based on pressure into libinput. This should remove a lot of issues that our users have seen with accidental pointer movement. Palm detection in libinput previously used two approaches: disable-while-typing and an edge-based approach. The former simply ignores touchpad events while keyboard events are detected, the latter ignores touches that happen in the edge zones of the touchpad where real interaction is unlikely. Both approaches have the obvious disadvantages: they're timeout- and location-dependent, causing erroneous pointer movements. But their big advantage is that they work even on old touchpads where a lot of other information is unreliable. Touchpads are getting better, so it's time to make use of that.

The new feature is relatively simple: libinput looks at per-touch pressure and if that pressure hits a given threshold, the touch is regarded as palm. Once a palm, that touch will be ignored until touch up. The threshold is intended to be high enough that it cannot easily be hit. At least on the touchpads I have available for testing, I have to go through quite some effort to trigger palm detection with my finger.

Pressure on touchpads is unfortunately hardware-dependent and we can expect most laptops to have different pressure thresholds. For our users this means that the feature won't immediately work perfectly, it will require a lot of hwdb entries. libinput now ships a libinput measure touchpad-pressure tool to experiment with the various pressure thresholds. This makes it easy to figure out the right pressure threshold and submit a bug report (or patch) for libinput to get the pressure threshold updated. The documentation for this tool is available as part of libinput's online documentation.

TLDR: if libinput seems to misdetect touches as palms, figure out the right threshold with libinput measure touchpad-pressure and file a bug report so we can merge this into our hwdb.


Unknown said...

Can't wait to try this out. Thank you!

PDXWeb said...
This comment has been removed by the author.
PDXWeb said...

Do you by chance have a ThinkPad X1 Carbon 4th gen for testing? Accidental pointer movement while typing has been so severe and intolerable that I have to turn off tap-to-click, which is most unfortunate.

I'm on an Arch-based distro, so hopefully I'll receive this soon, if I haven't yet.

I very much look forward to the improvement.

Peter Hutterer said...

I have access to a T440 and a T450, but not a X1 Carbon, sorry.

PDXWeb said...

Unfortunately, that update made no difference. Before any lengthy typing, tap-to-click still has to be disabled on the 4th Gen X1 Carbon.