[mythtv-users] Question regarding LIRC and SENDING Remote commands.

Ronald Frazier ron at ronfrazier.net
Tue Feb 19 14:52:49 UTC 2013


On Tue, Feb 19, 2013 at 12:10 AM, Lee Maisel <maisel at lobo.net> wrote:
> As you know, my wife is blind and some very helpful people here have enabled
> her to use the MythTV system with the addition of text to speech. It has
> been wonderful!
>
> I would like to go the extra step, and create a submenu that calls shell
> scripts to play recordings of IR commands, outputting them from the WMC
> remote I have. This should enable her to control some of the other
> components by menu, such as the CD changer, stereo inputs, etc.
>
> Does anyone know if this is possible, and if so, where do I start?

Well, you wouldn't be sending them from the remote itself. What you
need is a lirc device that can emit IR. Many of the IR receivers also
have a connector (which looks like a headphone jack) in which you can
plug in an IR emitter. You take the emitter (which has a long wire),
plug in one end, and place the other end over the IR recevied of the
device you want to control.

You then program lirc to recognize all of the buttons on that device's
remote (in the same way that you probably configured your primary
remote, unless you used a pre-made configuration). Once you do that,
you can then play them back using the irsend command.

For example, here's the shell script I used several years ago to
control an external DTA to change channels. Note how my script does
locking. This ensures that you can't have 2 scripts trying to send IR
data at the same time, which could be problematic. However, note that
my locking is a bit primitive. There are more robust ways to
accomplish locking (do a google search for flock shell script)

#!/bin/sh

LOCKFILE=/tmp/lirclock
TRANSMITTER_NUMBER=1
REMOTE_NAME=wow_dta_remote
SETUPDELAY=.1
DELAY=.2

cmd="$1"

while [ -f $LOCKFILE ]
do
#echo "Waiting for lock..."
  sleep .1
done

touch $LOCKFILE

irsend SET_TRANSMITTERS $TRANSMITTER_NUMBER

sleep $SETUPDELAY

case $cmd in
    [0-9]*)
    for digit in $(echo $1 | sed -e 's/./& /g'); do
        irsend SEND_ONCE $REMOTE_NAME $digit
        sleep $DELAY
    done
    irsend SEND_ONCE $REMOTE_NAME ENTER
    ;;

    *)
        irsend SEND_ONCE $REMOTE_NAME $cmd
        ;;
esac

rm $LOCKFILE




-- 
Ron Frazier


More information about the mythtv-users mailing list