1
0

touchpad-pressure-debugging.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. ==============================================================================
  2. Debugging touchpad pressure/size ranges
  3. ==============================================================================
  4. :ref:`Touchpad pressure/size ranges <touchpad_pressure>` depend on
  5. :ref:`device-quirks` entry specific to each laptop model. To check if a
  6. pressure/size range is already defined for your device, use the
  7. :ref:`libinput quirks <device-quirks-debugging>` tool: ::
  8. $ libinput quirks list /dev/input/event19
  9. If your device does not list any quirks, it probably needs a touch
  10. pressure/size range, a palm threshold and a thumb threshold. Start with
  11. :ref:`touchpad_pressure_hwdb`, then :ref:`touchpad_touch_size_hwdb`. The
  12. respective tools will exit if the required axis is not supported.
  13. .. _touchpad_pressure_hwdb:
  14. ------------------------------------------------------------------------------
  15. Debugging touchpad pressure ranges
  16. ------------------------------------------------------------------------------
  17. This section describes how to determine the touchpad pressure ranges
  18. required for a touchpad device and how to add the required
  19. :ref:`device-quirks` locally. Note that the quirk is **not public API** and **may
  20. change at any time**. Users are advised to :ref:`report a bug <reporting_bugs>`
  21. with the updated pressure ranges when testing has completed.
  22. .. note:: Most distributions ship ``libinput measure`` in a separate
  23. ``libinput-utils`` package.
  24. Use the ``libinput measure touchpad-pressure`` tool provided by libinput.
  25. This tool will search for your touchpad device and print some pressure
  26. statistics, including whether a touch is/was considered logically down.
  27. .. note:: This tool will only work on touchpads with pressure.
  28. Example output of the tool is below: ::
  29. $ sudo libinput measure touchpad-pressure
  30. Using Synaptics TM2668-002: /dev/input/event21
  31. This is an interactive tool
  32. Place a single finger on the touchpad to measure pressure values.
  33. Check that:
  34. - touches subjectively perceived as down are tagged as down
  35. - touches with a thumb are tagged as thumb
  36. - touches with a palm are tagged as palm
  37. If the touch states do not match the interaction, re-run
  38. with --touch-thresholds=down:up using observed pressure values.
  39. See --help for more options.
  40. Interactive keys:
  41. q/a - decrease/increase down threshold
  42. w/s - decrease/increase up threshold
  43. e/d - decrease/increase palm threshold
  44. r/f - decrease/increase thumb threshold
  45. Press Ctrl+C to exit
  46. ┌───────────────────────────────────────────────────────────────────────────────┐
  47. │ Touch │ down │ up │ palm │ thumb │ min │ max │ p │ avg │ median │
  48. ├───────────────────────────────────────────────────────────────────────────────┤
  49. │ 178 │ x │ x │ │ │ 75 │ 75 │ 0 │ 75 │ 75 │
  50. │ 179 │ x │ x │ │ │ 35 │ 88 │ 0 │ 77 │ 81 │
  51. │ 180 │ x │ x │ │ x │ 65 │ 113 │ 0 │ 98 │ 98 │
  52. │ 181 │ x │ x │ │ x │ 50 │ 101 │ 0 │ 86 │ 90 │
  53. │ 182 │ x │ x │ │ │ 40 │ 80 │ 0 │ 66 │ 70 │
  54. │ 183 │ x │ │ │ │ 43 │ 78 │ 78 │ │
  55. │ Thresh │ 70 │ 60 │ 130 │ 100 │
  56. ...
  57. The example output shows five completed touch sequences and one ongoing one.
  58. For each, the respective minimum and maximum pressure values are printed as
  59. well as some statistics. The ``down`` column shows that each sequence was
  60. considered logically down at some point (see the thresholds in the last line),
  61. two of the sequences were considered thumbs. This is an interactive tool and
  62. its output may change frequently. Refer to the
  63. **libinput-measure-touchpad-pressure(1)** man page for more details.
  64. By default, this tool uses the :ref:`device-quirks` for the pressure range. To
  65. narrow down on the best values for your device, adjust the thresholds using
  66. the keys q/a, w/s, e/d and r/f or specify the 'logically down'
  67. and 'logically up' pressure thresholds with the ``--touch-thresholds``
  68. argument: ::
  69. $ sudo libinput measure touchpad-pressure --touch-thresholds=10:8 --palm-threshold=20
  70. Interact with the touchpad and check if the output of this tool matches your
  71. expectations.
  72. .. note:: This is an interactive process. You will need to re-run the
  73. tool with varying thresholds until you find the right range for
  74. your touchpad. Attaching output logs to a bug will not help, only
  75. you with access to the hardware can figure out the correct
  76. ranges.
  77. Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with
  78. :ref:`device-quirks` entry similar to this: ::
  79. $> cat /etc/libinput/local-overrides.quirks
  80. [Touchpad pressure override]
  81. MatchUdevType=touchpad
  82. MatchName=*SynPS/2 Synaptics TouchPad
  83. MatchDMIModalias=dmi:*:svnLENOVO:*:pvrThinkPadX230:*
  84. AttrPressureRange=10:8
  85. AttrPalmPressureThreshold=150
  86. AttrThumbPressureThreshold=100
  87. The file name **must** be ``/etc/libinput/local-overrides.quirks``.
  88. The first line is the section name and can be free-form. The ``Match``
  89. directives limit the quirk to your touchpad, make sure the device name
  90. matches your device's name (see ``libinput record``'s output). The dmi
  91. modalias match should be based on the information in
  92. ``/sys/class/dmi/id/modalias``. This modalias should be shortened to the
  93. specific system's information, usually system vendor (svn)
  94. and product name (pn).
  95. Once in place, run the following command to verify the quirk is valid and
  96. works for your device: ::
  97. $ sudo libinput quirks list /dev/input/event10
  98. AttrPressureRange=10:8
  99. Replace the event node with the one from your device. If the
  100. ``AttrPressureRange`` quirk does not show up, re-run with ``--verbose`` and
  101. check the output for any error messages.
  102. If the pressure range quirk shows up correctly, restart X or the
  103. Wayland compositor and libinput should now use the correct pressure
  104. thresholds. The :ref:`tools` can be used to verify the correct
  105. functionality first without the need for a restart.
  106. Once the pressure ranges are deemed correct,
  107. :ref:`report a bug <reporting_bugs>` to get the pressure ranges into the
  108. repository.
  109. .. _touchpad_touch_size_hwdb:
  110. ------------------------------------------------------------------------------
  111. Debugging touch size ranges
  112. ------------------------------------------------------------------------------
  113. This section describes how to determine the touchpad size ranges
  114. required for a touchpad device and how to add the required
  115. :ref:`device-quirks` locally. Note that the quirk is **not public API** and **may
  116. change at any time**. Users are advised to :ref:`report a bug <reporting_bugs>`
  117. with the updated pressure ranges when testing has completed.
  118. .. note:: Most distributions ship ``libinput measure`` in a separate
  119. ``libinput-utils`` package.
  120. Use the ``libinput measure touch-size`` tool provided by libinput.
  121. This tool will search for your touchpad device and print some touch size
  122. statistics, including whether a touch is/was considered logically down.
  123. .. note:: This tool will only work on touchpads with the ``ABS_MT_MAJOR`` axis.
  124. Example output of the tool is below: ::
  125. $ sudo libinput measure touch-size --touch-thresholds 10:8 --palm-threshold 14
  126. Using ELAN Touchscreen: /dev/input/event5
  127. &nbsp;
  128. Ready for recording data.
  129. Touch sizes used: 10:8
  130. Palm size used: 14
  131. Place a single finger on the device to measure touch size.
  132. Ctrl+C to exit
  133. &nbsp;
  134. Sequence: major: [ 9.. 11] minor: [ 7.. 9]
  135. Sequence: major: [ 9.. 10] minor: [ 7.. 7]
  136. Sequence: major: [ 9.. 14] minor: [ 6.. 9] down
  137. Sequence: major: [ 11.. 11] minor: [ 9.. 9] down
  138. Sequence: major: [ 4.. 33] minor: [ 1.. 5] down palm
  139. The example output shows five completed touch sequences. For each, the
  140. respective minimum and maximum pressure values are printed as well as some
  141. statistics. The ``down`` and ``palm`` tags show that sequence was considered
  142. logically down or a palm at some point. This is an interactive tool and its
  143. output may change frequently. Refer to the **libinput-measure-touch-size(1)** man
  144. page for more details.
  145. By default, this tool uses the :ref:`device-quirks` for the touch size range. To
  146. narrow down on the best values for your device, specify the 'logically down'
  147. and 'logically up' pressure thresholds with the ``--touch-thresholds``
  148. arguments as in the example above.
  149. Interact with the touchpad and check if the output of this tool matches your
  150. expectations.
  151. .. note:: This is an interactive process. You will need to re-run the
  152. tool with varying thresholds until you find the right range for
  153. your touchpad. Attaching output logs to a bug will not help, only
  154. you with access to the hardware can figure out the correct
  155. ranges.
  156. Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with
  157. :ref:`device-quirks` entry similar to this: ::
  158. $> cat /etc/libinput/local-overrides.quirks
  159. [Touchpad touch size override]
  160. MatchUdevType=touchpad
  161. MatchName=*SynPS/2 Synaptics TouchPad
  162. MatchDMIModalias=dmi:*:svnLENOVO:*:pvrThinkPadX230:*
  163. AttrTouchSizeRange=10:8
  164. The first line is the match line and should be adjusted for the device name
  165. (see :ref:`libinput record <libinput-record>`'s output) and for the local system, based on the
  166. information in ``/sys/class/dmi/id/modalias``. The modalias should be
  167. shortened to the specific system's information, usually system vendor (svn)
  168. and product name (pn).
  169. Once in place, run the following command to verify the quirk is valid and
  170. works for your device: ::
  171. $ sudo libinput quirks list /dev/input/event10
  172. AttrTouchSizeRange=10:8
  173. Replace the event node with the one from your device. If the
  174. ``AttrTouchSizeRange`` quirk does not show up, re-run with ``--verbose`` and
  175. check the output for any error messages.
  176. If the touch size range property shows up correctly, restart X or the
  177. Wayland compositor and libinput should now use the correct thresholds.
  178. The :ref:`tools` can be used to verify the correct functionality first without
  179. the need for a restart.
  180. Once the touch size ranges are deemed correct, :ref:`reporting_bugs` "report a
  181. bug" to get the thresholds into the repository.