Mercurial > pt1.oyama
comparison recpt1/recpt1.c @ 32:6004fe4f37f9
adapted to use of multiple number of pt1:
- now recpt1 supports simultaneous use of two pt1s.
- new device option has been added.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 03 Mar 2009 05:30:25 +0900 |
parents | 97c820e30737 |
children | f25820d90249 |
comparison
equal
deleted
inserted
replaced
31:289794dc265f | 32:6004fe4f37f9 |
---|---|
305 | 305 |
306 void | 306 void |
307 show_usage(char *cmd) | 307 show_usage(char *cmd) |
308 { | 308 { |
309 fprintf(stderr, "\n"); | 309 fprintf(stderr, "\n"); |
310 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] channel recsec destfile\n", cmd); | 310 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel recsec destfile\n", cmd); |
311 fprintf(stderr, "\n"); | 311 fprintf(stderr, "\n"); |
312 fprintf(stderr, "Remarks:\n"); | 312 fprintf(stderr, "Remarks:\n"); |
313 fprintf(stderr, "if recsec is '-', records indefinitely.\n"); | 313 fprintf(stderr, "if recsec is '-', records indefinitely.\n"); |
314 fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); | 314 fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); |
315 fprintf(stderr, "\n"); | 315 fprintf(stderr, "\n"); |
324 fprintf(stderr, " --strip: Strip null stream\n"); | 324 fprintf(stderr, " --strip: Strip null stream\n"); |
325 fprintf(stderr, " --EMM: Instruct EMM operation\n"); | 325 fprintf(stderr, " --EMM: Instruct EMM operation\n"); |
326 fprintf(stderr, "--udp: Turn on udp broadcasting\n"); | 326 fprintf(stderr, "--udp: Turn on udp broadcasting\n"); |
327 fprintf(stderr, " --addr hostname: Hostname or address to connect\n"); | 327 fprintf(stderr, " --addr hostname: Hostname or address to connect\n"); |
328 fprintf(stderr, " --port portnumber: Port number to connect\n"); | 328 fprintf(stderr, " --port portnumber: Port number to connect\n"); |
329 fprintf(stderr, "--device devicefile: Specify devicefile to use\n"); | |
329 fprintf(stderr, "--help: Show this help\n"); | 330 fprintf(stderr, "--help: Show this help\n"); |
330 fprintf(stderr, "\n"); | 331 fprintf(stderr, "\n"); |
331 } | 332 } |
332 void | 333 void |
333 show_channels(void) | 334 show_channels(void) |
534 { "emm", 0, NULL, 'm'}, | 535 { "emm", 0, NULL, 'm'}, |
535 { "EMM", 0, NULL, 'm'}, | 536 { "EMM", 0, NULL, 'm'}, |
536 { "udp", 0, NULL, 'u'}, | 537 { "udp", 0, NULL, 'u'}, |
537 { "addr", 1, NULL, 'a'}, | 538 { "addr", 1, NULL, 'a'}, |
538 { "port", 1, NULL, 'p'}, | 539 { "port", 1, NULL, 'p'}, |
540 { "device", 1, NULL, 'd'}, | |
539 { "help", 0, NULL, 'h'}, | 541 { "help", 0, NULL, 'h'}, |
540 {0, 0, NULL, 0} /* terminate */ | 542 {0, 0, NULL, 0} /* terminate */ |
541 }; | 543 }; |
542 | 544 |
543 int use_b25 = FALSE; | 545 int use_b25 = FALSE; |
545 int fileless = FALSE; | 547 int fileless = FALSE; |
546 int use_stdout = FALSE; | 548 int use_stdout = FALSE; |
547 char *host_to = NULL; | 549 char *host_to = NULL; |
548 int port_to = 1234; | 550 int port_to = 1234; |
549 sock_data *sockdata = NULL; | 551 sock_data *sockdata = NULL; |
550 | 552 char *device = NULL; |
551 while((result = getopt_long(argc, argv, "br:smua:p:h", | 553 |
554 while((result = getopt_long(argc, argv, "br:smua:p:d:h", | |
552 long_options, &option_index)) != -1) { | 555 long_options, &option_index)) != -1) { |
553 switch(result) { | 556 switch(result) { |
554 case 'b': | 557 case 'b': |
555 use_b25 = TRUE; | 558 use_b25 = TRUE; |
556 fprintf(stderr, "using B25...\n"); | 559 fprintf(stderr, "using B25...\n"); |
586 break; | 589 break; |
587 case 'p': | 590 case 'p': |
588 port_to = atoi(optarg); | 591 port_to = atoi(optarg); |
589 fprintf(stderr, "UDP port: %d\n", port_to); | 592 fprintf(stderr, "UDP port: %d\n", port_to); |
590 break; | 593 break; |
594 case 'd': | |
595 device = optarg; | |
596 fprintf(stderr, "using device: %s\n", device); | |
597 break; | |
591 } | 598 } |
592 } | 599 } |
593 | 600 |
594 if(argc - optind < 3) { | 601 if(argc - optind < 3) { |
595 if(argc - optind == 2 && use_udp) { | 602 if(argc - optind == 2 && use_udp) { |
613 | 620 |
614 freq.frequencyno = ptr->set_freq; | 621 freq.frequencyno = ptr->set_freq; |
615 freq.slot = ptr->add_freq; | 622 freq.slot = ptr->add_freq; |
616 | 623 |
617 if(ptr->type == CHTYPE_SATELLITE) { | 624 if(ptr->type == CHTYPE_SATELLITE) { |
618 for(lp = 0; lp < 2; lp++) { | 625 if(device) { |
619 tfd = open(bsdev[lp], O_RDONLY); | 626 tfd = open(device, O_RDONLY); |
620 if(tfd >= 0) { | 627 if(tfd < 0) { |
621 break; | 628 fprintf(stderr, "Cannot open tuner\n"); |
622 } | 629 return 1; |
623 } | 630 } |
624 if(tfd < 0) { | 631 } |
625 fprintf(stderr, "Cannot open tuner\n"); | 632 else { |
626 return 1; | 633 for(lp = 0; lp < NUM_BSDEV; lp++) { |
634 tfd = open(bsdev[lp], O_RDONLY); | |
635 if(tfd >= 0) { | |
636 break; | |
637 } | |
638 } | |
639 if(tfd < 0) { | |
640 fprintf(stderr, "Cannot open tuner\n"); | |
641 return 1; | |
642 } | |
627 } | 643 } |
628 } | 644 } |
629 else { | 645 else { |
630 for(lp = 0; lp < 2; lp++) { | 646 if(device) { |
631 tfd = open(isdb_t_dev[lp], O_RDONLY); | 647 tfd = open(device, O_RDONLY); |
632 if(tfd >= 0) { | 648 if(tfd < 0) { |
633 break; | 649 fprintf(stderr, "Cannot open tuner\n"); |
634 } | 650 return 1; |
635 } | 651 } |
636 if(tfd < 0) { | 652 } |
637 fprintf(stderr, "Cannot open tuner\n"); | 653 else { |
638 return 1; | 654 for(lp = 0; lp < NUM_ISDB_T_DEV; lp++) { |
655 tfd = open(isdb_t_dev[lp], O_RDONLY); | |
656 if(tfd >= 0) { | |
657 break; | |
658 } | |
659 } | |
660 if(tfd < 0) { | |
661 fprintf(stderr, "Cannot open tuner\n"); | |
662 return 1; | |
663 } | |
639 } | 664 } |
640 } | 665 } |
641 | 666 |
642 /* get recsec */ | 667 /* get recsec */ |
643 char *recsecstr = argv[optind + 1]; | 668 char *recsecstr = argv[optind + 1]; |