[mythtv-users] change channel script and irsend errors on FC11

James Neff neffland at gmail.com
Tue Sep 8 12:25:52 UTC 2009


Can someone please post their working (and without any problems)
channel change script?

Below is the one I am using from

http://www.blushingpenguin.com/mark/lmilk/change_channel

This works from the command line and channels change on my DirecTv
STB.  When watching LiveTV the channels do change but in the
mythfrontend log I see a lot of irsend "invalid number of arguments"
errors.  Another symptom, after I change the channel I loose audio and
I see buffer underrun errors.  I'm at work and can't post the log
file.  I think the problem is in the channel changing though.

Fedora 11, Myth 0.21 lirc 0.8.5.

Followed directions here to get my remote working:

http://www.blushingpenguin.com/mark/blog/?p=24

Everything works, receiver and blaster, other than the irsend errors.

Is there a better or different way to change channels?

Thanks in advance.



#!/usr/bin/perl

# make sure to set this string to
# the corresponding remote in /etc/lircd.conf
$remote_name = "blaster";

# Let's assume you don't need to press enter after you punch in a
# channel number. Change this to 1 if your cable box expects you press
# enter after each command
$needs_enter = 0;

# Change this to point to your rc executable
$rc_command = "/usr/local/bin/irsend";

# This subroutine actually sends the signal to the cable box
sub change_SIGNAL {
    my($SIGNAL) = @_;
    system ("$rc_command SEND_ONCE $remote_name $SIGNAL");
}

$SIGNAL=$ARGV[0];
open F, ">> /var/log/channel.log";
print F "channel changing $SIGNAL\n";
close F;
print "channel changing $SIGNAL\n";

# Checks if $SIGNAL begins with a digit
# If it detects that the string is made up of digits, then it puts
# spaces between the digits.  Ex. 1234 becomes 1 2 3 4
if ( $SIGNAL =~ /^\d+$/ )
{
    my $length = length($SIGNAL);
    my $counter = 0;
    my $temp;

    while( $counter < $length )
    {
	$temp .= substr($SIGNAL,$counter,1) ." ";
	$counter++;
    }

    change_SIGNAL($temp);
}
else
{
    # argument we passed was not made up of digits, so it must be a
    # command that does something other than channel changing on the
    # cable box
    change_SIGNAL($SIGNAL);
}

# Do we need to send enter
if ( $needs_enter )
{
    system ("$rc_command SEND_ONCE $remote_name ENTER");
}


More information about the mythtv-users mailing list