device-quirks.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. .. _device-quirks:
  2. ==============================================================================
  3. Device quirks
  4. ==============================================================================
  5. libinput requires extra information from devices that is not always readily
  6. available. For example, some touchpads are known to have jumping cursors
  7. under specific conditions. libinput ships a set of files containing the
  8. so-called model quirks to provide that information. Model quirks are usually
  9. installed under ``/usr/share/libinput/<filename>.quirks`` and are standard
  10. ``.ini`` files. A file may contain multiple section headers (``[some
  11. identifier]``) followed by one or more :ref:`MatchFoo=Bar <device-quirks-matches>`
  12. directives, followed by at least one of ``ModelFoo=1`` or ``AttrFoo=bar`` directive.
  13. See the ``quirks/README.md`` file in the libinput source repository for more
  14. details on their contents.
  15. .. warning:: Model quirks are internal API and may change at any time. No
  16. backwards-compatibility is guaranteed.
  17. For example, a quirks file may have this content to label all keyboards on
  18. the serial bus (PS/2) as internal keyboards: ::
  19. [Serial Keyboards]
  20. MatchUdevType=keyboard
  21. MatchBus=ps2
  22. AttrKeyboardIntegration=internal
  23. The model quirks are part of the source distribution and should never be
  24. modified locally. Updates to libinput may overwrite modifications or even
  25. stop parsing any property. For temporary local workarounds, see
  26. :ref:`device-quirks-local`.
  27. Device quirks are parsed on libinput initialization. A parsing error in the
  28. device quirks disables **all** device quirks and may negatively impact
  29. device behavior on the host. If the quirks cannot be loaded, an error
  30. message is posted to the log and users should use the information in
  31. :ref:`device-quirks-debugging` to verify their quirks files.
  32. .. _device-quirks-local:
  33. ------------------------------------------------------------------------------
  34. Installing temporary local device quirks
  35. ------------------------------------------------------------------------------
  36. The model quirks are part of the source distribution and should never be
  37. modified. For temporary local workarounds, libinput reads the
  38. ``/etc/libinput/local-overrides.quirks`` file. Users may add sections to
  39. this file to add a device quirk for a local device but beware that **any
  40. modification must be upstreamed** or it may cease to work at any time.
  41. .. warning:: Model quirks are internal API and may change at any time. No
  42. backwards-compatibility is guaranteed. Local overrides should only
  43. be used until the distribution updates the libinput packages.
  44. The ``local-overrides.quirks`` file usually needs to be created by the user.
  45. Once the required section has been added, use the information from section
  46. :ref:`device-quirks-debugging` to validate and test the quirks.
  47. .. _device-quirks-debugging:
  48. ------------------------------------------------------------------------------
  49. Debugging device quirks
  50. ------------------------------------------------------------------------------
  51. libinput provides the ``libinput quirks`` tool to debug the quirks database.
  52. This tool takes an action as first argument, the most common invocation is
  53. ``libinput quirks list`` to list model quirks that apply to one or more local
  54. devices. ::
  55. $ libinput quirks list /dev/input/event19
  56. $ libinput quirks list /dev/input/event0
  57. AttrLidSwitchReliability=unreliable
  58. The device `event19` does not have any quirks assigned.
  59. When called with the ``--verbose`` argument, ``libinput quirks list`` prints
  60. information about all files and its attempts to match the device: ::
  61. $ libinput quirks list --verbose /dev/input/event0
  62. quirks debug: /usr/share/share/libinput is data root
  63. quirks debug: /usr/share/share/libinput/10-generic-keyboard.quirks
  64. quirks debug: /usr/share/share/libinput/10-generic-lid.quirks
  65. [...]
  66. quirks debug: /usr/share/etc/libinput/local-overrides.quirks
  67. quirks debug: /dev/input/event0: fetching quirks
  68. quirks debug: [Serial Keyboards] (10-generic-keyboard.quirks) wants MatchBus but we don't have that
  69. quirks debug: [Lid Switch Ct9] (10-generic-lid.quirks) matches for MatchName
  70. quirks debug: [Lid Switch Ct10] (10-generic-lid.quirks) matches for MatchName
  71. quirks debug: [Lid Switch Ct10] (10-generic-lid.quirks) matches for MatchDMIModalias
  72. quirks debug: [Lid Switch Ct10] (10-generic-lid.quirks) is full match
  73. quirks debug: property added: AttrLidSwitchReliability from [Lid Switch Ct10] (10-generic-lid.quirks)
  74. quirks debug: [Aiptek No Tilt Tablet] (30-vendor-aiptek.quirks) wants MatchBus but we don't have that
  75. [...]
  76. quirks debug: [HUION PenTablet] (30-vendor-huion.quirks) wants MatchBus but we don't have that
  77. quirks debug: [Logitech Marble Mouse Trackball] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  78. quirks debug: [Logitech K400] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  79. quirks debug: [Logitech K400r] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  80. quirks debug: [Logitech K830] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  81. quirks debug: [Logitech K400Plus] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  82. quirks debug: [Logitech Wireless Touchpad] (30-vendor-logitech.quirks) wants MatchBus but we don't have that
  83. quirks debug: [Microsoft Surface 3 Lid Switch] (30-vendor-microsoft.quirks) matches for MatchName
  84. [...]
  85. AttrLidSwitchReliability
  86. Note that this is an example only, the output may change over time. The tool
  87. uses the same parser as libinput and any parsing errors will show up in the
  88. output.
  89. .. _device-quirks-list:
  90. ------------------------------------------------------------------------------
  91. List of currently available device quirks
  92. ------------------------------------------------------------------------------
  93. This list is a guide for developers to ease the process of submitting
  94. patches upstream. This section shows device quirks currently available in
  95. |git_version|.
  96. .. warning:: Quirks are internal API and may change at any time for any reason.
  97. No guarantee is given that any quirk below works on your version of
  98. libinput.
  99. In the documentation below, the letters N, M, O, P refer to arbitrary integer
  100. values.
  101. Quirks starting with **Model*** triggers implementation-defined behaviour
  102. for this device not needed for any other device. Only the more
  103. general-purpose **Model*** flags are listed here.
  104. ModelALPSSerialTouchpad, ModelAppleTouchpad, ModelWacomTouchpad, ModelChromebook
  105. Reserved for touchpads made by the respective vendors
  106. ModelTouchpadVisibleMarker
  107. Indicates the touchpad has a drawn-on visible marker between the software
  108. buttons.
  109. ModelTabletModeNoSuspend
  110. Indicates that the device does not need to be
  111. suspended in :ref:`switches_tablet_mode`.
  112. ModelTabletModeSwitchUnreliable
  113. Indicates that this tablet mode switch's state cannot be relied upon.
  114. ModelTrackball
  115. Reserved for trackballs
  116. ModelBouncingKeys
  117. Indicates that the device may send fake bouncing key events and
  118. timestamps can not be relied upon.
  119. ModelSynapticsSerialTouchpad
  120. Reserved for touchpads made by Synaptics on the serial bus
  121. ModelPressurePad
  122. .. warning:: This quirk is no longer in use. Use
  123. ``AttrInputProp=+INPUT_PROP_PRESSUREPAD`` instead.
  124. Unlike in traditional touchpads, whose pressure value equals contact size,
  125. on pressure pads pressure is a real physical axis.
  126. Indicates that the device is a pressure pad.
  127. ModelTouchpadPhantomClicks
  128. Some laptops are prone to registering touchpad clicks when the case is
  129. bent. Indicates that clicks should be ignored if no fingers are on the
  130. touchpad.
  131. ModelScrollOnMiddleClick
  132. Some mice can generate unwanted high-resolution scroll events when the wheel
  133. is pressed. Increases the scroll threshold required to start scrolling to
  134. avoid accidentally scrolling when middle clicking.
  135. AttrSizeHint=NxM, AttrResolutionHint=NxM
  136. Hints at the width x height of the device in mm, or the resolution
  137. of the x and y axes in units/mm. These may only be used where they apply to
  138. a large proportion of matching devices. They should not be used for any
  139. specific device, override ``EVDEV_ABS_*`` instead, see
  140. :ref:`absolute_coordinate_ranges_fix`.
  141. AttrTouchSizeRange=N:M, AttrPalmSizeThreshold=O
  142. Specifies the touch size required to trigger a press (N) and to trigger
  143. a release (M). O > N > M. See :ref:`touchpad_touch_size_hwdb` for more
  144. details.
  145. An AttrPalmSizeThreshold of zero unsets any threshold that has been
  146. inherited from another quirk.
  147. AttrPressureRange=N:M, AttrPalmPressureThreshold=O, AttrThumbPressureThreshold=P
  148. Specifies the touch pressure required to trigger a press (N) and to
  149. trigger a release (M), when a palm touch is triggered (O) and when a
  150. thumb touch is triggered (P). O > P > N > M. See
  151. :ref:`touchpad_pressure_hwdb` for more details.
  152. An AttrPalmPressureThreshold of zero unsets any threshold that has been
  153. inherited from another quirk.
  154. AttrLidSwitchReliability=reliable|unreliable|write_open
  155. Indicates the reliability of the lid switch. This is a string enum.
  156. Very few devices need this, if in doubt do not set. See :ref:`switches_lid`
  157. for details. libinput 1.21.0 changed the default from unreliable to
  158. reliable, which may be removed from local overrides.
  159. AttrKeyboardIntegration=internal|external
  160. Indicates the integration of the keyboard. This is a string enum.
  161. Generally only needed for USB keyboards.
  162. AttrTPKComboLayout=below
  163. Indicates the position of the touchpad on an external touchpad+keyboard
  164. combination device. This is a string enum. Don't specify it unless the
  165. touchpad is below.
  166. AttrEventCode=+EV_ABS;-BTN_STYLUS;+EV_KEY:0x123;
  167. Enables or disables the evdev event type/code tuples on the device. The prefix
  168. for each entry is either '+' (enable) or '-' (disable). Entries may be
  169. a named event type, or a named event code, or a named event type with a
  170. hexadecimal event code, separated by a single colon.
  171. AttrInputProp=+INPUT_PROP_BUTTONPAD;-INPUT_PROP_POINTER;
  172. Enables or disables the evdev input property on the device. The prefix
  173. for each entry is either '+' (enable) or '-' (disable). Entries may be
  174. a named input property or the hexadecimal value of that property.
  175. The most common use of this is ``AttrInputProp=+INPUT_PROP_PRESSUREPAD``
  176. which marks a touchpad as a :ref:`forcepad or pressurepad <touchpads_buttons_forcepads>`.
  177. AttrPointingStickIntegration=internal|external
  178. Indicates the integration of the pointing stick. This is a string enum.
  179. Only needed for external pointing sticks. These are rare.
  180. AttrTabletSmoothing=1|0
  181. Enables (1) or disables (0) input smoothing for tablet devices. Smoothing is enabled
  182. by default, except on AES devices.
  183. .. _device-quirks-matches:
  184. ------------------------------------------------------------------------------
  185. List of currently available matches
  186. ------------------------------------------------------------------------------
  187. ``Match*`` statements are how quirks are assigned to a device. Quirks with multiple
  188. match statements must match all of those to apply.
  189. .. warning:: Quirks are internal API and may change at any time for any reason.
  190. No guarantee is given that any ``Match`` statement below works on
  191. your version of libinput.
  192. MatchName, MatchUniq
  193. Match on the ``NAME`` or ``UNIQ`` udev property on this device. These properties
  194. are typically derived from the device's kernel name or uniq but may be overridden
  195. by a udev rule. These matches use ``fnmatch()`` globs.
  196. MatchBus
  197. A lower-case bus name. Currently supported are ``usb``, ``bluetooth``, ``ps2``,
  198. ``rmi``, ``i2c``, and ``spi``.
  199. MatchVendor, MatchProduct, MatchVersion
  200. The hexadecimal 4-digit vendor ID, product ID or driver version as
  201. exported, uppercase with a ``0x`` prefix, e.g. ``0x12AB```.
  202. MatchDMIModalias, MatchDeviceTree
  203. An ``fnmatch()`` glob for the DMI modalias or the DeviceTree ``compatible`` string.
  204. See ``/sys/class/dmi/id/modalias`` and ``/sys/firmware/devicetree/base/compatible``.
  205. MatchUdevType
  206. One of ``touchpad``, ``mouse``, ``pointingstick``, ``keyboard``, ``joystick``,
  207. ``tablet``, ``tablet-pad``. Matches the corresponding ``ID_INPUT_*`` udev
  208. property.