[mythtv-users] Serial Perl Script - Channel Change Verification

Ethan McDonald emcdonald at ionstorm.com
Mon Feb 2 17:53:43 EST 2004


I currently use a hot-wire, for lack of a better term, version of the
joypad.pl script to control my receiver.
I haven't altered any of the subs but I have removed the command line menu
so I can execute channel changed directly.
I use the joypad script because it is the only script I can get to work with
my Optimus 5100.  :)
 
Here is the original file I used:
<http://www.rgbdream.com/downloads/joypad.txt>
http://www.rgbdream.com/downloads/joypad.txt 
 
I would like to add some features to the set_channel sub  that does the
direct channel to channel change.
I would like for the set_channel sub to do some PRE and POST channel change
checks and balances like so.
 
- First turn on the receiver power - power_on
- Next check the current channel against the channel submitted
   | - if the channels are different then proceed, else exit
 
- Then change the channel like normal
 
- After that check the current channel against the channel submitted
   | - if the channels are different then start over but do not repeat this
step more than once
 
I have tried to do this myself but I have had no success; all my attempts
have run into time outs.
I'm hoping we might have a Perl guru out there that could point me in the
right direction or heck take on this seemingly simple project.
 
-Ethan
 
For more info on changing channels on your Directv receiver with a perl
script.
http://mythtv.no-ip.com/bbs/viewtopic.php?t=1896
<http://mythtv.no-ip.com/bbs/viewtopic.php?t=1896> 
 
Current subs that could be used? -----------------------------
 
sub set_channel {
my( $channel ) = @_;
 $_ = sprintf( "%4.4x", $channel );
( $n1, $n2 ) = /(..)(..)/;
 send_command( "0x46", $n1, $n2, "0x0" );
}
 
sub get_channel {
my @channel_hex = send_command( "0x07" );
 if( scalar(@channel_hex) > 1 ) {
$channel = $channel_hex[0] * 256 + $channel_hex[1];
}
else {
$channel = $channel_hex[0];
}
 print( "Current channel: $channel\n" );
return( $channel );
}

sub power_on { send_command("0x02"); }

----------------------------------------------------------------------------
-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20040202/a989f24c/attachment.html


More information about the mythtv-users mailing list