projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add --device/-D support to the command line tools and manuals
[fw/altos]
/
ao-tools
/
ao-load
/
ao-load.c
diff --git
a/ao-tools/ao-load/ao-load.c
b/ao-tools/ao-load/ao-load.c
index c27fcbe9c4d191bcb3005f9e7d2964e2eaba3c00..f5466612c20b9a12b4def5c374008ad543b81a36 100644
(file)
--- a/
ao-tools/ao-load/ao-load.c
+++ b/
ao-tools/ao-load/ao-load.c
@@
-22,6
+22,7
@@
#include <unistd.h>
#include <getopt.h>
#include "ccdbg.h"
#include <unistd.h>
#include <getopt.h>
#include "ccdbg.h"
+#include "cc.h"
#define AO_USB_DESC_STRING 3
#define AO_USB_DESC_STRING 3
@@
-91,12
+92,13
@@
rewrite(struct hex_image *image, unsigned addr, char *data, int len)
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
+ { .name = "device", .has_arg = 1, .val = 'D' },
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
{ 0, 0, 0, 0},
};
static void usage(char *program)
{
- fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx serial-number\n", program);
+ fprintf(stderr, "usage: %s [--tty <tty-name>]
[--device <device-name>]
file.ihx serial-number\n", program);
exit(1);
}
exit(1);
}
@@
-122,13
+124,17
@@
main (int argc, char **argv)
unsigned usb_descriptors;
int string_num;
char *tty = NULL;
unsigned usb_descriptors;
int string_num;
char *tty = NULL;
+ char *device = NULL;
int c;
int c;
- while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "T:
D:
", options, NULL)) != -1) {
switch (c) {
case 'T':
tty = optarg;
break;
switch (c) {
case 'T':
tty = optarg;
break;
+ case 'D':
+ device = optarg;
+ break;
default:
usage(argv[0]);
break;
default:
usage(argv[0]);
break;
@@
-219,6
+225,8
@@
main (int argc, char **argv)
if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
usage(argv[0]);
if (!rewrite(image, usb_descriptors + 2 + image->address, serial_ucs2, serial_ucs2_len))
usage(argv[0]);
+ if (!tty)
+ tty = cc_usbdevs_find_by_arg(device, "TIDongle");
dbg = ccdbg_open(tty);
if (!dbg)
exit (1);
dbg = ccdbg_open(tty);
if (!dbg)
exit (1);