summaryrefslogtreecommitdiff
path: root/ao-tools/lib/cc-usb.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-04-27 00:26:11 -0700
committerKeith Packard <keithp@keithp.com>2013-05-07 21:30:26 -0700
commit1695f6af46ea647119d651fc09c97d604d08c736 (patch)
treedae9c78e46ed05332c51833df9a403a93bc7077c /ao-tools/lib/cc-usb.c
parentf6d6df03826083a244715b88a30ad681f17b4510 (diff)
ao-tools/ao-stmload: Add --verbose flag
This dumps out the serial communication so you can see where things go wrong. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib/cc-usb.c')
-rw-r--r--ao-tools/lib/cc-usb.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ao-tools/lib/cc-usb.c b/ao-tools/lib/cc-usb.c
index 485583f9..d7ac138c 100644
--- a/ao-tools/lib/cc-usb.c
+++ b/ao-tools/lib/cc-usb.c
@@ -123,9 +123,10 @@ cc_handle_hex_read(struct cc_usb *cc)
static void
cc_usb_dbg(int indent, uint8_t *bytes, int len)
{
- int eol = 1;
+ static int eol = 1;
int i;
uint8_t c;
+ ccdbg_debug(CC_DEBUG_BITBANG, "<<<%d bytes>>>", len);
while (len--) {
c = *bytes++;
if (eol) {
@@ -135,10 +136,12 @@ cc_usb_dbg(int indent, uint8_t *bytes, int len)
}
switch (c) {
case '\r':
- ccdbg_debug(CC_DEBUG_BITBANG, "^M");
+ ccdbg_debug(CC_DEBUG_BITBANG, "\\r");
break;
case '\n':
eol = 1;
+ ccdbg_debug(CC_DEBUG_BITBANG, "\\n\n");
+ break;
default:
if (c < ' ' || c > '~')
ccdbg_debug(CC_DEBUG_BITBANG, "\\%02x", c);
@@ -193,7 +196,6 @@ _cc_usb_sync(struct cc_usb *cc, int wait_for_input)
ret = read(cc->fd, cc->in_buf + cc->in_count,
CC_IN_BUF - cc->in_count);
if (ret > 0) {
- int i;
cc_usb_dbg(24, cc->in_buf + cc->in_count, ret);
cc->in_count += ret;
if (cc->hex_count)