palm-detection.rst 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. .. _palm_detection:
  2. ==============================================================================
  3. Palm detection
  4. ==============================================================================
  5. Palm detection tries to identify accidental touches while typing, while
  6. using the trackpoint and/or during general use of the touchpad area.
  7. On most laptops typing on the keyboard generates accidental touches on the
  8. touchpad with the palm (usually the area below the thumb). This can lead to
  9. cursor jumps or accidental clicks. On large touchpads, the palm may also
  10. touch the bottom edges of the touchpad during normal interaction.
  11. Interference from a palm depends on the size of the touchpad and the position
  12. of the user's hand. Data from touchpads showed that almost all palm events
  13. during typing on a Lenovo T440 happened in the left-most and right-most 5% of
  14. the touchpad. The T440 series has one of the largest touchpads, other
  15. touchpads are less affected by palm touches.
  16. libinput has multiple ways of detecting a palm, each of which depends on
  17. hardware-specific capabilities.
  18. - :ref:`palm_tool`
  19. - :ref:`palm_pressure`
  20. - :ref:`palm_touch_size`
  21. - :ref:`palm_exclusion_zones`
  22. - :ref:`trackpoint-disabling`
  23. - :ref:`disable-while-typing`
  24. - :ref:`disable-while-trackpointing`
  25. - :ref:`stylus-touch-arbitration`
  26. Palm detection is always enabled, with the exception of
  27. disable-while-typing.
  28. .. _palm_tool:
  29. ------------------------------------------------------------------------------
  30. Palm detection based on firmware labelling
  31. ------------------------------------------------------------------------------
  32. Some devices provide palm detection in the firmware, forwarded by the kernel
  33. as the ``EV_ABS/ABS_MT_TOOL`` axis with a value of ``MT_TOOL_PALM``
  34. (whenever a palm is detected). libinput honors that value and switches that
  35. touch to a palm.
  36. .. _palm_pressure:
  37. ------------------------------------------------------------------------------
  38. Palm detection based on pressure
  39. ------------------------------------------------------------------------------
  40. The simplest form of palm detection labels a touch as palm when the pressure
  41. value goes above a certain threshold. This threshold is usually high enough
  42. that it cannot be triggered by a finger movement. Once a touch is labelled as
  43. palm based on pressure, it will remain so even if the pressure drops below
  44. the threshold again. This ensures that a palm remains a palm even when the
  45. pressure changes as the user is typing.
  46. For some information on how to detect pressure on a touch and debug the
  47. pressure ranges, see :ref:`touchpad_pressure`.
  48. .. _palm_touch_size:
  49. ------------------------------------------------------------------------------
  50. Palm detection based on touch size
  51. ------------------------------------------------------------------------------
  52. On touchpads that support the ``ABS_MT_TOUCH_MAJOR`` axes, libinput can perform
  53. palm detection based on the size of the touch ellipse. This works similar to
  54. the pressure-based palm detection in that a touch is labelled as palm when
  55. it exceeds the (device-specific) touch size threshold.
  56. For some information on how to detect the size of a touch and debug the
  57. touch size ranges, see :ref:`touchpad_pressure`.
  58. .. _palm_exclusion_zones:
  59. ------------------------------------------------------------------------------
  60. Palm exclusion zones
  61. ------------------------------------------------------------------------------
  62. libinput enables palm detection on the left, right and top edges of the
  63. touchpad. Two exclusion zones are defined on the left and right edge of the
  64. touchpad. If a touch starts in the exclusion zone, it is considered a palm
  65. and the touch point is ignored. However, for fast cursor movements across
  66. the screen, it is common for a finger to start inside an exclusion zone and
  67. move rapidly across the touchpad. libinput detects such movements and avoids
  68. palm detection on such touch sequences.
  69. Another exclusion zone is defined on the top edge of the touchpad. As with
  70. the edge zones, libinput detects vertical movements out of the edge zone and
  71. avoids palm detection on such touch sequences.
  72. A touch starting in the exclusion zone does not trigger a tap (see
  73. :ref:`tapping`).
  74. In the diagram below, the exclusion zones are painted red.
  75. Touch 'A' starts inside the exclusion zone and moves
  76. almost vertically. It is considered a palm and ignored for cursor movement,
  77. despite moving out of the exclusion zone.
  78. Touch 'B' starts inside the exclusion zone but moves horizontally out of the
  79. zone. It is considered a valid touch and controls the cursor.
  80. Touch 'C' occurs in the exclusion zone. Despite being a tapping motion, it does
  81. not generate an emulated button event.
  82. .. figure:: palm-detection.svg
  83. :align: center
  84. .. _trackpoint-disabling:
  85. ------------------------------------------------------------------------------
  86. Palm detection during trackpoint use
  87. ------------------------------------------------------------------------------
  88. If a device provides a
  89. `trackpoint <http://en.wikipedia.org/wiki/Pointing_stick>`_, it is
  90. usually located above the touchpad. This increases the likelihood of
  91. accidental touches whenever the trackpoint is used.
  92. libinput disables the touchpad whenever it detects trackpoint activity for a
  93. certain timeout until after trackpoint activity stops. Touches generated
  94. during this timeout will not move the pointer, and touches started during
  95. this timeout will likewise not move the pointer (allowing for a user to rest
  96. the palm on the touchpad while using the trackstick).
  97. If the touchpad is disabled, the :ref:`top software buttons <t440_support>`
  98. remain enabled.
  99. .. _disable-while-typing:
  100. ------------------------------------------------------------------------------
  101. Disable-while-typing
  102. ------------------------------------------------------------------------------
  103. libinput automatically disables the touchpad for a timeout after a key
  104. press, a feature traditionally referred to as "disable while typing" and
  105. previously available through the
  106. `syndaemon(1) <http://linux.die.net/man/1/syndaemon>`_ command. libinput does
  107. not require an external command and the feature is currently enabled for all
  108. touchpads but will be reduced in the future to only apply to touchpads where
  109. finger width or pressure data is unreliable.
  110. Notable behaviors of libinput's disable-while-typing feature:
  111. - Two different timeouts are used, after a single key press the timeout is
  112. short to ensure responsiveness. After multiple key events, the timeout is
  113. longer to avoid accidental pointer manipulation while typing.
  114. - Some keys do not trigger the timeout, specifically some modifier keys
  115. (Ctrl, Alt, Shift, and Fn). Actions such as Ctrl + click thus stay
  116. responsive.
  117. - Touches started while typing do not control the cursor even after typing
  118. has stopped, it is thus possible to rest the palm on the touchpad while
  119. typing.
  120. - Physical buttons work even while the touchpad is disabled. This includes
  121. :ref:`software-emulated buttons <t440_support>`.
  122. - libinput pairs touchpads and keyboards for the disable-while-typing
  123. feature. In the most common case, the internal touchpad is paired only
  124. with the internal keyboard. Typing on an external keyboard will thus not
  125. disable the touchpad. Some devices require a :ref:`quirk <device-quirks>`
  126. to be correctly paired.
  127. Disable-while-typing can be enabled and disabled by calling
  128. **libinput_device_config_dwt_set_enabled()**.
  129. .. _disable-while-trackpointing:
  130. ------------------------------------------------------------------------------
  131. Disable-while-trackpointing
  132. ------------------------------------------------------------------------------
  133. libinput automatically disables the touchpad for a timeout after the trackpoint
  134. is moved, a feature referred to as "disable while trackpointing". libinput does
  135. not require an external command and the feature is currently enabled for all
  136. touchpads.
  137. Disable-while-trackpointing can be enabled and disabled by calling
  138. **libinput_device_config_dwtp_set_enabled()**.
  139. .. _stylus-touch-arbitration:
  140. ------------------------------------------------------------------------------
  141. Stylus-touch arbitration
  142. ------------------------------------------------------------------------------
  143. A special case of palm detection is touch arbitration on devices that
  144. support styli. When interacting with a stylus on the screen, parts of the
  145. hand may touch the surface and trigger touches. As the user is currently
  146. interacting with the stylus, these touches would interfere with the correct
  147. working of the stylus.
  148. libinput employs a method similar to :ref:`disable-while-typing` to detect
  149. these touches and disables the touchpad accordingly.
  150. .. _thumb-detection:
  151. ------------------------------------------------------------------------------
  152. Thumb detection
  153. ------------------------------------------------------------------------------
  154. Many users rest their thumb on the touchpad while using the index finger to
  155. move the finger around. For clicks, often the thumb is used rather than the
  156. finger. The thumb should otherwise be ignored as a touch, i.e. it should not
  157. count towards :ref:`clickfinger` and it should not cause a single-finger
  158. movement to trigger :ref:`twofinger_scrolling`.
  159. libinput uses two triggers for thumb detection: pressure and
  160. location. A touch exceeding a pressure threshold is considered a thumb if it
  161. is within the thumb detection zone.
  162. .. note:: "Pressure" on touchpads is synonymous with "contact area." A large touch
  163. surface area has a higher pressure and thus hints at a thumb or palm
  164. touching the surface.
  165. Pressure readings are unreliable at the far bottom of the touchpad as a
  166. thumb hanging mostly off the touchpad will have a small surface area.
  167. libinput has a definitive thumb zone where any touch is considered a resting
  168. thumb.
  169. .. figure:: thumb-detection.svg
  170. :align: center
  171. The picture above shows the two detection areas. In the larger (light red)
  172. area, a touch is labelled as thumb when it exceeds a device-specific
  173. pressure threshold. In the lower (dark red) area, a touch is labelled as
  174. thumb if it remains in that area for a time without moving outside.