absolute-coordinate-ranges.rst 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. .. _absolute_coordinate_ranges:
  2. ==============================================================================
  3. Coordinate ranges for absolute axes
  4. ==============================================================================
  5. libinput requires that all touchpads provide a correct axis range and
  6. resolution. These are used to enable or disable certain features or adapt
  7. the interaction with the touchpad. For example, the software button area is
  8. narrower on small touchpads to avoid reducing the interactive surface too
  9. much. Likewise, palm detection works differently on small touchpads as palm
  10. interference is less likely to happen.
  11. Touchpads with incorrect axis ranges generate error messages
  12. in the form:
  13. <blockquote>
  14. Axis 0x35 value 4000 is outside expected range [0, 3000]
  15. </blockquote>
  16. This error message indicates that the ABS_MT_POSITION_X axis (i.e. the x
  17. axis) generated an event outside the expected range of 0-3000. In this case
  18. the value was 4000.
  19. This discrepancy between the coordinate range the kernels advertises vs.
  20. what the touchpad sends can be the source of a number of perceived
  21. bugs in libinput.
  22. .. _absolute_coordinate_ranges_fix:
  23. ------------------------------------------------------------------------------
  24. Measuring and fixing touchpad ranges
  25. ------------------------------------------------------------------------------
  26. To fix the touchpad you need to:
  27. #. measure the physical size of your touchpad in mm
  28. #. run the ``libinput measure touchpad-size`` tool
  29. #. verify the hwdb entry provided by this tool
  30. #. test locally
  31. #. send a patch to the `systemd project <https://github.com/systemd/systemd>`_.
  32. Detailed explanations are below.
  33. The ``libinput measure touchpad-size`` tool is an interactive tool. It must
  34. be called with the physical dimensions of the touchpad in mm. In the example
  35. below, we use 100mm wide and 55mm high. The tool will find the touchpad device
  36. automatically.
  37. ::
  38. $> sudo libinput measure touchpad-size 100x55
  39. Using "Touchpad SynPS/2 Synaptics TouchPad": /dev/input/event4
  40. Kernel specified touchpad size: 99.7x75.9mm
  41. User specified touchpad size: 100.0x55.0mm
  42. Kernel axis range: x [1024..5112], y [2024..4832]
  43. Detected axis range: x [ 0.. 0], y [ 0.. 0]
  44. Move one finger along all edges of the touchpad
  45. until the detected axis range stops changing.
  46. ...
  47. Move the finger around until the detected axis range matches the data sent
  48. by the device. ``Ctrl+C`` terminates the tool and prints a
  49. suggested hwdb entry. ::
  50. ...
  51. Kernel axis range: x [1024..5112], y [2024..4832]
  52. ^C
  53. Detected axis range: x [2072..4880], y [2159..4832]
  54. Resolutions calculated based on user-specified size: x 28, y 49 units/mm
  55. Suggested hwdb entry:
  56. Note: the dmi modalias match is a guess based on your machine's modalias:
  57. dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:
  58. Please verify that this is the most sensible match and adjust if necessary.
  59. -8<--------------------------
  60. # Laptop model description (e.g. Lenovo X1 Carbon 5th)
  61. evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
  62. EVDEV_ABS_00=2072:4880:28
  63. EVDEV_ABS_01=2159:4832:49
  64. EVDEV_ABS_35=2072:4880:28
  65. EVDEV_ABS_36=2159:4832:49
  66. -8<--------------------------
  67. Instructions on what to do with this snippet are in /usr/lib/udev/hwdb.d/60-evdev.hwdb
  68. If there are discrepancies between the coordinate range the kernels
  69. advertises and what the touchpad sends, the hwdb entry should be added to the
  70. ``60-evdev.hwdb`` file provided by the `systemd project <https://github.com/systemd/systemd>`_.
  71. An example commit can be found
  72. `here <https://github.com/systemd/systemd/commit/26f667eac1c5e89b689aa0a1daef6a80f473e045>`_.
  73. The ``libinput measure touchpad-size`` tool attempts to provide the correct
  74. dmi match but it does require user verification.
  75. In most cases the dmi match can and should be trimmed to the system vendor (``svn``)
  76. and the product version (``pvr``) or product name (``pn``), with everything else
  77. replaced by a wildcard (``*``). In the above case, the match string is:
  78. ::
  79. evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
  80. As a general rule: for Lenovo devices use ``pvr`` and for all others use
  81. ``pn``.
  82. .. note:: hwdb match strings only allow for alphanumeric ascii characters. Use a
  83. wildcard (* or ?, whichever appropriate) for special characters.
  84. The actual axis overrides are in the form:
  85. ::
  86. # axis number=min:max:resolution
  87. EVDEV_ABS_00=2072:4880:28
  88. or, if the range is correct but the resolution is wrong
  89. ::
  90. # axis number=::resolution
  91. EVDEV_ABS_00=::28
  92. Note the leading single space. The axis numbers are in hex and can be found
  93. in ``linux/input-event-codes.h``. For touchpads ``ABS_X``, ``ABS_Y``,
  94. ``ABS_MT_POSITION_X`` and ``ABS_MT_POSITION_Y`` are required.
  95. .. note:: The touchpad's ranges and/or resolution should only be fixed when
  96. there is a significant discrepancy. A few units do not make a
  97. difference and a resolution that is off by 2 or less usually does
  98. not matter either.
  99. Once a match and override rule has been found, follow the instructions at
  100. the top of the
  101. `60-evdev.hwdb <https://github.com/systemd/systemd/blob/main/hwdb.d/60-evdev.hwdb>`_
  102. file to save it locally and trigger the udev hwdb reload. Rebooting is
  103. always a good idea. If the match string is correct, the new properties will
  104. show up in the
  105. output of
  106. ::
  107. udevadm info /sys/class/input/event4
  108. Adjust the command for the event node of your touchpad.
  109. A udev builtin will apply the new axis ranges automatically.
  110. When the axis override is confirmed to work, please submit it as a pull
  111. request to the `systemd project <https://github.com/systemd/systemd>`_.