Mercurial > pt1
diff 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 |
line wrap: on
line diff
--- a/recpt1/recpt1.c Tue Mar 03 05:15:40 2009 +0900 +++ b/recpt1/recpt1.c Tue Mar 03 05:30:25 2009 +0900 @@ -307,7 +307,7 @@ show_usage(char *cmd) { fprintf(stderr, "\n"); - fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] channel recsec destfile\n", cmd); + fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel recsec destfile\n", cmd); fprintf(stderr, "\n"); fprintf(stderr, "Remarks:\n"); fprintf(stderr, "if recsec is '-', records indefinitely.\n"); @@ -326,6 +326,7 @@ fprintf(stderr, "--udp: Turn on udp broadcasting\n"); fprintf(stderr, " --addr hostname: Hostname or address to connect\n"); fprintf(stderr, " --port portnumber: Port number to connect\n"); + fprintf(stderr, "--device devicefile: Specify devicefile to use\n"); fprintf(stderr, "--help: Show this help\n"); fprintf(stderr, "\n"); } @@ -536,6 +537,7 @@ { "udp", 0, NULL, 'u'}, { "addr", 1, NULL, 'a'}, { "port", 1, NULL, 'p'}, + { "device", 1, NULL, 'd'}, { "help", 0, NULL, 'h'}, {0, 0, NULL, 0} /* terminate */ }; @@ -547,8 +549,9 @@ char *host_to = NULL; int port_to = 1234; sock_data *sockdata = NULL; + char *device = NULL; - while((result = getopt_long(argc, argv, "br:smua:p:h", + while((result = getopt_long(argc, argv, "br:smua:p:d:h", long_options, &option_index)) != -1) { switch(result) { case 'b': @@ -588,6 +591,10 @@ port_to = atoi(optarg); fprintf(stderr, "UDP port: %d\n", port_to); break; + case 'd': + device = optarg; + fprintf(stderr, "using device: %s\n", device); + break; } } @@ -615,27 +622,45 @@ freq.slot = ptr->add_freq; if(ptr->type == CHTYPE_SATELLITE) { - for(lp = 0; lp < 2; lp++) { - tfd = open(bsdev[lp], O_RDONLY); - if(tfd >= 0) { - break; + if(device) { + tfd = open(device, O_RDONLY); + if(tfd < 0) { + fprintf(stderr, "Cannot open tuner\n"); + return 1; } } - if(tfd < 0) { - fprintf(stderr, "Cannot open tuner\n"); - return 1; + else { + for(lp = 0; lp < NUM_BSDEV; lp++) { + tfd = open(bsdev[lp], O_RDONLY); + if(tfd >= 0) { + break; + } + } + if(tfd < 0) { + fprintf(stderr, "Cannot open tuner\n"); + return 1; + } } } else { - for(lp = 0; lp < 2; lp++) { - tfd = open(isdb_t_dev[lp], O_RDONLY); - if(tfd >= 0) { - break; + if(device) { + tfd = open(device, O_RDONLY); + if(tfd < 0) { + fprintf(stderr, "Cannot open tuner\n"); + return 1; } } - if(tfd < 0) { - fprintf(stderr, "Cannot open tuner\n"); - return 1; + else { + for(lp = 0; lp < NUM_ISDB_T_DEV; lp++) { + tfd = open(isdb_t_dev[lp], O_RDONLY); + if(tfd >= 0) { + break; + } + } + if(tfd < 0) { + fprintf(stderr, "Cannot open tuner\n"); + return 1; + } } }