summaryrefslogtreecommitdiff
path: root/lib/ccdbg-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ccdbg-io.c')
-rw-r--r--lib/ccdbg-io.c6
1 files changed, 4 insertions, 2 deletions
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) {