LinHES Forums
http://forum.linhes.org/

[HOW TO] Serial IRBlaster with USB IR receiver on LinHES R6
http://forum.linhes.org/viewtopic.php?f=11&t=20701
Page 1 of 1

Author:  vabiro [ Mon Dec 21, 2009 2:05 pm ]
Post subject:  [HOW TO] Serial IRBlaster with USB IR receiver on LinHES R6

Hi,

I have spent the past day trying to get my IRBlaster with 4 heads(i.e. Set-top boxes) working, along with my Microsoft Media Center USB remote.

Apparently there is a gap in the configuration that has yet to be resolved as of this writing. There is a ticket in Flyspray, but I thought I would include it here to share with the community, until it is resolved in the LinHES install.

In my case I was connecting 4 ExpressVu satellite receivers to two Hauppauge PVR-500, dual input card. The irblaster was a Buffalo unit from irblaster.info through COM1.

To get things working, I had to do the following:

In /etc/systemconfig I had to make sure that the #IR settings section indicated that HostSerialPort_blasterlirc="ttyS0". So the section should look like
Code:
#IR settings
Remotetype="mceusb"
ReceiverType="Default"
HostLircWait=""
ReceiverSerialport="ttyS0"
HostTransmitproto_1="301"
HostTransmitproto_2="none"
HostTransmitproto_3="none"
HostTransmitproto_4="none"
HostBlasterType="Receiver"
HostSerialPort_blasterlirc="ttyS0"


Because I have multiple receivers, each using separate remote codes, I had to include the remote codes for the 4 receivers. In the interest of simplicity, I included all 16 potential codes for my ExpressVu/Dishnet/EchoStar receiver, which can be found at LIRC's web site.

To include the definitions I used put the following at the end of /etc/lircd.conf:

Code:
include "/usr/MythVantage/templates/transmit/dish_network/lircd.conf"


I then needed a script to change the channels on the receivers. Each receiver/tuner has to have a script. I kept the location of /usr/local/bin/ from my 5.5 installation. I called the files change_channel#.sh where # was the number of the tuner.

Code:
#!/bin/sh
REMOTE_NAME=301
cmd="$1"

case $cmd in
       [0-9]*)
           for digit in $(echo $1 | sed -e 's/./& /g'); do
              irsend --device=/dev/lircd1 SEND_ONCE $REMOTE_NAME $digit
              sleep  0.3
           # If things work OK with sleep 1, try this for faster channel changes:
           # sleep 0.3
       done
           ;;

      *)
              irsend --device=/dev/lircd1 SEND_ONCE $REMOTE_NAME $cmd
                                       ;;
    esac
#    /usr/bin/fix_audio.sh &


The value of "REMOTE_NAME=301" needs to change to the name of the remote/code that is defined in the /usr/MythVantage/templates/transmit/dish_network/lircd.conf file.

For example, if you were using code 1 (the default for the receiver) you would use the value from the "name" field which is "dish1". If it was code 2 you would use the value of "dish2", and so on up to dish16.

At this point, things should be in place for a fairly conventional irblaster implementation, whether using a single or multi-head IR emitter.

Once you have created a change_channel script for each of your tuner/receiver combinations, go into mythtv-setup and map your input connection to your sources. While you're in the input configuration enter the path and file for "External Channel Change Command" (e.g. /usr/local/bin/channel_change1.sh)

We now need to do the modifications that are specific to the LinHES </=6.0.1.0. According to the ticket in Flyspray, there is a problem assigning the setserial value allowing irsend to use /dev/ttyS0. This can be resolved by creating a file called "/etc/runit/lirc.sh" with the following contents:

Code:
#!/bin/bash

exec 2>&1
export TERM=linux

. /etc/rc.conf
. /etc/rc.d/functions

LOG=/tmp/lirc.log

if [ -f $LOG ]
then
    rm -f $LOG
fi

    . /etc/systemconfig
    stat_runit "Starting lirc"

    [ -e /etc/sv/lircd/.runtime ] || mkdir -p /etc/sv/lircd/.runtime


        serial_port=$HostSerialPort_blasterlirc

    if [ -n "$serial_port" ]
    then
        #/dev/ttyS0 (COM1), port 0x3f8, irq 4
        #/dev/ttyS1 (COM2), port 0x2f8, irq 3
       #/dev/ttyS2 (COM3), port 0x3e8, irq 4
       #/dev/ttyS3 (COM4), port 0x2e8, irq 3

        case $serial_port in
        ttyS0)
               FLAGS="io=0x3f8  irq=4"
               ;;
        ttyS1)
               FLAGS="io=0x2f8  irq=3"
               ;;
        ttyS2)
               FLAGS="io=0x3e8  irq=4"
               ;;
        ttyS3)
               FLAGS="io=0x2e8  irq=3"
               ;;
        esac
        /usr/bin/setserial /dev/$serial_port uart none
   sleep 0.5
        /sbin/modprobe lirc_serial $FLAGS
   sleep 0.5
    fi
            CMD="/usr/sbin/lircd -r -d /dev/lirc1 --output=/dev/lircd1 --pidfile=/var/run/lircd1.pid"
       printhl "   Device 1"
            $CMD >>$LOG 2>>$LOG

        LCMD="/usr/sbin/lircd -r -n -d /dev/lirc0 --output /dev/lircd"
            exec $LCMD >>$LOG 2>>$LOG


That did it for me.

The last part with the addition of /etc/runit/lirc.sh may be deprecated in future releases, but the earlier configuration may prove useful.

Cheers,
Victor

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/