linux-stable/Documentation/input
Peter Hutterer 20ccc8dd38 Documentation: input: define ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams
ABS_PRESSURE and ABS_MT_PRESSURE on touch devices usually represent
contact size (as a finger flattens with higher pressure the contact size
increases) and userspace translates the kernel pressure value back into
contact size. For example, libinput has pressure thresholds when a touch is
considered a palm (palm == large contact area -> high pressure). The values
themselves are on an arbitrary scale and device-specific.

On pressurepads however, the pressure axis may represent the real physical
pressure. Pressurepads are touchpads without a hinge but an actual pressure
sensor underneath the device instead, for example the Lenovo Yoga 9i.

A high-enough pressure is converted to a button click by the firmware.
Microsoft does not require a pressure axis to be present, see [1], so as seen
from userspace most pressurepads are identical to clickpads - one button and
INPUT_PROP_BUTTONPAD set.

However, pressurepads that export the pressure axis break userspace because
that axis no longer represents contact size, resulting in inconsistent touch
tracking, e.g. [2]. Userspace needs to know when a pressure axis represents
real pressure and the best way to do so is to define what the resolution
field means. Userspace can then treat data with a pressure resolution as
true pressure.

This patch documents that the pressure resolution is in units/gram. This
allows for fine-grained detail and tops out at roughly ~2000t, enough for the
devices we're dealing with. Grams is not a scientific pressure unit but the
alternative is:
- Pascal: defined as force per area and area is unreliable on many devices and
  seems like the wrong option here anyway, especially for devices with a
  single pressure sensor only.
- Newton: defined as mass * distance/acceleration and for the purposes of a
  pressure axis, the distance is tricky to interpret and we get the data to
  calculate acceleration from event timestamps anyway.

For the purposes of touch devices and digitizers, grams seems the best choice
and the easiest to interpret.

Bonus side effect: we can use the existing hwdb infrastructure in userspace to
fix devices that advertise false pressure.

[1] https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections#windows-precision-touchpad-input-reports
[2] https://gitlab.freedesktop.org/libinput/libinput/-/issues/562

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20210112230310.GA149342@jelly
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2021-01-28 16:43:04 -07:00
..
devices doc: Change LXR references to elixir.bootlin.com 2019-02-01 16:05:03 -07:00
joydev docs: fix nested numbering in the TOC 2017-08-24 13:32:26 -06:00
event-codes.rst Documentation: input: define ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams 2021-01-28 16:43:04 -07:00
ff.rst Input: fix small typos in force feedback documentation 2018-01-19 09:35:23 -08:00
gamepad.rst Input: docs - split input docs into kernel- and user-facing 2017-04-17 20:19:34 -07:00
gameport-programming.rst Input: create a book with Linux Input documentation 2017-04-05 15:45:07 -07:00
index.rst docs: Turn off section numbering for the input docs 2017-07-12 16:51:44 -06:00
input-programming.rst Input: document inhibiting 2020-12-02 22:10:37 -08:00
input.rst docs: hid: convert to ReST 2019-07-02 10:19:34 +02:00
input_kapi.rst Input: docs - split input docs into kernel- and user-facing 2017-04-17 20:19:34 -07:00
input_uapi.rst Input: add uinput documentation 2017-04-24 16:50:37 -07:00
interactive.svg Input: docs - convert interactive.fig from xfig to svg 2017-04-05 15:45:09 -07:00
multi-touch-protocol.rst Documentation: input: define ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams 2021-01-28 16:43:04 -07:00
notifier.rst Input: create a book with Linux Input documentation 2017-04-05 15:45:07 -07:00
shape.svg Input: docs - convert shape.fig from xfig to svg 2017-04-05 15:45:08 -07:00
uinput.rst Input: uinput - fix typo in function name documentation 2020-07-28 18:24:11 -07:00
userio.rst Input: create a book with Linux Input documentation 2017-04-05 15:45:07 -07:00