summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-04-17 10:10:47 -0700
committerKeith Packard <keithp@keithp.com>2009-04-17 10:10:47 -0700
commit26095fc0511ee0d5213f038986032f7c59964cf0 (patch)
tree50db1d8adbf6911bd96651de68cda3b89d21115e
parent543bedde83cbce5145668e72965e02d892187b59 (diff)
Run-time selection between cp2103 and cc1111
-rw-r--r--lib/cc-usb.c4
-rw-r--r--lib/cc-usb.h2
-rw-r--r--lib/ccdbg-io.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/cc-usb.c b/lib/cc-usb.c
index 09b06bb5..9df2e312 100644
--- a/lib/cc-usb.c
+++ b/lib/cc-usb.c
@@ -317,13 +317,11 @@ cc_usb_reset(struct cc_usb *cc)
static struct termios save_termios;
struct cc_usb *
-cc_usb_open(void)
+cc_usb_open(char *tty)
{
struct cc_usb *cc;
- char *tty;
struct termios termios;
- tty = getenv("CCDBG_TTY");
if (!tty)
tty = DEFAULT_TTY;
cc = calloc (sizeof (struct cc_usb), 1);
diff --git a/lib/cc-usb.h b/lib/cc-usb.h
index 2adccb93..d7acfbd2 100644
--- a/lib/cc-usb.h
+++ b/lib/cc-usb.h
@@ -24,7 +24,7 @@
struct cc_usb;
struct cc_usb *
-cc_usb_open(void);
+cc_usb_open(char *tty);
void
cc_usb_close(struct cc_usb *cc);
diff --git a/lib/ccdbg-io.c b/lib/ccdbg-io.c
index acd44f10..9c6693cd 100644
--- a/lib/ccdbg-io.c
+++ b/lib/ccdbg-io.c
@@ -21,18 +21,20 @@
#include "cc-usb.h"
#include "cc-bitbang.h"
-
struct ccdbg *
ccdbg_open(void)
{
struct ccdbg *dbg;
+ char *tty;
dbg = calloc(sizeof (struct ccdbg), 1);
if (!dbg) {
perror("calloc");
return NULL;
}
- dbg->usb = cc_usb_open();
+ tty = getenv("CCDBG_TTY");
+ if (!tty || tty[0] == '/')
+ dbg->usb = cc_usb_open(tty);
if (!dbg->usb) {
dbg->bb = cc_bitbang_open();
if (!dbg->bb) {