FreeCalypso > hg > freecalypso-tools
changeset 162:ce7479d28b02
fc-tmsh: aur response handling implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 17 Mar 2017 08:28:21 +0000 |
parents | da6950e936bf |
children | 568e2a2b49c8 |
files | rvinterf/tmsh/audioresp.c |
diffstat | 1 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/tmsh/audioresp.c Fri Mar 17 08:00:19 2017 +0000 +++ b/rvinterf/tmsh/audioresp.c Fri Mar 17 08:28:21 2017 +0000 @@ -37,7 +37,43 @@ static void aur_response() { - print_etm_pkt_raw("aur response"); + char buf[80], *dp; + unsigned i, j, l, size; + + if (rvi_msg_len < 7) { +tooshort: print_etm_pkt_raw("aur response too short"); + return; + } + if (rvi_msg[3]) { + if (rvi_msg_len == 7) { + sprintf(buf, "aur %u error %u (0x%02X)", rvi_msg[5], + rvi_msg[3], rvi_msg[3]); + async_msg_output(buf); + } else + print_etm_pkt_raw("aur long error response"); + return; + } + if (rvi_msg_len < 8) + goto tooshort; + size = rvi_msg_len - 7; + sprintf(buf, "aur %u: %u byte%s", rvi_msg[5], size, + size != 1 ? "s" : ""); + async_msg_output(buf); + for (i = 0; i < size; ) { + l = size - i; + if (l > 16) + l = 16; + sprintf(buf, "offset %02X:", i); + dp = index(buf, '\0'); + for (j = 0; j < l; j++) { + if (j == 0 || j == 8) + *dp++ = ' '; + sprintf(dp, " %02X", rvi_msg[i + 6]); + i++; + dp += 3; + } + async_msg_output(buf); + } } static void