projects
/
fw
/
altos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
32654ff
)
ao-tools/lib: Deal with binary USB data in debugging output
author
Keith Packard
<keithp@keithp.com>
Sun, 24 Mar 2013 22:29:32 +0000
(15:29 -0700)
committer
Keith Packard
<keithp@keithp.com>
Sun, 24 Mar 2013 22:29:32 +0000
(15:29 -0700)
Dump non-ascii characters in hex format.
Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/lib/cc-usb.c
patch
|
blob
|
history
diff --git
a/ao-tools/lib/cc-usb.c
b/ao-tools/lib/cc-usb.c
index 9f07e6624d2c849f7469c07cbc80dc018648f383..621a15c1722e01536f6e5506e38ee5a9a424784f 100644
(file)
--- a/
ao-tools/lib/cc-usb.c
+++ b/
ao-tools/lib/cc-usb.c
@@
-140,7
+140,10
@@
cc_usb_dbg(int indent, uint8_t *bytes, int len)
case '\n':
eol = 1;
default:
- ccdbg_debug(CC_DEBUG_BITBANG, "%c", c);
+ if (c < ' ' || c > '~')
+ ccdbg_debug(CC_DEBUG_BITBANG, "\\%02x", c);
+ else
+ ccdbg_debug(CC_DEBUG_BITBANG, "%c", c);
}
}
}
@@
-190,6
+193,7
@@
_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)