diff options
author | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:38 -0600 |
---|---|---|
committer | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:38 -0600 |
commit | 4685fc541466afbeefc151bcb64cd054739c048b (patch) | |
tree | d7e0f521bd51897a59dd9c355d74218132da4b75 /ao-tools/lib | |
parent | 1c2a0b6653623b689d68d7349a6b2dce3e20a4a6 (diff) | |
parent | c29275b72438637d46d7a50742882d2736eb176a (diff) |
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Conflicts:
ao-tools/ao-bitbang/Makefile.am
ao-tools/ao-eeprom/Makefile.am
ao-tools/ao-load/Makefile.am
ao-tools/ao-load/ao-load.c
ao-tools/ao-rawload/Makefile.am
Diffstat (limited to 'ao-tools/lib')
-rw-r--r-- | ao-tools/lib/ccdbg-io.c | 19 | ||||
-rw-r--r-- | ao-tools/lib/ccdbg.h | 2 | ||||
-rw-r--r-- | ao-tools/lib/cp-usb-async.c | 1 |
3 files changed, 15 insertions, 7 deletions
diff --git a/ao-tools/lib/ccdbg-io.c b/ao-tools/lib/ccdbg-io.c index 9c6693cd..d3f87274 100644 --- a/ao-tools/lib/ccdbg-io.c +++ b/ao-tools/lib/ccdbg-io.c @@ -22,25 +22,32 @@ #include "cc-bitbang.h" struct ccdbg * -ccdbg_open(void) +ccdbg_open(char *tty) { struct ccdbg *dbg; - char *tty; dbg = calloc(sizeof (struct ccdbg), 1); if (!dbg) { perror("calloc"); return NULL; } - tty = getenv("CCDBG_TTY"); - if (!tty || tty[0] == '/') - dbg->usb = cc_usb_open(tty); - if (!dbg->usb) { + if (!tty) + tty = getenv("ALTOS_TTY"); + if (!tty) + tty="/dev/ttyACM0"; + + if (!strcmp(tty, "BITBANG")) { dbg->bb = cc_bitbang_open(); if (!dbg->bb) { free(dbg); return NULL; } + } else { + dbg->usb = cc_usb_open(tty); + if (!dbg->usb) { + free(dbg); + return NULL; + } } return dbg; } diff --git a/ao-tools/lib/ccdbg.h b/ao-tools/lib/ccdbg.h index 4a2e3b9f..ca596143 100644 --- a/ao-tools/lib/ccdbg.h +++ b/ao-tools/lib/ccdbg.h @@ -258,7 +258,7 @@ ccdbg_hex_image_equal(struct hex_image *a, struct hex_image *b); /* ccdbg-io.c */ struct ccdbg * -ccdbg_open(void); +ccdbg_open(char *tty); void ccdbg_close(struct ccdbg *dbg); diff --git a/ao-tools/lib/cp-usb-async.c b/ao-tools/lib/cp-usb-async.c index 6539394b..3e75b507 100644 --- a/ao-tools/lib/cp-usb-async.c +++ b/ao-tools/lib/cp-usb-async.c @@ -60,6 +60,7 @@ cp_usb_async_open(void) 0x10c4, 0xea60); cp->ack = -1; if (!cp->handle) { + fprintf(stderr, "Cannot find USB device 10c4:ea60\n"); libusb_exit(cp->ctx); free(cp); return NULL; |