Debian Codegraph @

utils/keytable/rc_keymap.5.in

raw
1 .TH "RC_KEYMAP" "5" "Thu Mar 7 2019" "v4l-utils @MAN_PACKAGE_VERSION@" "File Formats"
2 .SH NAME
3 rc_keymap \- toml file describing remote control keymap
4 .SH DESCRIPTION
5 An rc_keymap describes a remote control. It list the protocols used, and the
6 mapping from decoded IR to linux input keycodes. This file is used by
7 ir\-keytable(1) for IR decoding, and by ir-ctl(1) for sending IR.
8 .PP
9 The file format is toml. Since a remote control can use multiple protocols,
10 the top level is an array of protocols. The vast majority of remotes only use
11 one protocol.
12 .PP
13 .SH KEYMAP PROTOCOL ENTRY
14 For each protocol the remote uses, there should be one entry in the top level
15 \fBprotocols\fR array.
16 .SS Name Field
17 Each protocols entry has a \fBname\fR field. The name is not used by
18 ir\-keytable or ir\-ctl, but can be used to give the remote control a more
19 descriptive name than the file name, e.g. the model number.
20 .SS Protocol Field
21 The \fBprotocol\fR field specifies the protocol. This can either be one of the
22 linux kernel decoders, in which case it is \fBnec\fR, \fBrc\-5\fR, \fBrc\-6\fR,
23 \fBjvc\fR, \fBsony\fR, \fBsanyo\fR, \fBrc\-5\-sz\fR, \fBsharp\fR,
24 \fBmce\-kbd\fR, \fBxmp\fR, \fBimon\fR, \fBrc\-mm\fR, \fBother\fR or
25 \fBunknown\fR. If it does not match any of these entries, then it is assumed
26 to be a BPF based decoder. The \fBunknown\fR and \fBother\fR are protocols
27 decoded by specific RC devices where the protocol is either unknown or
28 proprietary, respectively.
29 .PP
30 There are some pre-defined BPF protocol decoders, which are listed below. See
31 .UR https://lwn.net/Articles/759188/
32 .UE
33 for how to write your own.
34 .SS Variant Field
35 The \fBvariant\fR field specifies which variant a particular protocol uses.
36 The \fBsony\fR, \fBrc-5\fR, \fBrc-6\fR protocols have different bit length
37 variants, for example. This field is used by ir\-ctl when sending IR.
38 .PP
39 The following variants are currently defined:
40 .PP
41 Protocol \fBrc-5\fR has variants \fBrc-5\fR, \fBrc-5x-20\fR, \fBrc-5-sz\fR.
42 .PP
43 Protocol \fBnec\fR has variants \fBnec\fR, \fBnec-x\fR, \fBnec-32\fR.
44 .PP
45 Protocol \fBsony\fR has variants \fBsony-12\fR, \fBsony-15\fR, \fBsony-20\fR.
46 .PP
47 Protocol \fBrc\-6\fR has variants \fBrc-6-0\fR, \fBrc-6-6a-20\fR,
48 \fBrc-6-6a-24\fR, \fBrc-6-6a-32\fR, \fBrc-6-mce\fR.
49 .PP
50 Protocol \fBrc\-mm\fR has variants \fBrc-mm-12\fR, \fBrc-mm-24\fR, and
51 \fBrc-mm-32\fR.
52 .SS Scancodes field
53 The \fBscancodes\fR table list the scancodes and the mapping to linux input
54 keycode. Multiple scancodes can map to the same keycode. The scancodes field
55 is not present for \fBraw\fR protocols.
56 .PP
57 If the scancode start with 0x, it is interpreted as a hexadecimal number. If
58 it starts with a 0, it is interpreted as an octal number.
59 .PP
60 Valid keycodes are listed in the \fBinput-event-codes.h\fR header file.
61 Examples are \fBKEY_ENTER\fR, \fBKEY_ESC\fR or \fBBTN_LEFT\fR for the left
62 mouse button. Note that if the keymap is only used for sending IR, then
63 the key does not have to be a valid linux keycode. It can be any string
64 without whitespace.
65 .SS Raw field
66 If the protocol is \fBraw\fR, the \fBraw\fR field is an array of keycode
67 to raw mapping. For each entry, there is a \fBkeycode\fR field and \fBraw\fR
68 field. The \fBkeycode\fR is a linux input keycode, as explained in the
69 scancodes field above.
70 .PP
71 The \fBraw\fR field is an string, which lists pulse and space values,
72 separated by whitespace. The first is a pulse value microseconds, and
73 the second a space, third pulse, etc. The space values can be preceded by
74 a - sign and the pulse value can be preceded by a +sign.
75 There should be an odd number of value so that the last entry is a pulse.
76 .SS Remaining fields (BPF parameters)
77 If the protocol is a BPF based decoder, it may have any number of numeric
78 parameters. These parameters are used to support protocols with non-standard
79 signaling lengths for standard IR protocols. Any other field specified here
80 which is required by the selected BPF decoder will be used. All other fields
81 are ignored.
82
83 Kernel based non-BPF protocol decoders do not have any parameters.
84 .PP
85 .SH BPF PROTOCOLS
86 .PP
87 Some of the BPF protocol decoders are generic and will need parameters to
88 work. Other are for specific remotes and should work without any parameters.
89 The timing parameters are all in microseconds (µs).
90 .SS raw
91 This decoder must be used when the keymap is raw; for each key, there is an
92 entry in raw array with the pulse and space values for that key. No decoding
93 is done, the incoming IR is simply matched against the different pulse and
94 space values.
95 .SS imon_rsc
96 This decoder is specifically for the iMON RSC remote, which was packaged with
97 the iMON Station (amongst others). The decoder is for the directional stick in
98 the middle; it will decode them into mouse movements. The buttons are all
99 encoded using nec-x so the keymap needs two protocols to work correctly.
100
101 This is unrelated to the \fBimon\fR protocol.
102 .TP
103 \fBmargin\fR
104 Define how much tolerance there is for message length. Default 200.
105 .PP
106 .SS grundig
107 This decoder is specifically for old grundig remotes.
108 .TP
109 \fBheader_pulse\fR
110 Length of first pulse, default 900.
111 .TP
112 \fBheader_space\fR
113 Length of following space, default 2900.
114 .TP
115 \fBleader_pulse\fR
116 Length of second pulse, default 1300.
117 .PP
118 .SS xbox
119 This decoder is specifically for the XBox Remote DVD, which is for the first
120 generation XBox.
121 .TP
122 \fBmargin\fR
123 Define how much tolerance there is for message length. Default 200.
124 .SS manchester
125 Most manchester encoded remote controls are either rc\-5, rc\-6, or rc\-mm.
126 Some remote use a different variant (e.g. they might have a header pulse) and
127 that is what the decoder is for. Some parameters must be specified, by default
128 it is set up for rc\-5.
129 .TP
130 \fBmargin\fR
131 Define how much tolerance there is for message length. Default 200.
132 .TP
133 \fBheader_pulse\fR
134 Define how long a leading pulse is. This is not always present. Default 0.
135 .TP
136 \fBheader_space\fR
137 Define how long the space is after the leading pulse. Must be set if
138 \fBheader\_pulse\fR is set.
139 .TP
140 \fBzero\_pulse\fR, \fBzero\_space\fR, \fBone\_pulse\fR, \fBone\_space\fR
141 Signally lengths for bits. See
142 .UR https://clearwater.com.au/code/rc5
143 .UE
144 for these are defined.
145 .TP
146 \fBbits\fR
147 Number of bits. Default 14.
148 .TP
149 \fBscancode\_mask\fR
150 Bits to mask out of resulting scancode.
151 .TP
152 \fBtoggle\_bit\fR
153 Bit that specifies the toggle. If this value is greater than the number of
154 bits, no toggle is defined.
155 .SS pulse\_distance
156 This is a generic decoder for protocols that define bits by distance between
157 pulses, and the pulses are always of the same length. The most well known
158 protocol like this is \fBnec\fR. This decoder is cases where \fBnec\fR is not
159 used. The parameters must be set.
160 .TP
161 \fBmargin\fR
162 Define how much tolerance there is for message length. Default 200.
163 .TP
164 \fBheader_pulse\fR
165 Length of the first leading pulse. Default 2125.
166 .TP
167 \fBheader_space\fR
168 Length of the space after the leading pulse. Default 1875.
169 .TP
170 \fBrepeat_pulse\fR
171 Length of the leading pulse for key repeat. Default 0.
172 .TP
173 \fBrepeat_space\fR
174 Length of the space after the leading pulse for key repeat. Default 0.
175 .TP
176 \fBbit_pulse\fR
177 Length of the pulse for each bit. Default 625.
178 .TP
179 \fBbit_0_space\fR
180 Length of the space for a zero bit. Default 375.
181 .TP
182 \fBbit_1_space\fR
183 Length of the space for a one bit. Default 1625.
184 .TP
185 \fBtrailer_pulse\fR
186 Length of the pulse after the last bit. Needed to bookend the last bit.
187 Default 625.
188 .TP
189 \fBbits\fR
190 Number of bits. Default 4.
191 .TP
192 \fBreverse\fR
193 Should the bits be read in least significant bit first. Set to non-zero to
194 enable. Default 0.
195 .TP
196 \fBheader_optional\fR
197 Some remotes do not send the header pulse and space for key repeats, so set
198 this to non-zero to make the header optional. Default 0.
199
200 An alternative implementation might only allow missing headers for repeat
201 messages, but this would fail to decode key presses if the first message with
202 the header did not decode correctly to due interference.
203 .SS pulse\_length
204 This is a generic decoder for protocols that define bits by length of pulses,
205 and the spaces are always the same. The \fBsony\fR protocol is the most
206 well-known protocol, but this decoder is for protocols which are not
207 \fBsony\fR.
208 .TP
209 \fBmargin\fR
210 Define how much tolerance there is for message length. Default 200.
211 .TP
212 \fBheader_pulse\fR
213 Length of the first leading pulse. Default 2125.
214 .TP
215 \fBheader_space\fR
216 Length of the space after the leading pulse. Default 1875.
217 .TP
218 \fBrepeat_pulse\fR
219 Length of the leading pulse for key repeat. Default 0.
220 .TP
221 \fBrepeat_space\fR
222 Length of the space after the leading pulse for key repeat. Default 0.
223 .TP
224 \fBbit_space\fR
225 Length of the space for each bit. Default 625.
226 .TP
227 \fBbit_0_pulse\fR
228 Length of the pulse for a zero bit. Default 375.
229 .TP
230 \fBbit_1_pulse\fR
231 Length of the pulse for a one bit. Default 1625.
232 .TP
233 \fBtrailer_pulse\fR
234 Length of the pulse after the last bit. Optional. Default 0.
235 .TP
236 \fBbits\fR
237 Number of bits. Default 4.
238 .TP
239 \fBreverse\fR
240 Should the bits be read in least significant bit first. Set to non-zero to
241 enable. Default 0.
242 .TP
243 \fBheader_optional\fR
244 Some remotes do not send the header pulse and space for key repeats, so set
245 this to non-zero to make the header optional. Default 0.
246
247 An alternative implementation might only allow missing headers for repeat
248 messages, but this would fail to decode key presses if only the first message
249 did not decode correctly to due interference.
250 .SH EXAMPLE
251 .EX
252 [[protocols]]
253 name = "iMON Station RSC"
254 protocol = "nec"
255 variant = "necx"
256 [protocols.scancodes]
257 0x801010 = "KEY_EXIT"
258 0x80102f = "KEY_POWER"
259 0x80104a = "KEY_SCREENSAVER"
260 0x801049 = "KEY_TIME"
261 0x801054 = "KEY_NUMERIC_1"
262 0x801055 = "KEY_NUMERIC_2"
263 0x801056 = "KEY_NUMERIC_3"
264 0x801057 = "KEY_NUMERIC_4"
265 0x801058 = "KEY_NUMERIC_5"
266 0x801059 = "KEY_NUMERIC_6"
267 0x80105a = "KEY_NUMERIC_7"
268 0x80105b = "KEY_NUMERIC_8"
269 0x80105c = "KEY_NUMERIC_9"
270 0x801081 = "KEY_SCREEN"
271 0x80105d = "KEY_NUMERIC_0"
272 0x801082 = "KEY_MAX"
273 0x801048 = "KEY_ESC"
274 0x80104b = "KEY_MEDIA"
275 0x801083 = "KEY_MENU"
276 0x801045 = "KEY_APPSELECT"
277 0x801084 = "KEY_STOP"
278 0x801046 = "KEY_CYCLEWINDOWS"
279 0x801085 = "KEY_BACKSPACE"
280 0x801086 = "KEY_KEYBOARD"
281 0x801087 = "KEY_SPACE"
282 0x80101e = "KEY_RESERVED"
283 0x801098 = "BTN_0"
284 0x80101f = "KEY_TAB"
285 0x80101b = "BTN_LEFT"
286 0x80101d = "BTN_RIGHT"
287 0x801016 = "BTN_MIDDLE"
288 0x801088 = "KEY_MUTE"
289 0x80105e = "KEY_VOLUMEDOWN"
290 0x80105f = "KEY_VOLUMEUP"
291 0x80104c = "KEY_PLAY"
292 0x80104d = "KEY_PAUSE"
293 0x80104f = "KEY_EJECTCD"
294 0x801050 = "KEY_PREVIOUS"
295 0x801051 = "KEY_NEXT"
296 0x80104e = "KEY_STOP"
297 0x801052 = "KEY_REWIND"
298 0x801053 = "KEY_FASTFORWARD"
299 0x801089 = "KEY_ZOOM"
300 [[protocols]]
301 protocol = "imon_rsc"
302 .EE
303 .SH BUGS
304 Report bugs to \fBLinux Media Mailing List <[email protected]>\fR
305 .SH COPYRIGHT
306 Copyright (C) 2019 by Sean Young <[email protected]>
307 .PP
308 License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
309 .br
310 This is free software: you are free to change and redistribute it.
311 There is NO WARRANTY, to the extent permitted by law.
312 .SH SEE ALSO
313 ir\-keytable(1) and ir\-ctl(1)
314 .PP
315 https://lwn.net/Articles/759188/
316 .PP
317 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/input-event-codes.h#n64