summaryrefslogtreecommitdiff
path: root/doc/palm-detection.dox
blob: 75fdd90e8f51317afa1129641280a4af1018e00d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/**
@page palm_detection Palm detection

Palm detection tries to identify accidental touches while typing, while
using the trackpoint and/or during general use of the touchpad area.

On most laptops typing on the keyboard generates accidental touches on the
touchpad with the palm (usually the area below the thumb). This can lead to
cursor jumps or accidental clicks. On large touchpads, the palm may also
touch the bottom edges of the touchpad during normal interaction.

Interference from a palm depends on the size of the touchpad and the position
of the user's hand. Data from touchpads showed that almost all palm events
during tying on a Lenovo T440 happened in the left-most and right-most 5% of
the touchpad. The T440 series has one of the largest touchpads, other
touchpads are less affected by palm touches.

libinput has multiple ways of detecting a palm, each of which depends on
hardware-specific capabilities.

- @ref palm_tool
- @ref palm_pressure
- @ref palm_touch_size
- @ref palm_exclusion_zones
- @ref trackpoint-disabling
- @ref disable-while-typing
- @ref stylus-touch-arbitration

Palm detection is always enabled, with the exception of
disable-while-typing.

@section palm_tool Palm detection based on firmware labelling

Some devices provide palm detection in the firmware, forwarded by the kernel
as the `EV_ABS/ABS_MT_TOOL` axis with a value of `MT_TOOL_PALM`
(whenever a palm is detected). libinput honors that value and switches that
touch to a palm.

@section palm_pressure Palm detection based on pressure

The simplest form of palm detection labels a touch as palm when the pressure
value goes above a certain threshold. This threshold is usually high enough
that it cannot be triggered by a finger movement. One a touch is labelled as
palm based on pressure, it will remain so even if the pressure drops below
the threshold again. This ensures that a palm remains a palm even when the
pressure changes as the user is typing.

For some information on how to detect pressure on a touch and debug the
pressure ranges, see @ref touchpad_pressure.

@section palm_touch_size Palm detection based on touch size

On touchads that support the `ABS_MT_TOUCH_MAJOR` axes, libinput can perform
palm detection based on the size of the touch ellipse. This works similar to
the pressure-based palm detection in that a touch is labelled as palm when
it exceeds the (device-specific) touch size threshold.

For some information on how to detect the size of a touch and debug the
touch size ranges, see @ref touchpad_pressure.

@section palm_exclusion_zones Palm exclusion zones

libinput enables palm detection on the left, right and top edges of the
touchpad. Two exclusion zones are defined  on the left and right edge of the
touchpad. If a touch starts in the exclusion zone, it is considered a palm
and the touch point is ignored. However, for fast cursor movements across
the screen, it is common for a finger to start inside an exclusion zone and
move rapidly across the touchpad. libinput detects such movements and avoids
palm detection on such touch sequences.

Another exclusion zone is defined on the top edge of the touchpad. As with
the edge zones, libinput detects vertical movements out of the edge zone and
avoids palm detection on such touch sequences.

Each side edge exclusion zone is divided into a top part and a bottom part.
A touch starting in the top part of the exclusion zone does not trigger a
tap (see @ref tapping).

In the diagram below, the exclusion zones are painted red.
Touch 'A' starts inside the exclusion zone and moves
almost vertically. It is considered a palm and ignored for cursor movement,
despite moving out of the exclusion zone.

Touch 'B' starts inside the exclusion zone but moves horizontally out of the
zone. It is considered a valid touch and controls the cursor.

Touch 'C' occurs in the top part of the exclusion zone. Despite being a
tapping motion, it does not generate an emulated button event. Touch 'D'
likewise occurs within the exclusion zone but in the bottom half. libinput
will generate a button event for this touch.

@image html palm-detection.svg

@section trackpoint-disabling Palm detection during trackpoint use

If a device provides a
[trackpoint](http://en.wikipedia.org/wiki/Pointing_stick), it is
usually located above the touchpad. This increases the likelihood of
accidental touches whenever the trackpoint is used.

libinput disables the touchpad whenever it detects trackpoint activity for a
certain timeout until after trackpoint activity stops. Touches generated
during this timeout will not move the pointer, and touches started during
this timeout will likewise not move the pointer (allowing for a user to rest
the palm on the touchpad while using the trackstick).
If the touchpad is disabled, the @ref t440_support "top software buttons"
remain enabled.

@section disable-while-typing Disable-while-typing

libinput automatically disables the touchpad for a timeout after a key
press, a feature traditionally referred to as "disable while typing" and
previously available through the
[syndaemon(1)](http://linux.die.net/man/1/syndaemon) command. libinput does
not require an external command and the feature is currently enabled for all
touchpads but will be reduced in the future to only apply to touchpads where
finger width or pressure data is unreliable.

Notable behaviors of libinput's disable-while-typing feature:
- Two different timeouts are used, after a single key press the timeout is
  short to ensure responsiveness. After multiple key events, the timeout is
  longer to avoid accidental pointer manipulation while typing.
- Some keys do not trigger the timeout, specifically some modifier keys 
  (Ctrl, Alt, Shift, and Fn). Actions such as Ctrl + click thus stay
  responsive.
- Touches started while typing do not control the cursor even after typing
  has stopped, it is thus possible to rest the palm on the touchpad while
  typing.
- Physical buttons work even while the touchpad is disabled. This includes
  @ref t440_support "software-emulated buttons".

Disable-while-typing can be enabled and disabled by calling
libinput_device_config_dwt_set_enabled().

@section stylus-touch-arbitration Stylus-touch arbitration

A special case of palm detection is touch arbitration on devices that
support styli. When interacting with a stylus on the screen, parts of the
hand may touch the surface and trigger touches. As the user is currently
interacting with the stylus, these touches would interfer with the correct
working of the stylus.

libinput employs a method similar to @ref disable-while-typing to detect
these touches and disables the touchpad accordingly.

@section thumb-detection Thumb detection

Many users rest their thumb on the touchpad while using the index finger to
move the finger around. For clicks, often the thumb is used rather than the
finger. The thumb should otherwise be ignored as a touch, i.e. it should not
count towards @ref clickfinger and it should not cause a single-finger
movement to trigger @ref twofinger_scrolling.

libinput uses two triggers for thumb detection: pressure and
location. A touch exceeding a pressure threshold is considered a thumb if it
is within the thumb detection zone.

@note "Pressure" on touchpads is synonymous with "contact area", a large touch
	surface area has a higher pressure and thus hints at a thumb or palm
	touching the surface.

Pressure readings are unreliable at the far bottom of the touchpad as a
thumb hanging mostly off the touchpad will have a small surface area.
libinput has a definitive thumb zone where any touch is considered a resting
thumb.

@image html thumb-detection.svg

The picture above shows the two detection areas. In the larger (light red)
area, a touch is labelled as thumb when it exceeds a device-specific
pressure threshold. In the lower (dark red) area, a touch is labelled as
thumb if it remains in that area for a time without moving outside.

*/