.TH "IR\-CTL" "1" "Tue Jul 5 2016" "v4l-utils "1.26.1"" "User Commands" .SH NAME ir\-ctl \- a swiss\-knife tool to handle raw IR and to set lirc options .SH SYNOPSIS .B ir\-ctl [\fIOPTION\fR]... .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-features\fR .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-send\fR [\fIfile to send\fR] .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-scancode\fR [\fIprotocol and scancode to send\fR] .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-keycode\fR [\fIkeycode to send\fR] .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-receive\fR [\fIsave to file\fR] .SH DESCRIPTION ir\-ctl is a tool that allows one to list the features of a lirc device, set its options, receive raw IR, and send IR. .PP IR can be sent as the keycode of a keymap, or using a scancode, or using raw IR. .PP Note: You need to have read or write permissions on the /dev/lirc device for options to work. .SH OPTIONS .TP \fB\-d\fR, \fB\-\-device\fR=\fIDEV\fR lirc device to control, /dev/lirc0 by default .TP \fB\-f\fR, \fB\-\-features\fR List the features of the lirc device. .TP \fB\-r\fR, \fB\-\-receive\fR[=\fIFILE\fR] Receive IR and print to standard output if no file is specified, else save to the filename. .TP \fB\-s\fR, \fB\-\-send\fR=\fIFILE\fR 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 a 125ms gap between them. The gap length can be modified with \fB\-\-gap\fR. .TP \fB-S\fR, \fB\-\-scancode\fR=\fIPROTOCOL:SCANCODE\fR Send the IR scancode in the protocol specified. The protocol must one of the protocols listed below, followed by a colon and the scancode number. If this option is specified multiple times, send all scancodes in\-order with a 125ms gap between them. The gap length can be modified with \fB\-\-gap\fR. .TP \fB-K\fR, \fB\-\-keycode\fR=\fIKEYCODE\fR Send the \fBKEYCODE\fR from the keymap which must be specified with \fB--keymap\fR. If this option is specified multiple times, send all keycodes in\-order with a 125ms gap between them. The gap length can be modified with \fB\-\-gap\fR. .TP \fB-k\fR, \fB\-\-keymap\fR=\fIKEYMAP\fR The rc keymap file in toml format. The format is described in the rc_keymap(5) man page. This file is used to select the \fBKEYCODE\fR from. .TP \fB\-1\fR, \fB\-\-oneshot\fR When receiving, stop receiving after the first message, i.e. after a space or timeout of more than 19ms is received. .TP \fB\-\-mode2\fR When receiving, output IR in mode2 format. One line per space or pulse. .TP \fB\-w\fR, \fB\-\-wideband\fR 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. .TP \fB\-n\fR, \fB\-\-narrowband\fR Switches back to the normal, narrowband receiver if the wideband receiver was enabled. .TP \fB\-R\fR, \fB\-\-carrier-range\fR=\fIRANGE\fR Set the accepted carrier range for the narrowband receiver. It should be specified in the form \fI30000-50000\fR. .TP \fB\-m\fR, \fB\-\-measure\-carrier\fR If the hardware supports it, report what the carrier frequency is on receiving. You will get the keyword \fIcarrier\fR followed by the frequency. This might use the wideband receiver although this is hardware specific. .TP \fB\-M\fR, \fB\-\-no\-measure\-carrier\fR Disable reporting of the carrier frequency. This should make it possible to use the narrowband receiver. This is the default. .TP \fB\-t\fR, \fB\-\-timeout\fR=\fITIMEOUT\fR Set the length of a space at which the receiver goes idle, specified in microseconds. .TP \fB\-c\fR, \fB\-\-carrier\fR=\fICARRIER\fR Sets the send carrier frequency. .TP \fB\-D\fR, \fB\-\-duty\-cycle\fR=\fIDUTY\fR Set the duty cycle for sending in percent if the hardware support it. .TP \fB\-e\fR, \fB\-\-emitters\fR=\fIEMITTERS\fR 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). .TP \fB\-g\fR, \fB\-\-gap\fR=\fIGAP\fR Set the gap between scancodes or the gap between files when multiple files are specified on the command line. The default is 125000 microseconds. .TP \fB\-?\fR, \fB\-\-help\fR Prints the help message .TP \fB\-\-usage\fR Give a short usage message .TP \fB\-v\fR, \fB\-\-verbose\fR Verbose output; this prints the IR before sending. .TP \fB\-V\fR, \fB\-\-version\fR print the v4l2\-utils version .PP .SS Format of file When sending or receiving raw IR, two formats can be used. The first is a list of integers representing pulse and space values. A pulse value can be prefixed with + and a space with -, but this is optional. The rc-5 scancode 0x1e01 is encoded so: .PP +889 -889 +1778 -1778 +889 -889 +889 -889 +889 -889 +1778 -889 +889 -889 +889 -889 +889 -889 +889 -889 +889 -1778 +889 .PP The other format mimics the mode2 tool. This produces one line per space or pulse. For receiving it can selected by specifying \fB\-\-mode2\fR. Here is the same message as above, now encoded in mode2: .PP carrier 36000 .br pulse 940 .br space 860 .br pulse 1790 .br space 1750 .br pulse 880 .br space 880 .br pulse 900 .br space 890 .br pulse 870 .br space 900 .br pulse 1750 .br space 900 .br pulse 890 .br space 910 .br pulse 840 .br space 920 .br pulse 870 .br space 920 .br pulse 840 .br space 920 .br pulse 870 .br space 1810 .br pulse 840 .PP Note that in this format, the carrier can also be specified. This can only by done with a separate \fB\-\-carrier=38000\fR command line option with the first format. .PP Rather than specifying just the raw IR, in this format 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: .PP scancode rc5:0x1e01 .PP If multiple scancodes are specified in a file, a gap is inserted between scancodes if there is no space between them (see \fB\-\-gap\fR). One file can only have one carrier frequency, so this might cause problems if different protocols are specified in one file if they use different carrier frequencies. .PP Note that there are device-specific limits of how much IR can be sent at a time. This can be both the length of the IR and the number of different lengths of space and pulse. .PP .SS Supported Protocols A scancode with protocol can be specified on the command line or in the pulse and space file. The following protocols are supported: \fBrc5\fR, \fBrc5x_20\fR, \fBrc5_sz\fR, \fBjvc\fR, \fBsony12\fR, \fBsony\fB15\fR, \fBsony20\fR, \fBnec\fR, \fBnecx\fR, \fBnec32\fR, \fBsanyo\fR, \fBrc6_0\fR, \fBrc6_6a_20\fR, \fBrc6_6a_24\fR, \fBrc6_6a_32\fR, \fBrc6_mce\fR, \fBsharp\fR, \fBimon\fR, \fBrc_mm_12\fR, \fBrc_mm_24\fR, \fBrc_mm_32\fR. If the scancode starts with 0x it will be interpreted as a hexadecimal number, and if it starts with 0 it will be interpreted as an octal number. .PP .SS Wideband and narrowband receiver Most 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. .PP 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 \fBlearning mode\fR. .PP For most drivers, enabling \fBcarrier reports\fR using \fB\-m\fR also enables the wideband receiver. .SS Global state All the options which can be set for lirc devices are maintained until the device is powered down or a new option is set. .SH EXIT STATUS On success, it returns 0. Otherwise, it will return the error code. .SH EXAMPLES To list all capabilities of /dev/lirc2: .br \fBir\-ctl \-f \-d /dev/lirc2\fR .PP To show the IR of the first button press on a remote in learning mode: .br \fBir\-ctl \-r \-m \-w\fR .PP Note that \fBir\-ctl \-rmw\fR would receive to a file called \fBmw\fR. .PP To restore the normal (longer distance) receiver: .br \fBir\-ctl \-n \-M\fR .PP To send the pulse and space file \fBplay\fR on emitter 3: .br \fBir\-ctl \-e 3 \-\-send=play\fR .PP To send the rc-5 hauppauge '1' scancode: .br \fBir\-ctl \-S rc5:0x1e01\fR .PP To send the rc-5 hauppauage '1' key from the hauppauge keymap: .br \fBir\-ctl -k hauppauge.toml -K KEY_NUMERIC_1\fR .SH BUGS Report bugs to \fBLinux Media Mailing List \fR .SH COPYRIGHT Copyright (c) 2016 by Sean Young. .PP License GPLv2: GNU GPL version 2 . .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .SH SEE ALSO To display decoded IR, or set IR decoding options, see ir\-keytable(1). The keymap format is described in rc_keymap(5).