# HG changeset patch # User Mychaela Falconia # Date 1458508221 0 # Node ID 820d34f3f3d7d361551244e8a445111d1bf40922 # Parent 658fe6f1880fae822581a72e83c7f4bd3c63f146 fc-shell: added ability to receive and dump TCH packets diff -r 658fe6f1880f -r 820d34f3f3d7 rvinterf/asyncshell/pktsort.c --- a/rvinterf/asyncshell/pktsort.c Sun Mar 20 20:35:17 2016 +0000 +++ b/rvinterf/asyncshell/pktsort.c Sun Mar 20 21:10:21 2016 +0000 @@ -39,7 +39,7 @@ } } -void +static void gpf_packet_rx() { char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ @@ -48,7 +48,7 @@ async_msg_output(fmtbuf); } -void +static void response_from_ati() { char buf[MAX_PKT_FROM_TARGET*4+2]; @@ -58,6 +58,24 @@ async_msg_output(buf); } +static void +dump_tch() +{ + char buf[MAX_PKT_FROM_TARGET*3+5], *dp; + u_char *cp, *endp; + + cp = rvi_msg + 2; + endp = rvi_msg + rvi_msg_len; + strcpy(buf, "TCH:"); + dp = buf + 4; + while (cp < endp) { + sprintf(dp, " %02X", *cp++); + dp += 3; + } + *dp = '\0'; + async_msg_output(buf); +} + void process_pkt_from_target() { @@ -71,6 +89,9 @@ case RVT_AT_HEADER: response_from_ati(); return; + case RVT_TCH_HEADER: + dump_tch(); + return; default: tty_cleanup(); fprintf(stderr, "unexpected fwd of MUX %02X from rvinterf\n", diff -r 658fe6f1880f -r 820d34f3f3d7 rvinterf/asyncshell/rxctl.c --- a/rvinterf/asyncshell/rxctl.c Sun Mar 20 20:35:17 2016 +0000 +++ b/rvinterf/asyncshell/rxctl.c Sun Mar 20 21:10:21 2016 +0000 @@ -45,6 +45,17 @@ } void +tch_rx_control(newstate) +{ + static int state = 0; + + if (state == newstate) + return; + send_rxctl_cmd(RVT_TCH_HEADER, newstate); + state = newstate; +} + +void rxctl_user_cmd(args, enable) char *args; { @@ -67,6 +78,8 @@ ati_rx_control(enable); else if (!strcmp(np, "gpf")) gpf_rx_control(enable); + else if (!strcmp(np, "tch")) + tch_rx_control(enable); else { printf("error: unknown channel \"%s\"\n", np); return;