[mythtv-users] channel changer script too slow?

Richard Woelk richardwoelk at yahoo.ca
Sat Apr 21 04:44:27 UTC 2007



Kurt Yoder wrote:
> Hi list
>
> Has anyone ever encountered a channel changing script that is  
> sometimes too slow?
>
> I have a Verizon set top box and an IR blaster off a Hauppauge 150.  
> Occasionally the channel changer will change too slowly on a 3-digit  
> channel and I will end up on the wrong channel number. For instance  
> if the channel is 485 I will see the channel change first to 48, then  
> to 5. I suppose there are two possible approaches: make the STB wait  
> longer before changing channels, or make the channel changer script  
> send its keys more quickly. Has anyone else managed to do either one  
> of these?
>
> Thanks
>
> --
>
> Kurt Yoder
> http://yoderhome.com
>
>   

Kurt,
    The default channel change script has a delay of 1 second between 
key presses. I tried 0 seconds but that was too fast.
so I modified the script to use hires timers, which allows me to set a 
delay between 0 and 1 seconds.
This script is for my home made serial IR blaster using LIRC, and I run 
fedora Core 6
I used CPAN to get Time::HiRes for perl, as I couldn't find a new enough 
RPM.

Hope it helps
- Richard

#!/usr/bin/perl
#/usr/local/bin/channel.pl

#hires allows finer timing resolution on the sleep command
use Time::HiRes;

# make sure to set this string to
# the corresponding remote in /etc/lircd.conf

$remote_name = "starchoice";
$delay= "0.4";

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

$channel=$ARGV[0];
if (length($channel) > 2) {
        change_channel(substr($channel,0,1));
        Time::HiRes::sleep($delay);
        change_channel(substr($channel,1,1));
        Time::HiRes::sleep($delay);
        change_channel(substr($channel,2,1));
} elsif (length($channel) > 1) {
        change_channel(substr($channel,0,1));
        Time::HiRes::sleep($delay);
        change_channel(substr($channel,1,1));
} else {
        change_channel(substr($channel,0,1));
}


#uncomment these if your set-top box needs an enter at the end

#Time::HiRes::sleep($delay);
#system ("irsend SEND_ONCE $remote_name ENTER");




More information about the mythtv-users mailing list