6 use Data::Dump qw(dump);
7 use Time::HiRes qw(sleep);
13 my ($code,$name) = split(/\t+/,$_,2);
14 $name2ir->{lc($name)} = $code;
16 warn "# name2ir = ",dump($name2ir);
28 if ( my $data = $name2ir->{$key} ) {
29 my $cmd = qq{mosquitto_pub -h rpi2 -q 2 -t cmnd/ir/IRSend -m '{"protocol": "NEC","bits": 32, "data": $data}'};
30 warn "# [$key] $cmd\n";
33 warn "ERROR: missing mapping for [$key]";
37 ReadMode 4; # Turn off controls keys
41 while (not defined ($key = ReadKey(1))) {
44 print dump($key, $esc), $/;
46 ReadMode 0; # Reset tty mode before exiting
56 if ( $esc && $esc =~ /\e\[([ABCD])/ ) {
57 printf "arrow: %s %s\n", $1, $direction->{$1};
60 } elsif ( $key eq "\e" && $esc eq "\e" ) { # single ESC
64 warn "UNKNOWN esc,key = ",dump($esc, $key);
67 ir('MENU') if $key eq 'm';
68 ir('INFO') if $key eq 'i';
69 ir('on/off') if $key eq 'p';
70 ir('settings') if $key eq 's';
71 ir('OK') if $key eq 'o' || $key eq "\n" || $key eq " ";
73 ir('EXIT') if $key eq "\x7F"; # backspace
75 ir('input') if $key eq 'w';
76 ir('energy') if $key eq 'e';
78 ir('Q.View') if $key eq 'a';
80 ir('guide') if $key eq 'd';
82 ir('HDMI 1') if $key eq 'z';
83 ir('HDMI 2') if $key eq 'x';
84 ir('HDMI 3') if $key eq 'c';
143 0x20DF50AF Audio Language
146 0x20DF5EA1 online manual
147 0x20DF619E Volume to 50
148 0x20DF21DE Volume to 80
149 0x20DFE11E Volume to 100
151 0x20DF708F doze function
152 0x20DFA35C Display off
155 0x20DFB44B Settings of remote
156 0x20DF956A Program guide
163 0x20DFF20D Input info
164 0x20DFB24D Picture mode
165 0x20DF09F6 Recordings
166 0x20DF4AB5 Audio mode
167 0x20DF7B84 Register magic remote
168 0x20DFAE51 directly register magic remote
170 0x20DFCC33 Presentation in shop
171 0x20DFBD42 Start recording
172 0x20DFAD52 LG TV Plus
173 0x20DFDD22 Sports mode
175 0x20DFDF20 Warning: instart
176 0x20DF7F80 Warning: Poweronly
177 0x20DFFF00 Warning: Easy adjust
178 0x20DF5FA0 Warning: instop
179 0x20DF5FA0 Enter Password
180 0x20DF3FC0 Warning: Reset to factory