FreeCalypso > hg > freecalypso-sw
changeset 1011:820d34f3f3d7
fc-shell: added ability to receive and dump TCH packets
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 20 Mar 2016 21:10:21 +0000 |
parents | 658fe6f1880f |
children | 93f4fc26b204 |
files | rvinterf/asyncshell/pktsort.c rvinterf/asyncshell/rxctl.c |
diffstat | 2 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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",
--- 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;