{ .name = "tty", .has_arg = 1, .val = 'T' },
{ .name = "device", .has_arg = 1, .val = 'D' },
{ .name = "remote", .has_arg = 1, .val = 'R' },
+ { .name = "channel", .has_arg = 1, .val = 'C' },
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
- fprintf(stderr, "usage: %s [--tty <tty-name>] [--device <device-name>] [-R]\n", program);
+ fprintf(stderr, "usage: %s [--tty <tty-name>] [--device <device-name>] [--remote] [--channel <radio-channel>]\n", program);
exit(1);
}
FILE *out;
char *filename;
int serial_number = 0;
+ int channel = 0;
int flight = 0;
char cmd;
int tick, a, b;
case 'R':
remote = 1;
break;
+ case 'C':
+ channel = atoi(optarg);
+ break;
default:
usage(argv[0]);
break;
if (!cc)
exit(1);
if (remote)
- cc_usb_open_remote(cc);
+ cc_usb_open_remote(cc, channel);
/* send a 'version' command followed by a 'log' command */
cc_usb_printf(cc, "v\n");
out = NULL;
}
void
-cc_usb_open_remote(struct cc_usb *cc)
+cc_usb_open_remote(struct cc_usb *cc, int channel)
{
if (!cc->remote) {
- cc_usb_printf(cc, "\np\nE 0\n");
+ printf ("channel %d\n", channel);
+ cc_usb_printf(cc, "\nc r %d\np\nE 0\n", channel);
do {
cc->in_count = cc->in_pos = 0;
_cc_usb_sync(cc, 100);
cc_usb_printf(struct cc_usb *cc, char *format, ...);
void
-cc_usb_open_remote(struct cc_usb *cc);
+cc_usb_open_remote(struct cc_usb *cc, int channel);
void
cc_usb_close_remote(struct cc_usb *cc);