Command-Line Utilities for CommandIR - Windows and Linux
Record and send IR commands without LIRC
Many CommandIR users just need to control external devices with CommandIR and don't need to use a remote, or already have a working remote. For those users, we've put together these simple utilities to record and send IR codes right from the command line - without requiring LIRC. Perfect for scripting and automating. Download the latest here or see installation instructions below: Overview and How to Use These utils record and replay the raw IR signals, including a wide-range of automatically detected modulation frequencies and duty cycles. In other words, as universal as you can get.
The basic command syntax:
commandir_record button_name1 [button_name2] ... commandir_send [-e emitter_number] [-b emitter_bitmask] button_name1 [button_name2] ... Let's say you want to use CommandIR to: - Change the volume on your Onkyo amplfier
- Power on/off your Onkyo amplifier and LG Television
- Change channels on 2 Scientific Atlanta set-top boxes
So, you'll need to record: - Onkyo: Power, Vol+,Vol-
- LG: Power
- Scientific Atlanta: Digits 0-9, enter
The easiest way is to record them all at once. Recording Since each button will be stored in a seperate file, keep yourself sane by using the device name and button name each time: $ cd ~/ir_codes/
$ commandir_record onkyo_power onkyo_vol+ onkyo_vol- lg_power sa_0 sa_1 sa_2 sa_3 sa_4 sa_5 sa_6 sa_7 \ sa_8 sa_9 sa_enter Running this command will prompt you to press each remote button, and press keyboard 'enter' to accept a recorded IR code for each. Now you'll have a directory full of these IR codes: $ ls
lg_power onkyo_vol- sa_0 sa_2 sa_4 sa_6 sa_8 sa_enter onkyo_power onkyo_vol+ sa_1 sa_3 sa_5 sa_7 sa_9 There are no daemons to reload or restart if you add new or re-record any devices/buttons, changes take effect immediately. Transmitting / Sending
You can test any of them using the commandir_send command, for example to toggle the power on the LG and Onkyo devices: $ commandir_send lg_power onkyo_power To change the channel to 123 on the first Scientific Atlanta box using CommandIR Emitter #1: $ commandir_send -e1 sa_1 sa_2 sa_3 sa_enter To change the channel to 543 on the second Scientific Atlanta box on Emitter #2: $ commandir_send -e2 sa_1 sa_2 sa_3 sa_enter The commandir_send commands can be put in more advanced bash scripts or called directly. Here's a sample bash script (change the ir_codes directory as appropriaate for your system): #!/bin/bash commandir_send -e3 ~/ir_codes/lg_power commandir_send -e4 ~/ir_codes/onkyo_power
Channel Change ScriptMythTV only provides the satellite box channel number to change to, so there is a new channel changing script that converts the MythTV '123' format to commandir_send's sa_1 sa_2 sa_3, and sets the correct emitter. Example: $ commandir-chchange.sh 3 /home/mythtv/ir_codes/sa 123 .1
Installation - LinuxFor the ready to run Windows build, see the CommandIR Utilities on Windows Installation page. Download CommandIR III Utils from the CommandIR Downloads webpage. Installation from source is the standard untar, make, sudo make install: $ tar -xjvf commandir_utils_0.1.tbz $ sudo apt-get install libusb-dev libusb-0.1-4 (may not be required if already installed) The installer adds these files to your system: /usr/local/bin/commandir_record
| The CommandIR recording utility
| /usr/local/bin/commandir_send | The CommandIR code sending utility
| /usr/local/bin/commandir-chchange.sh | A channel-changing script
| /etc/udev/rules.d/99-commandir.rules | udev rule to allow non-root users of CommandIR devices |
FAQQ. When should I use LIRC vs the CommandIR Utils? A. If you want to use the external receiver with the CommandIR III to detect the remote of your choice, you must use LIRC for its advanced decoding functions. If you simply want to control a few devices, the utils will be fine. Q. How do I use the CommandIR Expansion? A. Use 'commandir_set -e' to enable a CommandIR's expanded mode, then it will support all 16 transmit channels instead of only CommandIR's own 4. Q. Is there a Ubuntu package? A. Not yet - we'll build one when the utils go stable.
Q. Can I use LIRC lircd.conf IR codes with these utilities? A. No, the utilities use a more common Hex format. Q. Is there a database of Hex IR codes I can use? A. Not yet, but it's in development. Q. Which CommandIRs are supported? A. Only CommandIR III devices are supported.
|