Run-time selection between cp2103 and cc1111
[fw/altos] / lib / cc-usb.c
index a85765af120d61aabe0421cc578108f4e98b94ad..9df2e31224554e944c47f33bbb1e82f7632b80af 100644 (file)
@@ -201,7 +201,7 @@ cc_usb_sync(struct cc_usb *cc)
        }
 }
 
-static void
+void
 cc_usb_printf(struct cc_usb *cc, char *format, ...)
 {
        char    buf[1024], *b;
@@ -226,6 +226,7 @@ cc_usb_printf(struct cc_usb *cc, char *format, ...)
                memcpy(cc->out_buf + cc->out_count, b, this_time);
                cc->out_count += this_time;
                ret -= this_time;
+               b += this_time;
                while (cc->out_count >= CC_BUF)
                        cc_usb_sync(cc);
        }
@@ -250,7 +251,7 @@ cc_usb_send_bytes(struct cc_usb *cc, uint8_t *bytes, int len)
        return ret;
 }
 
-static void
+void
 cc_queue_read(struct cc_usb *cc, uint8_t *buf, int len)
 {
        struct cc_read  *read_buf;
@@ -316,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);