[mythtv-users] Serial irblaster - how do I get lirc working

Robin Gilks g8ecj at gilks.org
Wed May 16 10:43:47 UTC 2007


> Thank you for your reply.
>
> It seems www.wilsonet.com/mythtv only deals with receiving
> infrared signals, not sending them.  I've googled around and
> managed to:
>
> 1) prevent the kernel from grabbing the serial port (setserial)
> 2) load the lirc_serial module
>
> I'm unsure how to do the next bit:
>
> 3) set up another instance of lircd on Debian?
>
> One instance is started at boot from /etc/init.d/lirc (provided
> by distribution package). Does anybody know of a way to
> configure that script for multiple instances?
>
> If not I'll probably just do it manually - reboots are rare.
>
> What options do you use when running the second instance?
>  Do you have a separate lircd.conf for the second instance?
>
>
> Thank you for your help!
> -david knudsen
>
>

This is the startup script from my Gentoo system - bare in mind that the
start-stop-daemon  command is specific to Gentoo but you can at least see
the lircd commands that are used to associate multiple instances (the /dev
entries for example) and the listen/connect commands. Everything uses a
common lircd.conf file - but you do get to choose which device/interface
to output commands on.

#!/sbin/runscript


start() {
        ebegin "Starting lircd"
        start-stop-daemon --start --pidfile /var/run/lircd1.pid --quiet
--exec /usr/sbin/lircd -- --driver=default --device=/dev/lirc/1
--output=/dev/lircd1 --pidfile=/var/run/lircd1.pid --listen
        start-stop-daemon --start --pidfile /var/run/lircd.pid --quiet
--exec /usr/sbin/lircd -- --driver=default --device=/dev/lirc/0
--output=/dev/lircd --pidfile=/var/run/lircd.pid
--connect=localhost:8765
        eend $?
}

stop() {
        ebegin "Stopping lircd"
        start-stop-daemon --stop --quiet --pidfile /var/run/lircd1.pid
--exec /usr/sbin/lircd -- --pidfile=/var/run/lircd1.pid
        start-stop-daemon --stop --quiet --pidfile /var/run/lircd.pid
--exec /usr/sbin/lircd -- --pidfile=/var/run/lircd.pid
        eend $?
}


When sending to the IR blaster, this is the sort of thing I'm doing to
turn my amp and TV on /off - I use the same interface for channel changes
on an STB (i.e. 3 IR LEDs in series on the one serial port!!).

#!/bin/sh

TV=panasonic_tv_01
AMP=rm-aap013
FILE=/home/mythtv/.power
DEV=/dev/lircd1

DATE=`date +%s`

# Use the presense of a flag file to see if we are powering up or down
if [ -e $FILE  ]
then
LAST=`cat $FILE`
# ignore unless at least 10 seconds has passed  this stops a keybounce
# from turning us off straight after a turn on
if [ $(($LAST + 10)) -lt $DATE ]
then
# power down - just blindly do it
/usr/bin/irsend -d $DEV SEND_ONCE $TV T_power
/usr/bin/sleep 1
# the amp needs the code repeated to get it to work
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_power
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_power
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_power
/bin/rm -f $FILE
fi

else
# power up - select tuner channel One on TV, that turns it on, then AV to
get to AV1
#           meanwhile, power up and select the correct input on the amp
/usr/bin/irsend -d $DEV SEND_ONCE $TV T_one
/usr/bin/sleep 1
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_video2
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_video2
/usr/bin/irsend -d $DEV SEND_ONCE $AMP A_video2
/usr/bin/sleep 4
/usr/bin/irsend -d $DEV SEND_ONCE $TV T_av
echo $DATE > $FILE

fi



-- 
Robin Gilks



More information about the mythtv-users mailing list