X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Fao-dumplog%2Fao-dumplog.c;fp=ao-tools%2Fao-dumplog%2Fao-dumplog.c;h=4bfb7e51857fb1d5355678af4593c4dc35da55c2;hp=158a445b48978eab213c8c3ec0cdd282aea2baef;hb=27ebaf8e13aed06bb1ea6e770f767495a02be6c5;hpb=1de322b960005c9a16051afa1881fadb00f4bcd6 diff --git a/ao-tools/ao-dumplog/ao-dumplog.c b/ao-tools/ao-dumplog/ao-dumplog.c index 158a445b..4bfb7e51 100644 --- a/ao-tools/ao-dumplog/ao-dumplog.c +++ b/ao-tools/ao-dumplog/ao-dumplog.c @@ -28,12 +28,13 @@ static const struct option options[] = { { .name = "tty", .has_arg = 1, .val = 'T' }, { .name = "device", .has_arg = 1, .val = 'D' }, + { .name = "remote", .has_arg = 1, .val = 'R' }, { 0, 0, 0, 0}, }; static void usage(char *program) { - fprintf(stderr, "usage: %s [--tty ] [--device \n", program); + fprintf(stderr, "usage: %s [--tty ] [--device ] [-R]\n", program); exit(1); } @@ -80,8 +81,9 @@ main (int argc, char **argv) int data[8]; int done; int column; + int remote = 0; - while ((c = getopt_long(argc, argv, "T:D:", options, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "T:D:R", options, NULL)) != -1) { switch (c) { case 'T': tty = optarg; @@ -89,13 +91,20 @@ main (int argc, char **argv) case 'D': device = optarg; break; + case 'R': + remote = 1; + break; default: usage(argv[0]); break; } } - if (!tty) - tty = cc_usbdevs_find_by_arg(device, "TeleMetrum"); + if (!tty) { + if (remote) + tty = cc_usbdevs_find_by_arg(device, "TeleDongle"); + else + tty = cc_usbdevs_find_by_arg(device, "TeleMetrum"); + } if (!tty) tty = getenv("ALTOS_TTY"); if (!tty) @@ -103,6 +112,8 @@ main (int argc, char **argv) cc = cc_usb_open(tty); if (!cc) exit(1); + if (remote) + cc_usb_open_remote(cc); /* send a 'version' command followed by a 'log' command */ cc_usb_printf(cc, "v\n"); out = NULL;