changeset 133:4aa1c18c7a2f

fc-tmsh: RF_ENABLE response handled intelligently
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 19 Feb 2017 21:33:58 +0000
parents 5380872923a6
children 4c78649101f1
files rvinterf/tmsh/etmbasic.c rvinterf/tmsh/l1resp.c
diffstat 2 files changed, 25 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/etmbasic.c	Sun Feb 19 20:53:41 2017 +0000
+++ b/rvinterf/tmsh/etmbasic.c	Sun Feb 19 21:33:58 2017 +0000
@@ -70,13 +70,9 @@
 		return;
 	/* L1TM */
 	case TM_INIT:
-		if (rvi_msg_len < 5)
-			goto runt;
 		l1tm_response_nodata("tminit");
 		return;
 	case TM_MODE_SET:
-		if (rvi_msg_len < 5)
-			goto runt;
 		l1tm_response_nodata("tms");
 		return;
 	case VERSION_GET:
@@ -85,7 +81,7 @@
 		l1tm_response_index_val("tm3ver");
 		return;
 	case RF_ENABLE:
-		print_etm_pkt_raw("RF_ENABLE response");
+		l1tm_rfe_response();
 		return;
 	case STATS_READ:
 		print_etm_pkt_raw("STATS_READ response");
--- a/rvinterf/tmsh/l1resp.c	Sun Feb 19 20:53:41 2017 +0000
+++ b/rvinterf/tmsh/l1resp.c	Sun Feb 19 21:33:58 2017 +0000
@@ -14,7 +14,7 @@
 {
 	char buf[80];
 
-	if (rvi_msg_len > 5) {
+	if (rvi_msg_len != 5) {
 		sprintf(buf, "%s response wrong length", op);
 		print_etm_pkt_raw(buf);
 		return;
@@ -80,3 +80,26 @@
 		rvi_msg[4], rvi_msg[4], val, val);
 	async_msg_output(buf);
 }
+
+void
+l1tm_rfe_response()
+{
+	char buf[80];
+
+	if (rvi_msg_len < 5 || rvi_msg_len > 6) {
+		print_etm_pkt_raw("RF_ENABLE response wrong length");
+		return;
+	}
+	switch (rvi_msg[3]) {
+	case 0:
+		async_msg_output("rfe OK");
+		return;
+	case 1:
+		async_msg_output("RF operation finished");
+		return;
+	default:
+		sprintf(buf, "rfe error %u (0x%x)", rvi_msg[3], rvi_msg[3]);
+		async_msg_output(buf);
+		return;
+	}
+}