Change in simtrace2[master]: cardem: add more debug information for TPDU state

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Kévin Redon gerrit-no-reply at lists.osmocom.org
Mon Oct 15 17:55:27 UTC 2018


Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/11361


Change subject: cardem: add more debug information for TPDU state
......................................................................

cardem: add more debug information for TPDU state

this just adds the name of the TPDU state on top of the state number.

Change-Id: Id5104a2c3579dedb092c179748e9ed525673841c
---
M firmware/libcommon/source/card_emu.c
1 file changed, 20 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/61/11361/1

diff --git a/firmware/libcommon/source/card_emu.c b/firmware/libcommon/source/card_emu.c
index 75910c1..9966abd 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -86,6 +86,7 @@
 	PTS_S_WAIT_RESP_PCK = PTS_S_WAIT_REQ_PCK | 0x10,
 };
 
+/* PTS field byte index */
 #define _PTSS	0
 #define _PTS0	1
 #define _PTS1	2
@@ -105,6 +106,22 @@
 	TPDU_S_WAIT_TX,		/* waiting for more data to reader */
 };
 
+const struct value_string tpdu_state_names[] = {
+	OSMO_VALUE_STRING(TPDU_S_WAIT_CLA),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_INS),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_P1),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_P2),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_P3),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_PB),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_RX),
+	OSMO_VALUE_STRING(TPDU_S_WAIT_TX),
+	{
+		.value = 0,
+		.str = NULL,
+	},
+};
+
+/* TPDU field byte index */
 #define	_CLA	0
 #define	_INS	1
 #define	_P1	2
@@ -651,9 +668,9 @@
 	if (ch->tpdu.state == new_ts)
 		return;
 
-	TRACE_DEBUG("%u: 7816 TPDU state %u -> %u\r\n", ch->num,
-		    ch->tpdu.state, new_ts);
-
+	TRACE_DEBUG("%u: 7816 TPDU state %u (%s) -> %u (%s)\r\n", ch->num,
+		ch->tpdu.state, get_value_string(tpdu_state_names, ch->tpdu.state),
+		new_ts, get_value_string(tpdu_state_names, new_ts));
 	ch->tpdu.state = new_ts;
 
 	switch (new_ts) {

-- 
To view, visit https://gerrit.osmocom.org/11361
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5104a2c3579dedb092c179748e9ed525673841c
Gerrit-Change-Number: 11361
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181015/56506d43/attachment.htm>


More information about the gerrit-log mailing list