NAMEir-ctl - a swiss-knife tool to handle raw IR and to set lirc options
ir-ctl [OPTION]... --features
ir-ctl [OPTION]... --send [pulse and space file to send]
ir-ctl [OPTION]... --scancode [protocol and scancode to send]
ir-ctl [OPTION]... --record [save to file]
DESCRIPTIONir-ctl is a tool that allows one to list the features of a lirc device, set its options, record raw IR, send raw IR or send complete IR scancodes.
Note: You need to have read or write permissions on the /dev/lirc device for options to work.
- -d, --device=DEV
- lirc device to control, /dev/lirc0 by default
- -f, --features
- List the features of the lirc device.
- -r, --record=[FILE]
- Record IR and print to standard output if no file is specified, else save to the filename.
- -s, --send=FILE
- Send IR in text file. It must be in the format described below. If this option is specified multiple times, send all files in order with 125ms delay between them.
- -S, --scancode=PROTOCOL:SCANCODE
- Send the IR scancode in the protocol specified. The protocol must one of the protocols listed below, followed by a semicolon and the scancode number.
- -1, --oneshot
- When recording, stop recording after the first message, i.e. after a space or timeout of more than 19ms is received.
- -w, --wideband
- Use the wideband receiver if available on the hardware. This is also known as learning mode. The measurements should be more precise and any carrier frequency should be accepted.
- -n, --no-wideband
- Switches back to the normal, narrowband receiver if the wideband receiver was enabled.
- -R, --carrier-range=RANGE
- Set the accepted carrier range for the narrowband receiver. It should be specified in the form 30000-50000.
- -m, --measure-carrier
- If the hardware supports it, report what the carrier frequency is on recording. You will get the keyword carrier followed by the frequency. This might use the wideband receiver although this is hardware specific.
- -M, --no-measure-carrier
- Disable reporting of the carrier frequency. This should make it possible to use the narrowband receiver. This is the default.
- -p, --timeout-reports
- When the IR receiver times out due to inactivity, a timeout message is reported. When recording you will get the keyword timeout followed by the length of time that no IR was detected for.
- -P, --no-timeout-reports
- When the IR receiver times out due to inactivity, do not report this. This is the default.
- -t, --timeout=TIMEOUT
- Set the length of a space at which the recorder goes idle, specified in microseconds.
- -c, --carrier=CARRIER
- Sets the send carrier frequency.
- -D, --duty-cycle=DUTY
- Set the duty cycle for sending in percent if the hardware support it.
- -e, --emitters=EMITTERS
- Comma separated list of emitters to use for sending. The first emitter is number 1. Some devices only support enabling one emitter (the winbond-cir driver).
- -?, --help
- Prints the help message
- Give a short usage message
- -v, --verbose
- Verbose output; this prints the IR before sending.
- -V, --version
- print the v4l2-utils version
Format of pulse and space fileWhen sending IR, the format of the file should be as follows. A comment start with #. The carrier frequency can be specified as:
The file should contain alternating lines with pulse and space, followed by length in microseconds. The following is a rc-5 encoded message:
Rather than specifying the raw IR, you can also specify the scancode and protocol you want to send. This will also automatically set the correct carrier. The above can be written as:
Do not specify scancodes with different protocols in one file, as the carrier might differ and the transmitter cannot send this. Multiple scancodes can be specified in one file but ensure that the rules for the protocol are met by inserting an appropriate space between them. Also, there are limits to what lirc devices can send in one go.
Supported ProtocolsA scancode with protocol can be specified on the command line or in the pulse and space file. The following protocols are supported: rc5, rc5x_20, rc5_sz, jvc, sony12, sony15, sony20, nec, necx, nec32, sanyo, rc6_0, rc6_6a_20, rc6_6a_24, rc6_6a_32, rc6_mce, sharp. If the scancode starts with 0x it will be interpreted as a hexidecimal number, and if it starts with 0 it will be interpreted as an octal number.
Wideband and narrowband receiverMost IR receivers have a narrowband and wideband receiver. The narrowband receiver can receive over longer distances (usually around 10 metres without interference) and is limited to certain carrier frequencies.
The wideband receiver is for higher precision measurements and when the carrier frequency is unknown; however it only works over very short distances (about 5 centimetres). This is also known as learning mode.
For most drivers, enabling carrier reports using -m also enables the wideband receiver.
Global stateAll the options which can be set for lirc devices are maintained until the device is powered down or a new option is set.
EXIT STATUSOn success, it returns 0. Otherwise, it will return the error code.
EXAMPLESTo list all capabilities of /dev/lirc2:
ir-ctl -f -d /dev/lirc2
To show the IR of the first button press on a remote in learning mode:
ir-ctl -r -m -w
Note that ir-ctl -rmw would record to a file called mw.
To restore the normal (longer distance) receiver:
ir-ctl -n -M
To send the pulse and space file play on emitter 3:
ir-ctl -e 3 --send=play
To send the rc-5 hauppuage '1' scancode:
ir-ctl -S rc5:0x1e01
To restore the IR receiver on /dev/lirc2 to the default state:
ir-ctl -PMn --timeout 125000 --device=/dev/lirc2
BUGSReport bugs to Linux Media Mailing List <email@example.com>
COPYRIGHTCopyright (c) 2016 by Sean Young.
License GPLv2: GNU GPL version 2 <gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.