[mythtv-users] Lirc channel change script for Mythtv when used with Dish Vip612 satellite receiver

Larry on the Dell Laptop larry at foxgulch.com
Tue Sep 23 18:03:32 UTC 2008


Given the price of Diesel fuel,  my RVing days have been greatly 
curtailed.  Therefore for added at-home entertainment,  I just opted for 
an upgraded satellite TV package consisting of two dish Vip612 
receivers.   Naturally, my serial port blaster channel change script 
didn't initially work.   I made two changes to the script.   The entire 
perl script and a description of the changes I made are below.

1.  The old script didn't handle channel numbers with length such as 
6097.  I added the statement that begins with "if (length($channel) > 3) {"

2.  An inactive ViP612 receiver provides an irritating video display 
when it is "powered down".  It brags about "Your HD system...." and 
requires a remote "select" key press to return to watching TV.    I 
therefore added the line
system ("irsend -d /dev/lircd1 SEND_ONCE $remote_name select");
at the beginning of the script.

The script should be located   in /usr/local/bin and named  
channel-change-lirc.pl.   You can test it by watching the output of your 
dish receiver while entering, in a terminal on your mythbox, for example, 
/usr/local/bin/channel-change-lirc.pl  200
A few seconds later, your TV should come up on CNN, dish statellite 
channel 200.   The remote name I used was "dish" (not dish2 or dish1... 
neither of these worked.. and I don't know why.)  because I set  my 
remote dish receiver address is set to "1" (one). (The other ViP612 
receiver's remote is at dish remote address 2 since it doesn't ever 
connect to myth...greater WAF that way!)


Here's the entire script:
----------------------------------------- snip ---------------------------
#!/usr/bin/perl
#
# name the file channel-change-lirc.pl  then place  in  /usr/local/bin, 
remember to  chmod +xr
#
# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
#
$remote_name = "dish";
#  Next two lines added to get rid of advertisement that comes up
#  on Vip612 dish receive when inactive.
system ("irsend -d /dev/lircd1 SEND_ONCE $remote_name select");
sleep 2;

sub change_channel {
        my($channel_digit) = @_;
        system ("irsend -d /dev/lircd1 SEND_ONCE $remote_name 
$channel_digit");
        sleep 1;
}

$channel=$ARGV[0];
sleep 1;
if (length($channel) > 3) {
        change_channel(substr($channel,0,1));
        change_channel(substr($channel,1,1));
        change_channel(substr($channel,2,1));
        change_channel(substr($channel,3,1));
} elsif (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 ("irsend -d /dev/lircd1 SEND_ONCE $remote_name select");


------------------------------------------snip----------------------------


More information about the mythtv-users mailing list