*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
#include <stdint.h>
#include <stdarg.h>
#include <getopt.h>
+#include <unistd.h>
#include "cc.h"
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
{ .name = "device", .has_arg = 1, .val = 'D' },
- { .name = "loader", .has_arg = 1, .val = 'l' },
{ .name = "firmware", .has_arg = 1, .val = 'f' },
{ .name = "query", .has_arg = 0, .val = 'q' },
{ .name = "raw", .has_arg = 0, .val = 'r' },
fprintf(stderr,
"usage: %s [--tty <tty-name>]\n"
" [--device <device-name>]\n"
- " [--loader <srec bootloader file>]\n"
" [--firmware <binary firmware file>]\n"
" [--query]\n"
" [--quiet]\n"
exit(1);
}
-int
+static int
skytraq_expect(int fd, uint8_t want, int timeout) {
int c;
return 0;
}
-int
+static int
skytraq_wait_reply(int fd, uint8_t reply, uint8_t *buf, uint8_t reply_len) {
for(;;) {
uint8_t a, b;
- uint8_t cksum_computed, cksum_read;
+ uint8_t cksum_computed;
int len;
switch (skytraq_expect(fd, 0xa0, 10000)) {
case -1:
main(int argc, char **argv)
{
int fd;
- char buf[512];
int ret;
- FILE *input;
- long size;
- unsigned char cksum;
int c;
- char message[1024];
char *tty = NULL;
char *device = NULL;
- char *loader = "srec_115200.bin";
char *file = NULL;
int query = 0;
int raw = 0;
case 'D':
device = optarg;
break;
- case 'l':
- loader = optarg;
- break;
case 'f':
file = optarg;
break;