brintos

brintos / linux-shallow public Read only

0
0
Text · 10.0 KiB · 2a888ff Raw
455 lines · plain
1.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later2 3.. _Remote_controllers_Protocols:4 5*****************************************6Remote Controller Protocols and Scancodes7*****************************************8 9IR is encoded as a series of pulses and spaces, using a protocol. These10protocols can encode e.g. an address (which device should respond) and a11command: what it should do. The values for these are not always consistent12across different devices for a given protocol.13 14Therefore out the output of the IR decoder is a scancode; a single u3215value. Using keymap tables this can be mapped to linux key codes.16 17Other things can be encoded too. Some IR protocols encode a toggle bit; this18is to distinguish whether the same button is being held down, or has been19released and pressed again. If has been released and pressed again, the20toggle bit will invert from one IR message to the next.21 22Some remotes have a pointer-type device which can used to control the23mouse; some air conditioning systems can have their target temperature24target set in IR.25 26The following are the protocols the kernel knows about and also lists27how scancodes are encoded for each protocol.28 29rc-5 (RC_PROTO_RC5)30-------------------31 32This IR protocol uses manchester encoding to encode 14 bits. There is a33detailed description here https://www.sbprojects.net/knowledge/ir/rc5.php.34 35The scancode encoding is *not* consistent with the lirc daemon (lircd) rc536protocol, or the manchester BPF decoder.37 38.. flat-table:: rc5 bits scancode mapping39   :widths:       1 1 240 41   * - rc-5 bit42 43     - scancode bit44 45     - description46 47   * - 148 49     - none50 51     - Start bit, always set52 53   * - 154 55     - 6 (inverted)56 57     - 2nd start bit in rc5,  re-used as 6th command bit58 59   * - 160 61     - none62 63     - Toggle bit64 65   * - 566 67     - 8 to 1368 69     - Address70 71   * - 672 73     - 0 to 574 75     - Command76 77There is a variant of rc5 called either rc5x or extended rc578where there the second stop bit is the 6th command bit, but inverted.79This is done so it the scancodes and encoding is compatible with existing80schemes. This bit is stored in bit 6 of the scancode, inverted. This is81done to keep it compatible with plain rc-5 where there are two start bits.82 83rc-5-sz (RC_PROTO_RC5_SZ)84-------------------------85This is much like rc-5 but one bit longer. The scancode is encoded86differently.87 88.. flat-table:: rc-5-sz bits scancode mapping89   :widths:       1 1 290 91   * - rc-5-sz bits92 93     - scancode bit94 95     - description96 97   * - 198 99     - none100 101     - Start bit, always set102 103   * - 1104 105     - 13106 107     - Address bit108 109   * - 1110 111     - none112 113     - Toggle bit114 115   * - 6116 117     - 6 to 11118 119     - Address120 121   * - 6122 123     - 0 to 5124 125     - Command126 127rc-5x-20 (RC_PROTO_RC5X_20)128---------------------------129 130This rc-5 extended to encoded 20 bits. The is a 3555 microseconds space131after the 8th bit.132 133.. flat-table:: rc-5x-20 bits scancode mapping134   :widths:       1 1 2135 136   * - rc-5-sz bits137 138     - scancode bit139 140     - description141 142   * - 1143 144     - none145 146     - Start bit, always set147 148   * - 1149 150     - 14151 152     - Address bit153 154   * - 1155 156     - none157 158     - Toggle bit159 160   * - 5161 162     - 16 to 20163 164     - Address165 166   * - 6167 168     - 8 to 13169 170     - Address171 172   * - 6173 174     - 0 to 5175 176     - Command177 178 179jvc (RC_PROTO_JVC)180------------------181 182The jvc protocol is much like nec, without the inverted values. It is183described here https://www.sbprojects.net/knowledge/ir/jvc.php.184 185The scancode is a 16 bits value, where the address is the lower 8 bits186and the command the higher 8 bits; this is reversed from IR order.187 188sony-12 (RC_PROTO_SONY12)189-------------------------190 191The sony protocol is a pulse-width encoding. There are three variants,192which just differ in number of bits and scancode encoding.193 194.. flat-table:: sony-12 bits scancode mapping195   :widths:       1 1 2196 197   * - sony-12 bits198 199     - scancode bit200 201     - description202 203   * - 5204 205     - 16 to 20206 207     - device208 209   * - 7210 211     - 0 to 6212 213     - function214 215sony-15 (RC_PROTO_SONY15)216-------------------------217 218The sony protocol is a pulse-width encoding. There are three variants,219which just differ in number of bits and scancode encoding.220 221.. flat-table:: sony-12 bits scancode mapping222   :widths:       1 1 2223 224   * - sony-12 bits225 226     - scancode bit227 228     - description229 230   * - 8231 232     - 16 to 23233 234     - device235 236   * - 7237 238     - 0 to 6239 240     - function241 242sony-20 (RC_PROTO_SONY20)243-------------------------244 245The sony protocol is a pulse-width encoding. There are three variants,246which just differ in number of bits and scancode encoding.247 248.. flat-table:: sony-20 bits scancode mapping249   :widths:       1 1 2250 251   * - sony-20 bits252 253     - scancode bit254 255     - description256 257   * - 5258 259     - 16 to 20260 261     - device262 263   * - 7264 265     - 0 to 7266 267     - device268 269   * - 8270 271     - 8 to 15272 273     - extended bits274 275nec (RC_PROTO_NEC)276------------------277 278The nec protocol encodes an 8 bit address and an 8 bit command. It is279described here https://www.sbprojects.net/knowledge/ir/nec.php. Note280that the protocol sends least significant bit first.281 282As a check, the nec protocol sends the address and command twice; the283second time it is inverted. This is done for verification.284 285A plain nec IR message has 16 bits; the high 8 bits are the address286and the low 8 bits are the command.287 288nec-x (RC_PROTO_NECX)289---------------------290 291Extended nec has a 16 bit address and a 8 bit command. This is encoded292as a 24 bit value as you would expect, with the lower 8 bits the command293and the upper 16 bits the address.294 295nec-32 (RC_PROTO_NEC32)296-----------------------297 298nec-32 does not send an inverted address or an inverted command; the299entire message, all 32 bits, are used.300 301For this to be decoded correctly, the second 8 bits must not be the302inverted value of the first, and also the last 8 bits must not be the303inverted value of the third 8 bit value.304 305The scancode has a somewhat unusual encoding.306 307.. flat-table:: nec-32 bits scancode mapping308 309   * - nec-32 bits310 311     - scancode bit312 313   * - First 8 bits314 315     - 16 to 23316 317   * - Second 8 bits318 319     - 24 to 31320 321   * - Third 8 bits322 323     - 0 to 7324 325   * - Fourth 8 bits326 327     - 8 to 15328 329sanyo (RC_PROTO_SANYO)330----------------------331 332The sanyo protocol is like the nec protocol, but with 13 bits address333rather than 8 bits. Both the address and the command are followed by334their inverted versions, but these are not present in the scancodes.335 336Bis 8 to 20 of the scancode is the 13 bits address, and the lower 8337bits are the command.338 339mcir2-kbd (RC_PROTO_MCIR2_KBD)340------------------------------341 342This protocol is generated by the Microsoft MCE keyboard for keyboard343events. Refer to the ir-mce_kbd-decoder.c to see how it is encoded.344 345mcir2-mse (RC_PROTO_MCIR2_MSE)346------------------------------347 348This protocol is generated by the Microsoft MCE keyboard for pointer349events. Refer to the ir-mce_kbd-decoder.c to see how it is encoded.350 351rc-6-0 (RC_PROTO_RC6_0)352-----------------------353 354This is the rc-6 in mode 0. rc-6 is described here355https://www.sbprojects.net/knowledge/ir/rc6.php.356The scancode is the exact 16 bits as in the protocol. There is also a357toggle bit.358 359rc-6-6a-20 (RC_PROTO_RC6_6A_20)360-------------------------------361 362This is the rc-6 in mode 6a, 20 bits. rc-6 is described here363https://www.sbprojects.net/knowledge/ir/rc6.php.364The scancode is the exact 20 bits365as in the protocol. There is also a toggle bit.366 367rc-6-6a-24 (RC_PROTO_RC6_6A_24)368-------------------------------369 370This is the rc-6 in mode 6a, 24 bits. rc-6 is described here371https://www.sbprojects.net/knowledge/ir/rc6.php.372The scancode is the exact 24 bits373as in the protocol. There is also a toggle bit.374 375rc-6-6a-32 (RC_PROTO_RC6_6A_32)376-------------------------------377 378This is the rc-6 in mode 6a, 32 bits. rc-6 is described here379https://www.sbprojects.net/knowledge/ir/rc6.php.380The upper 16 bits are the vendor,381and the lower 16 bits are the vendor-specific bits. This protocol is382for the non-Microsoft MCE variant (vendor != 0x800f).383 384 385rc-6-mce (RC_PROTO_RC6_MCE)386---------------------------387 388This is the rc-6 in mode 6a, 32 bits. The upper 16 bits are the vendor,389and the lower 16 bits are the vendor-specific bits. This protocol is390for the Microsoft MCE variant (vendor = 0x800f). The toggle bit in the391protocol itself is ignored, and the 16th bit should be takes as the toggle392bit.393 394sharp (RC_PROTO_SHARP)395----------------------396 397This is a protocol used by Sharp VCRs, is described here398https://www.sbprojects.net/knowledge/ir/sharp.php. There is a very long399(40ms) space between the normal and inverted values, and some IR receivers400cannot decode this.401 402There is a 5 bit address and a 8 bit command. In the scancode the address is403in bits 8 to 12, and the command in bits 0 to 7.404 405xmp (RC_PROTO_XMP)406------------------407 408This protocol has several versions and only version 1 is supported. Refer409to the decoder (ir-xmp-decoder.c) to see how it is encoded.410 411 412cec (RC_PROTO_CEC)413------------------414 415This is not an IR protocol, this is a protocol over CEC. The CEC416infrastructure uses rc-core for handling CEC commands, so that they417can easily be remapped.418 419imon (RC_PROTO_IMON)420--------------------421 422This protocol is used by Antec Veris/SoundGraph iMON remotes.423 424The protocol425describes both button presses and pointer movements. The protocol encodes42631 bits, and the scancode is simply the 31 bits with the top bit always 0.427 428rc-mm-12 (RC_PROTO_RCMM12)429--------------------------430 431The rc-mm protocol is described here432https://www.sbprojects.net/knowledge/ir/rcmm.php. The scancode is simply433the 12 bits.434 435rc-mm-24 (RC_PROTO_RCMM24)436--------------------------437 438The rc-mm protocol is described here439https://www.sbprojects.net/knowledge/ir/rcmm.php. The scancode is simply440the 24 bits.441 442rc-mm-32 (RC_PROTO_RCMM32)443--------------------------444 445The rc-mm protocol is described here446https://www.sbprojects.net/knowledge/ir/rcmm.php. The scancode is simply447the 32 bits.448 449xbox-dvd (RC_PROTO_XBOX_DVD)450----------------------------451 452This protocol is used by XBox DVD Remote, which was made for the original453XBox. There is no in-kernel decoder or encoder for this protocol. The usb454device decodes the protocol. There is a BPF decoder available in v4l-utils.455