Ticket #1589: d10control.patch
File d10control.patch, 9.9 KB (added by , 18 years ago) |
---|
-
./mythtv-0.19/contrib/channel_changers/d10control-README
old new 2 2 By Josh Wilmes (http://www.hitchhiker.org/dss) 3 3 Based on info from http://www.isd.net/mevenmo/audiovideo.html 4 4 5 Use the box_type "HD300" for LG LSS-3200A/Sony SAT-HD300/Hughes HTL-HD 6 receivers. 7 5 8 Usage: ./d10control.pl command ... 6 9 Commands: 7 box_type RCA|D10-100|D10-200 - select set top box type10 box_type RCA|D10-100|D10-200|HD300 - select set top box type 8 11 delay number - wait for number seconds. Floating point is valid 9 12 key string - send remote key string. See source for supported keys 10 13 last_param - execute last parameter on command line at current location … … 20 23 get_channel - print current channel 21 24 get_datetime - print date and time 22 25 get_signal - print signal strength 26 get_info - print information (HD300 only?) 27 enable_remote - enable remote control (HD300 only?) 28 disable_remote - disable remote control (HD300 only?) 23 29 hide - hide text, will also prevent info button from working 24 30 retries number - set maximum number of retries on error 25 31 set_system_datetime - set PC clock from box. ntp is more accurate -
./mythtv-0.19/contrib/channel_changers/d10control.pl
old new 32 32 # Added many commands and tried to make flexible enough that users won't 33 33 # have to edit this file 34 34 # Added retry on errors since the D10-200 is not reliable 35 # 36 # Modified by Stacey Son <mythdev <at> son ,dot, org> Sept 9, 2005 37 # Added codes for LG LSS-3200A/Sony SAT-HD300/Hughes HTL-HD receivers 38 # Added get_info, enable_remote, and disable_remote (HD300 only) commands 39 # Based on http://www.avsforum.com/avs-vb/showthread.php?p=3000174&&#post3000174 40 # (Use a straight through serial cable like RadioShack 26-117B to connect) 35 41 36 42 37 43 $|=1; … … 40 46 41 47 use FileHandle; 42 48 43 $version = "1. 1";49 $version = "1.2"; 44 50 45 51 # 46 52 # Verbose output, change with verbose and quiet command. … … 93 99 "get_channel" => \&get_channel, 94 100 "get_signal" => \&get_signal, 95 101 "get_datetime" => \&get_datetime, 102 "get_info" => \&get_info, 103 "enable_remote" => \&enable_remote, 104 "disable_remote" => \&disable_remote, 96 105 "set_system_datetime" => \&set_system_datetime, 97 106 "key" => \&key, 98 107 "delay" => \&delay, … … 169 178 # anything they do. 170 179 ); 171 180 181 # Key to keycode map for LG LSS-3200A/Sony SAT-HD300/Hughes HTL-HD 182 %keymap_HD300 = ( 183 # it seems that the HD300 has a limited keymap 184 right => "0x9a", 185 left => "0x9b", 186 up => "0x9c", 187 down => "0x9d", 188 select => "0xc3", 189 enter => "0xc3", # enter/select/info 190 exit => "0xc5", # power on 191 power => "0xd5", # power toggle 192 guide => "0xe5", 193 menu => "0xf7" 194 # Code 0xfa also brings up the menu 195 ); 196 197 172 198 # From box name select correct key codes 173 199 %boxes=("RCA" => \%keymap, 174 200 "D10-100" => \%keymap_200, 175 "D10-200" => \%keymap_200 201 "D10-200" => \%keymap_200, 202 "HD300" => \%keymap_HD300 176 203 ); 177 204 178 205 # From box name select extra bytes needed with key codes 179 206 %keymap_extra=("RCA" => ["0x00", "0x00"], 180 207 "D10-100" => ["0x00", "0x01"], 181 "D10-200" => ["0x00", "0x01"] 208 "D10-200" => ["0x00", "0x01"], 209 "HD300" => ["0x00", "0x00"] 182 210 ); 183 211 184 212 # From box name select extra bytes needed after sending command 185 213 %cmd_extra=("RCA" => undef, 186 214 "D10-100" => undef, 187 "D10-200" => "0x0d" 215 "D10-200" => "0x0d", 216 "HD300" => undef 188 217 ); 189 218 190 219 # From box name select if we should use the channel change command … … 192 221 # change command and the D10-100 firmware 0x101B won't select below 100. 193 222 %chan_change_key=("RCA" => 0, 194 223 "D10-100" => 1, 195 "D10-200" => 1 224 "D10-200" => 1, 225 "HD300" => 0 196 226 ); 197 227 # Override from command line for above 198 228 my $chan_change_key_param; … … 234 264 sub usage { 235 265 print "Usage: $0 command ...\n"; 236 266 print "Commands:\n"; 237 print " box_type RCA|D10-100|D10-200 - select set top box type\n";267 print " box_type RCA|D10-100|D10-200|HD300 - select set top box type\n"; 238 268 print " delay number - wait for number seconds. Floating point is valid \n"; 239 269 print " key string - send remote key string. See source for supported keys\n"; 240 270 print " last_param - execute last parameter on command line at current location\n"; … … 250 280 print " get_channel - print current channel\n"; 251 281 print " get_datetime - print date and time\n"; 252 282 print " get_signal - print signal strength\n"; 283 print " get_info - print information (HD300 only?)\n"; 284 print " enable_remote - enable remote control (HD300 only?)\n"; 285 print " disable_remote - disable remote control (HD300 only?)\n"; 253 286 print " hide - hide text, will also prevent info button from working\n"; 254 287 print " retries number - set maximum number of retries on error\n"; 255 288 print " set_system_datetime - set PC clock from box. ntp is more accurate\n"; … … 266 299 on(); 267 300 change_channel(shift(@ARGV)); 268 301 select(undef, undef, undef, $clear_osd_delay); 269 send_key("exit"); 302 if ($box_type eq "HD300") { 303 # "exit" key doesn't seem clear the OSD on HD300 304 send_key("enter"); 305 } else { 306 send_key("exit"); 307 } 270 308 } 271 309 272 310 sub version { … … 328 366 $verbose = 0; 329 367 } 330 368 331 sub on { 332 simple_command("0x82"); 369 sub off { 370 if ($box_type eq "HD300") { 371 return(command_response("0x81")); 372 } else { 373 return(simple_command("0x81")); 374 } 333 375 } 334 376 335 sub off { 336 simple_command("0x81"); 377 sub on { 378 if ($box_type eq "HD300") { 379 return(command_response("0x82")); 380 } else { 381 return(simple_command("0x82")); 382 } 383 } 384 385 sub get_info { 386 my @in = dss_command(46, "0x83"); 387 return if($#in < 40); 388 389 # The HD300 info packet looks like the following: 390 # [ 0 - 3] Channel Number 391 # [ 4 - 15] Unknown 392 # [16 - 24] Date/Time 393 # [25 - 37] Unknown 394 # [ 38 ] Signal Strength 395 # [39 - 44] Unknown 396 397 # channel number... (offset 0 Len 4) 398 my $sub = $in[2] * 256 + $in[3]; 399 print "channel " , $in[0]*256+$in[1]; 400 print "-$sub" if $sub != 65535; 401 print "\n"; 402 403 # Date/Time... (offset 16 Len 8) 404 $strTime = "$in[16 + 1]/$in[16 + 2] $in[16 + 3]:$in[16 + 4]:$in[16 + 5]"; 405 print("Date $strTime\n"); 406 407 # Signal... (offset 38 len 1) 408 print "signal $in[38 + 0]\n"; 337 409 } 338 410 339 411 sub get_channel { 340 412 my @in = dss_command(4, "0x87"); 341 return if($#in != 3); 413 if ($box_type eq "HD300") { 414 return if($#in != 4); 415 } else { 416 return if($#in != 3); 417 } 342 418 my $sub = $in[2] * 256 + $in[3]; 343 419 print "channel " , $in[0]*256+$in[1]; 344 420 print "-$sub" if $sub != 65535; … … 349 425 my @in = dss_command(1, "0x90"); 350 426 return if($#in != 0); 351 427 print "signal $in[0]\n"; 352 353 428 } 354 429 355 430 sub get_datetime { 356 431 my @in = dss_command(7, "0x91"); 357 return if($#in != 6); 432 if ($box_type eq "HD300") { 433 return if($#in != 8); 434 } else { 435 return if($#in != 7); 436 } 358 437 $strTime = "$in[1]/$in[2] $in[3]:$in[4]:$in[5]"; 359 438 print("Date $strTime\n")# if ($verbose); 360 439 } 361 440 441 362 442 sub set_system_datetime { 363 443 my @in = dss_command(7, "0x91"); 364 444 return if($#in != 6); … … 368 448 `$cmd`; 369 449 } 370 450 451 sub enable_remote { 452 return(command_response("0x93")) if ($box_type eq "HD300"); 453 } 454 455 sub disable_remote { 456 return(command_response("0x94")) if ($box_type eq "HD300"); 457 } 458 459 371 460 sub text { 372 461 my @tmp = unpack("H2" x length($ARGV[0]) ,$ARGV[0]); 373 462 shift @ARGV; … … 375 464 } 376 465 377 466 sub hide { 378 simple_command("0x86"); 467 if ($box_type eq "HD300") { 468 # for some reason the "hide" command doesn't seem to work 469 # the following is a hack that works 470 send_key("enter"); 471 send_key("enter"); 472 } else { 473 return(simple_command("0x86")); 474 } 379 475 } 380 476 381 477 sub simple_command { … … 386 482 } 387 483 } 388 484 485 sub command_response { 486 my @rc = dss_command(1, @_); 487 if (defined(@rc)) { 488 if ($rc[0] != 0) { 489 return(0); 490 } else { 491 return(1); 492 } 493 } else { 494 return(undef); 495 } 496 } 389 497 390 498 sub dss_command { 391 499 my $reply_size = shift(@_); 500 my $command_code = shift(@_); 501 my $rc; 502 392 503 for (my $i = 0; $i < $retry_count; $i++) { 393 sendbytes("0xFA",@_); 394 my $rc = get_reply($reply_size); 504 if ($box_type eq "HD300" && $reply_size == 0) { 505 sendbytes("0xFA", $command_code); 506 $rc = get_reply($reply_size); 507 next if (!defined($rc)); 508 sendbytes(@_); 509 } else { 510 sendbytes("0xFA", $command_code, @_); 511 } 512 $rc = get_reply($reply_size); 395 513 if (defined($rc)) { 396 514 return @{$rc}; 397 515 } … … 492 610 printf("$str(%3.3s) ",$_) if ($verbose); 493 611 push (@ret,$_); 494 612 } 613 614 if ($box_type eq "HD300" && $reply_size == 0) { 615 # HD300 does a simple ack (F0 only) to say it's ready for more 616 $ok=1 if ($str eq "0xF0"); 617 last if ($str eq "0xF0"); 618 } 495 619 496 620 if ($found_start && $reply_size-- <= 0) { 497 621 $ok=1 if ($terminal{$str} > 0); … … 499 623 last if ($last eq "0xFB" && $str eq "0xFB"); 500 624 } 501 625 $found_start = 1 if ($str eq "0xF0"); 626 $found_start = 1 if ($str eq "0xF2" && $box_type eq "HD300"); 502 627 $last=$str; 503 628 } 504 629 print "\n\n" if ($verbose); … … 543 668 $termios->setattr($serial->fileno(),TCSANOW) || die "setattr: $!\n"; 544 669 545 670 return $serial; 546 } 547 No newline at end of file 671 }