X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=ao-tools%2Flib%2Fcc-usb.c;h=d7ac138c6e1210b87c6bae203d76569c23812e26;hb=8959c059ec67f5334e31abbe3f831dd571a0b464;hp=f82752435d03c48126253541e8b5af8d5a653b63;hpb=15bc83a0eaaa9a43d67fdc3e9f412d5b2c1f06dd;p=fw%2Faltos diff --git a/ao-tools/lib/cc-usb.c b/ao-tools/lib/cc-usb.c index f8275243..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,12 +136,17 @@ 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: - 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); } } }