libinput-record.man 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. .TH libinput-record "1"
  2. .SH NAME
  3. libinput\-record \- record kernel events
  4. .SH SYNOPSIS
  5. .B libinput record [options] [\fI/dev/input/event0\fB [\fI/dev/input/event1\fB ...]]
  6. .SH DESCRIPTION
  7. .PP
  8. The \fBlibinput record\fR tool records kernel events from a device and
  9. prints them in a format that can later be replayed with the \fBlibinput
  10. replay(1)\fR tool. This tool needs to run as root to read from the device.
  11. .PP
  12. The output of this tool is YAML, see \fBFILE FORMAT\fR for more details.
  13. By default it prints to stdout unless an output file is provided. For
  14. example, these are valid invocations:
  15. .B libinput record /dev/input/event3 touchpad.yml
  16. .B libinput record recording.yml
  17. .B libinput record --all all-devices.yml
  18. .B libinput record /dev/input/event3 /dev/input/event4 tp-and-keyboard.yml
  19. .PP
  20. The events recorded are independent of libinput itself, updating or
  21. removing libinput will not change the event stream.
  22. .SH OPTIONS
  23. If one or more device nodes are given, this tool opens those device nodes.
  24. Otherwise, a list of devices is presented and the user can select the device
  25. to record. If unsure, run without any arguments.
  26. .TP 8
  27. .B \-\-help
  28. Print help
  29. .TP 8
  30. .B \-\-all
  31. Record all \fI/dev/input/event*\fR devices available on the system. This
  32. option should be used in exceptional cases only, the output file is almost
  33. always too noisy and replaying the recording may not be possible.
  34. This option requires \fB\-\-output-file\fR and no device
  35. nodes may be provided on the commandline.
  36. .TP 8
  37. .B \-\-autorestart=s
  38. Terminate the current recording after
  39. .I s
  40. seconds of device inactivity. The output file is not created until
  41. the first event is received. This avoids creating empty files during
  42. idle periods.
  43. If \fB\-\-output-file\fR is not specified, it defaults to
  44. \fBlibinput-recording.yml\fR. The output filename is used as prefix,
  45. suffixed with the date and time of the recording. The timeout must be
  46. greater than 0.
  47. .TP 8
  48. .B \-o filename.yml
  49. .PD 0
  50. .TP 8
  51. .B \-\-output-file=filename.yml
  52. .PD 1
  53. Specifies the output file to use. If \fB\-\-autorestart\fR is given,
  54. the filename is used as prefix only.
  55. Where \-\-output-file is not given and the first \fBor\fR last argument is
  56. not an input device, the first \fBor\fR last argument will be the output
  57. file.
  58. .TP 8
  59. .B \-\-grab
  60. Exclusively grab all opened devices. This will prevent events from being
  61. delivered to the host system.
  62. .TP 8
  63. .B \-\-show\-keycodes
  64. Show keycodes as-is in the recording. By default, common keys are obfuscated
  65. and printed as \fBKEY_A\fR to avoid information leaks.
  66. .TP 8
  67. .B \-\-with-libinput
  68. Record libinput events alongside device events.
  69. .B THIS FEATURE IS EXPERIMENTAL.
  70. See section
  71. .B RECORDING LIBINPUT EVENTS
  72. for more details.
  73. .TP 8
  74. .B \-\-with-hidraw
  75. Record hidraw events alongside device events.
  76. .B DO NOT TYPE SENSITIVE DATA.
  77. See
  78. .B RECORDING HID REPORTS
  79. for more details.
  80. .TP 8
  81. .B \-\-no\-events
  82. Only print the device description(s) and exit immediately without
  83. waiting for events. The output file will contain the full YAML structure
  84. with an empty
  85. .B events
  86. section. This option is mutually exclusive with
  87. .BR \-\-autorestart .
  88. .SH RECORDING MULTIPLE DEVICES
  89. Sometimes it is necessary to record the events from multiple devices
  90. simultaneously, e.g. when an interaction between a touchpad and a keyboard
  91. causes a bug. \fBlibinput record\fR records multiple devices with
  92. an identical time offset, allowing for correct replay of the interaction.
  93. .PP
  94. If multiple devices are recorded, an output filename must be provided.
  95. .PP
  96. All devices to be recorded must be provided on the commandline, an example
  97. invocation is:
  98. .B libinput record \-o tap-bug /dev/input/event3 /dev/input/event7
  99. Note that when recording multiple devices, only the first device is printed
  100. immediately, all other devices and their events are printed on exit.
  101. .SH RECORDING LIBINPUT EVENTS
  102. When the \fB\-\-with-libinput\fR commandline option is given,
  103. \fBlibinput\-record\fR initializes a libinput context for the devices being
  104. recorded. Events from these contexts are printed alongside the evdev events.
  105. .B THIS FEATURE IS EXPERIMENTAL.
  106. .PP
  107. The primary purpose of this feature is debugging and event analysis, no
  108. caller may rely on any specific format of the events.
  109. .PP
  110. Note that while libinput and \fBlibinput\-record\fR see the same events from
  111. the device nodes, no guarantee can be given about the correct order of
  112. events. libinput events may come in earlier or later than the events from
  113. the device nodes and for some devices, libinput may internally alter the
  114. event stream before processing.
  115. .PP
  116. Note that the libinput context created by \fBlibinput\-record\fR does not
  117. affect the running desktop session and does not (can not!) copy any
  118. configuration options from that session.
  119. .SH RECORDING HID REPORTS
  120. When the \fB\-\-with-hidraw\fR commandline option is given,
  121. \fBlibinput\-record\fR searches for the hidraw node(s) of the given devices
  122. and prints any incoming HID reports from those devices.
  123. .PP
  124. HID reports are \fBnot obfuscated\fR and a sufficiently
  125. motivated person could recover the key strokes from the logs. Do not type
  126. passwords while recording HID reports.
  127. .SH FILE FORMAT
  128. The output file format is in YAML and intended to be both human-readable and
  129. machine-parseable. Below is a short example YAML file, all keys are detailed
  130. further below.
  131. .PP
  132. Any parsers must ignore keys not specified in the file format description.
  133. The version number field is only used for backwards-incompatible changes.
  134. .PP
  135. .nf
  136. .sp
  137. version: 1
  138. ndevices: 2
  139. libinput:
  140. version: 1.10.0
  141. system:
  142. os: "fedora:26"
  143. kernel: "4.13.9-200.fc26.x86_64"
  144. dmi: "dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:..."
  145. devices:
  146. - node: /dev/input/event9
  147. evdev:
  148. # Name: Synaptics TM2668-002
  149. # ID: bus 0x1d vendor 0x6cb product 00 version 00
  150. # Size in mm: 97x68
  151. # Supported Events:
  152. # Event type 0 (EV_SYN)
  153. #.. abbreviated for man page ...
  154. #
  155. name: Synaptics TM2668-002
  156. id: [29, 1739, 0, 0]
  157. codes:
  158. 0: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] # EV_SYN
  159. 1: [272, 325, 328, 330, 333, 334, 335] # EV_KEY
  160. 3: [0, 1, 24, 47, 48, 49, 52, 53, 54, 55, 57, 58] # EV_ABS
  161. absinfo:
  162. 0: [0, 4089, 0, 0, 42]
  163. 1: [0, 2811, 0, 0, 41]
  164. 24: [0, 255, 0, 0, 0]
  165. 47: [0, 4, 0, 0, 0]
  166. 48: [0, 15, 0, 0, 0]
  167. 49: [0, 15, 0, 0, 0]
  168. 52: [0, 1, 0, 0, 0]
  169. 53: [0, 4089, 0, 0, 42]
  170. 54: [0, 2811, 0, 0, 41]
  171. 55: [0, 2, 0, 0, 0]
  172. 57: [0, 65535, 0, 0, 0]
  173. 58: [0, 255, 0, 0, 0]
  174. properties: [0, 2, 4]
  175. hid: [0x0c, 0x17, 0x22, 0x2d, ...]
  176. udev:
  177. properties:
  178. - ID_INPUT_MOUSE=1
  179. - ID_INPUT=1
  180. virtual: false
  181. quirks:
  182. - ModelAppleTouchpad=1
  183. - AttrSizeHint=32x32
  184. events:
  185. - hid:
  186. time: [ 0, 0]
  187. hidraw0: [1, 2, 3, 4]
  188. - evdev:
  189. - [ 0, 0, 3, 57, 1420] # EV_ABS / ABS_MT_TRACKING_ID 1420
  190. - [ 0, 0, 3, 53, 1218] # EV_ABS / ABS_MT_POSITION_X 1218
  191. - [ 0, 0, 3, 54, 1922] # EV_ABS / ABS_MT_POSITION_Y 1922
  192. - [ 0, 0, 3, 52, 0] # EV_ABS / ABS_MT_ORIENTATION 0
  193. - [ 0, 0, 3, 58, 47] # EV_ABS / ABS_MT_PRESSURE 47
  194. - [ 0, 0, 1, 330, 1] # EV_KEY / BTN_TOUCH 1
  195. - [ 0, 0, 1, 325, 1] # EV_KEY / BTN_TOOL_FINGER 1
  196. - [ 0, 0, 3, 0, 1218] # EV_ABS / ABS_X 1218
  197. - [ 0, 0, 3, 1, 1922] # EV_ABS / ABS_Y 1922
  198. - [ 0, 0, 3, 24, 47] # EV_ABS / ABS_PRESSURE 47
  199. - [ 0, 0, 0, 0, 0] # ------------ SYN_REPORT (0) ------- +0ms
  200. - evdev:
  201. - [ 0, 11879, 3, 53, 1330] # EV_ABS / ABS_MT_POSITION_X 1330
  202. - [ 0, 11879, 3, 54, 1928] # EV_ABS / ABS_MT_POSITION_Y 1928
  203. - [ 0, 11879, 3, 58, 46] # EV_ABS / ABS_MT_PRESSURE 46
  204. - [ 0, 11879, 3, 0, 1330] # EV_ABS / ABS_X 1330
  205. - [ 0, 11879, 3, 1, 1928] # EV_ABS / ABS_Y 1928
  206. - [ 0, 11879, 3, 24, 46] # EV_ABS / ABS_PRESSURE 46
  207. - [ 0, 11879, 0, 0, 0] # ------------ SYN_REPORT (0) ------- +0ms
  208. # second device (if any)
  209. - node: /dev/input/event9
  210. evdev: ...
  211. .PP
  212. .fi
  213. .in
  214. Top-level keys are listed below, see the respective
  215. subsection for details on each key.
  216. .PP
  217. .TP 8
  218. .B version: int
  219. The file format version. This version is only increased for
  220. backwards-incompatible changes. A parser must ignore unknown keys to be
  221. forwards-compatible.
  222. .TP 8
  223. .B ndevices: int
  224. The number of device recordings in this file. Always 1 unless multiple
  225. devices were recorded.
  226. .TP 8
  227. .B libinput: {...}
  228. A dictionary with libinput-specific information.
  229. .TP 8
  230. .B system: {...}
  231. A dictionary with system information.
  232. .TP 8
  233. .B devices: {...}
  234. A list of devices containing the description and events of each device.
  235. .SS libinput
  236. .TP 8
  237. .B version: string
  238. libinput version
  239. .SS system
  240. Information about the system
  241. .TP 8
  242. .B os: string
  243. Distribution ID and version, see \fIos-release(5)\fR
  244. .TP 8
  245. .B kernel: string
  246. Kernel version, see \fIuname(1)\fR
  247. .TP 8
  248. .B dmi: string
  249. DMI modalias, see \fI/sys/class/dmi/id/modalias\fR
  250. .SS devices
  251. Information about and events from the recorded device nodes
  252. .TP 8
  253. .B node: string
  254. the device node recorded
  255. .TP 8
  256. .B evdev
  257. A dictionary with the evdev device information.
  258. .TP 8
  259. .B hid
  260. A list of integers representing the HID report descriptor bytes.
  261. .TP 8
  262. .B udev
  263. A dictionary with the udev device information.
  264. .TP 8
  265. .B quirks
  266. A list of device quirks, see below.
  267. .TP 8
  268. .B events
  269. A list of dictionaries with the recorded events
  270. .SS evdev
  271. .TP 8
  272. .B name: string
  273. The device name
  274. .TP 8
  275. .B id: [bustype, vendor, product, version]
  276. The data from the \fBstruct input_id\fR, bustype, vendor, product, version.
  277. .TP 8
  278. .B codes: {type: [a, b, c ], ...}
  279. All evdev types and codes as nested dictionary. The evdev type is the key,
  280. the codes are a list.
  281. .TP 8
  282. .B absinfo: {code: [min, max, fuzz, flat, resolution], ...}
  283. A dictionary of arrays with 5 decimal elements each, denoting the contents of a
  284. \fBstruct input_absinfo\fR. The key is the code (e.g. \fBABS_X\fR)
  285. in decimal format.
  286. .TP 8
  287. .B properties: [0, 1, ...]
  288. Array with all \fBINPUT_PROP_FOO\fR constants. May be an empty array.
  289. .SS udev
  290. .TP 8
  291. .B properties: list of strings
  292. A list of udev properties in \fBkey=value\fR format. This is not the
  293. complete list of properties assigned to the device but a subset that is
  294. relevant to libinput. These properties may include properties set on a
  295. parent device.
  296. .TP 8
  297. .B virtual: bool
  298. \fBtrue\fR if the device is a virtual (non-hardware) device, \fBfalse\fR
  299. otherwise.
  300. .SS quirks
  301. .TP 8
  302. .B quirks: list of strings
  303. A list of device quirks in \fBkey=value\fR format.
  304. .SS events
  305. A list of the recorded events. The list contains dictionaries
  306. Information about the events. The content is a list of dictionaries, with
  307. the string identifying the type of event sequence.
  308. .TP 8
  309. .B { evdev: [ [sec, usec, type, code, value], ...] }
  310. Each \fBevdev\fR dictionary contains the contents of a \fBstruct
  311. input_event\fR in decimal format. The last item in the list is always the
  312. \fBSYN_REPORT\fR of this event frame. The next event frame starts a new
  313. \fBevdev\fR dictionary entry in the parent \fBevents\fR list.
  314. .TP 8
  315. .B { hid: "hidrawX": [ 12, 34, 56 ], ...] }
  316. The \fBhid\fR dictionary contains the hid reports in decimal format, with
  317. the hidraw node as key. The special key \fBtime\fR denotes the current time
  318. when the report was read from the kernel.
  319. .PP
  320. Note that the kernel does not provide timestamps for hidraw events and the
  321. timestamps provided are from \fBclock_gettime(3)\fR. They may be greater
  322. than a subsequent evdev event's timestamp.
  323. .SH NOTES
  324. .PP
  325. This tool records events from the kernel and is independent of libinput. In
  326. other words, updating or otherwise changing libinput will not alter the
  327. output from this tool. libinput itself does not need to be in use to record
  328. events.
  329. .SH LIBINPUT
  330. .PP
  331. Part of the
  332. .B libinput(1)
  333. suite