diff options
| author | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:59 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2009-08-18 18:09:59 -0600 | 
| commit | 7fcbe76ce82ec5a17cf536afa0d1b9061e225aa9 (patch) | |
| tree | 74a2ed5f7f116f9656c74beb62888050abb071f7 /ao-tools/lib/ccdbg-io.c | |
| parent | 035ba6df17f016953351bc77a98623c165b69909 (diff) | |
| parent | 4685fc541466afbeefc151bcb64cd054739c048b (diff) | |
Merge branch 'master' into debian
Diffstat (limited to 'ao-tools/lib/ccdbg-io.c')
| -rw-r--r-- | ao-tools/lib/ccdbg-io.c | 19 | 
1 files changed, 13 insertions, 6 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;  } | 
