[mythtv] lirc, Motorola DCT2000 and the Actisys IR blaster

Carlos Talbot mythtv-dev@snowman.net
Mon, 4 Nov 2002 11:12:28 -0600 (CST)


FYI,

I just finished configuring Mythtv to use the Actisys IR blaster
( http://store.yahoo.com/snapstreammedia/irblasbun.html ) along with lirc.
Channel changing finally works!

I had to write a short script to parse the multi-digit channel that mythtv
passes to ExternalChannelCommand.

Here's my config:

at the end of /usr/local/share/mythtv/settings.txt I have the following
str ExternalChannelCommand=/usr/local/bin/change_channel

change_channel is a shell script which calls a perl script:
---------------change_channel---------------
#!/bin/sh
echo "changing to $1"
/usr/local/bin/channel.pl $1 &
--------------------------------------------

channel.pl parses the channel argument which is passed to the lirc
command rc:
---------------channel.pl--------------------
#!/usr/bin/perl

$remote_name = "gi-motorola-dct2000";

sub change_channel {
        my($channel_digit) = @_;
        system ("rc SEND_ONCE $remote_name $channel_digit");
        sleep 1;
}

$channel=$ARGV[0];
sleep 1;
if (length($channel) > 2) {
        change_channel(substr($channel,0,1));
        change_channel(substr($channel,1,1));
        change_channel(substr($channel,2,1));
} elsif (length($channel) > 1) {
        change_channel(substr($channel,0,1));
        change_channel(substr($channel,1,1));
} else {
        change_channel(substr($channel,0,1));
}
system ("rc SEND_ONCE $remote_name ENTER");
----------------------------------------------


The gi-motorola-dct2000 is defined in my /etc/lircd.conf file which
was extracted from http://www.lirc.org/remotes.tar.bz2.

If someone has a better way of scripting this please feel free to
contribute any changes. I had to create the initial shell script because a
fork is required. You'll noticed during the ir tranmissions I had to delay
each digit by one second. This is long enough to cause a/v synch issues
with Mythtv. It's better that the script returns right away while the ir
is sent in the background.

Carlos