Total IR Control for Linux
Home arrow Your Project arrow CommandIR Utils
 
CommandIR Utilities Overview

Basic Scripting

These sort of commandir_send commands can easily be scripted into .bat files on Windows or .sh files on Linux:

Sample Windows .bat file:

 
@echo off
:: power_device.bat
:: Toggle power on all my devices
commandir_send -e1 tv_power
commandir_send -e2 stb_power
commandir_send -e3 receiver_power
commandir_send -e4 dvd_power
 

Use CommandIR Utilities - simple command-line programs - to control devices from your PC via CommandIR in your own projects on a local machine or over a network.  

Record and transmit IR codes, create scripts, and respond to PC events all using CommandIR and our cross-platform Utilities!

 

Basic Use - Recording and Transmitting IR Codes in Files

Note: All commands are identical on Windows and Linux.

First, record any remote control commands you want to use from the PC via CommandIR (or locate the IR codes from an online database):

C:\> commandir_record my_amplifier_volume_up

After recording the Volume Up key for an audio amplifier as 'my_amplifier_volume_up', run

C:\> commandir_send -e2 my_amplifier_volume_up

to transmit it on Emitter #2.  Emitter #2 should be placed over the IR receiver on the amplifier for it to receive the command from CommandIR.  The amplifier will respond as if the original remote button had been pressed. 

The -e parameter is used to set which emitter to transmit on.  All channels will be used if -e is not specified.

The -b parameter can select multiple emitters at once using a bitmask.  See the full commandir_send manual page for details.

 

Basic Use - Using Hex Codes

CommandIR Utils use the same "hex code" format as the Remote Central IR Hex Codes Database.

IR codes are easiest to track and organize when stored in files, but they need not be.  Use commandir_record with the -d display option to only view IR codes as they are detected:

 

support@commandir:~$ commandir_record -d

commandir_record 1.00-pre3

Initiating with 1 CommandIR.

Press buttons on your remote now, and press 'enter' (or Ctrl+C) on the keyboard to quit.

Code at 35.73kHz (gap 90.6 ms): 0000 0074 0018 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020 0CA4
Code at 35.73kHz (gap 90.6 ms): 0000 0074 0018 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020 0CA1
Code at 35.73kHz (gap 90.6 ms): 0000 0074 0018 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020 0CA1
Code at 35.73kHz: 0000 0074 0017 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020
 
Then, any raw codes can be transmitted directly with the commandir_send -r raw mode command:

support@commandir:~$ commandir_send -e1 -r 0000 0074 0017 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020
Initiating with 1 CommandIR.
Transmitting command line args at 35.7kHz
Encoded 23 signals.
OK: Successful transmit

By copy-and-pasting the last code detected by commandir_record, the CommandIR re-transmitted it on Emitter #1 as specified by -e1.
 

Basic Scripting - Sending Control Commands

These sort of commandir_send commands can easily be scripted into .bat files on Windows or .sh files on Linux:

Sample Windows .bat file:

@echo off 
:: power_device.bat 
:: Toggle power on all my devices
commandir_send -e1 tv_power
commandir_send -e2 dvd_power
commandir_send -e3 receiver_power
commandir_send -e4 sat_box_power

 

Sample Linux .sh file:

#!/bin/bash
# volume_up.sh
# Turn up the volume on my external receiver (send twice)
commandir_send -e3 receiver_volume_up receiver_volume_up

 

The commandird daemon shares and coordinates CommandIR activity between multiple programs and clients, and provides networking support. 

Without commandird, a race condition will occur if two or more commandir_send need to happen at the same time - for example, power control and volume - one will claim the CommandIR and succeed, the other will see the CommandIR as 'busy' and fail.

commandird queues up signals and can maintain connections with many clients at once. Commands will never be lost if commandird is used. 

Run commandir with the -v switch for testing, or as a daemon with the -d switch:

support@commandir:~$ commandird -v
CommandIR Added, now using 1 CommandIRs
Initiating with 1 CommandIR.

Now simply add the -n switch to your commandir_send scripts to use the network to send to commandird instead of going directly to the CommandIR:

Sample Windows .bat file:

@echo off :: power_device_for_daemon.bat :: Toggle power on all my devices using commandird
commandir_send -n -e1 tv_power
commandir_send -n -e2 dvd_power
commandir_send -n -e3 receiver_power
commandir_send -n -e4 sat_box_power 
Sample Linux .sh file:
#!/bin/bash 
# volume_up_for_daemon.sh 
# Turn up the volume on my external receiver (send twice) using commandird 
commandir_send -n -e3 receiver_volume_up receiver_volume_up

Networked commandird works by adding the network name:

commandir_send -nOtherComputerName -e1 tv_power

or

commandir_send -n192.168.0.16 -e1 tv_power

The full suite of CommandIR Utilities works in daemon/network mode, including:

commandir_record -n -v

commandir_timing -n

commandir_send -n


Using Multiple CommandIRs

All CommandIR utilities support referencing up to 255 CommandIR devices.  CommandIRs can be referred to in two ways - by emitter number (up to 2048 emitters), or by CommandIR name.

The daemon commandird supports hot plug and unplug of CommandIR devices.
Using Multiple CommandIRs - by Emitter Number

Emitters on your first CommandIR are #1-4, emitters on your second CommandIR become #5-8, and so on.  So, to transmit a signal on the first emitter of two different CommandIRs:

commandir_send -b11 set_top_box_power

To transmit a signal on emitters #1, 2, 7 and 8 (0b1100 0011 = 0xC3):

commandir_send -bC3 set_top_box_power

To transmit a signal on just emitter #6 (CommandIR 2, emitter #2):

commandir_send -e6 set_top_box_power

To transmit a signal on all 16 emitters across 4 CommandIRs over the network using commandird running on 192.168.0.15:

commandir_send -bffff -n192.168.0.15 set_top_box_power 

Using Multiple CommandIRs - by Emitter Number - Persistent Order


The order of CommandIRs (and thus the emitter number map) might change if CommandIRs are removed and readded, or after a reboot.  A persistent order can be set, using the commandir_set command.  This will ensure emitter #5 is always on the same CommandIR.

To save the current order:

commandir_set -p

The CommandIRs will then retain the same order.

 

Using Multiple CommandIRs - by CommandIR name

Each CommandIR can be assigned a 'friendly' text name to be used with commandir_send and commandir_record operations.  Names are first assigned by USB id, then CommandIRs can be renamed.

To view CommandIR properties:

support@commandir:~$ commandir_set -l

Initiating with 1 CommandIR.
CommandIR #1 (On USB 6:2):
 pdata Version: 3
 CommandIR Order: 3
 CommandIR Name:
 CommandIR Group:
 CommandIR Mode: Mini

Then a name can be set:

support@commandir:~$ commandir_set -n Rocky 6 2
Searching for CommandIR at 6:2
hardware_scan_for(6, 2)
Set CommandIR name (in struct) to Rocky

support@commandir:~$ commandir_set -l
Initiating with 1 CommandIR.
CommandIR #1 (On USB 6:2):
 pdata Version: 3
 CommandIR Order: 3
 CommandIR Name: Rocky
 CommandIR Group:
 CommandIR Mode: Mini

Then this particular CommandIR can be referred to in multi-CommandIR systems as 'Rocky':

support@commandir:~$ commandir_send -sRocky -e1 -r 0000 0074 0017 0000 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0020 0021 0020 0020 0040 0020 0020 0041 003F 0041 0020

Initiating with 1 CommandIR.
Transmitting command line args at 35.7kHz
Encoded 23 signals.

 

Specs for 3rd-Party Software Integration

We have a sample TCP program to illustrate how to directly send commands to commandird.  Download it here.

 

 

Last Updated: Thursday, 17 November 2011
 
  



CommandIR Control Technologies is a division of InnovationOne Applied Technology.

(C) 2006-2012, All Rights Reserved. 

Last update: Mon Oct 29 22:23:04 EDT 2012

 

Privacy   Terms of Use