1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | # Created: Matt Shannon |
---|
4 | # Date: 20090831 |
---|
5 | # Email: Matthew dot Shannon at Comcast dot Net |
---|
6 | |
---|
7 | # Custom change-channel-lirc.pl perl script to allow for switching |
---|
8 | # between raw and 'ideal' hex IR codes. Meant to address some issue |
---|
9 | # with iguanaIR(?), lirc 0.8.5, and the Motorola 0 (zero) IR codes not working. |
---|
10 | # Meant to be used with my custom lircd.conf definition file. |
---|
11 | # This combination of change-channel-lirc.pl and lircd.conf is to fix a |
---|
12 | # very specific, and appearently rare issue with lircd, IguanaIR (maybe |
---|
13 | # just USB IR), Motorola codes, and MythTV. I never found the root cause. |
---|
14 | # I just decided to code around it. I hope this helps someone else out on |
---|
15 | # the internets. |
---|
16 | |
---|
17 | $remote_name = "DCT2000"; # var to hold name of ideal remote |
---|
18 | $remote_name_raw = "DCT2000_RAW"; # var to hold name of raw remote |
---|
19 | |
---|
20 | sub change_channel { |
---|
21 | my($channel_digit) = @_; |
---|
22 | |
---|
23 | if ($channel_digit != 0) { |
---|
24 | system ("irsend SEND_ONCE $remote_name $channel_digit"); |
---|
25 | } |
---|
26 | else { |
---|
27 | system ("irsend SEND_ONCE $remote_name_raw $channel_digit"); |
---|
28 | } |
---|
29 | |
---|
30 | sleep 1; |
---|
31 | } |
---|
32 | |
---|
33 | $channel=$ARGV[0]; # set $channel = to parameter passed |
---|
34 | |
---|
35 | |
---|
36 | for ($i = 0; $i <= length($channel); $i++) { # Lets loop the length of the channels |
---|
37 | change_channel(substr($channel,$i,1)); |
---|
38 | } |
---|
39 | |
---|
40 | system ("irsend SEND_ONCE $remote_name OK"); # Polish it off with an OK |
---|
41 | |
---|
42 | #end of line. |
---|