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


Change subject: cardem: add state name in trace
......................................................................

cardem: add state name in trace

this helps reading the output while debugging quite a lot

Change-Id: Idf301e09cf14e2412e29dcb252563bc6e4e5c630
---
M firmware/libcommon/source/card_emu.c
1 file changed, 43 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/16/10316/1

diff --git a/firmware/libcommon/source/card_emu.c 
b/firmware/libcommon/source/card_emu.c
index 14a5dd8..fac6aef 100644
--- a/firmware/libcommon/source/card_emu.c
+++ b/firmware/libcommon/source/card_emu.c
@@ -54,6 +54,46 @@
        ISO_S_IN_TPDU,          /* inside a TPDU */
 };

+const struct value_string iso7816_3_card_state_names[] = {
+       {
+               .value = ISO_S_WAIT_POWER,
+               .str = "wait power",
+       },
+       {
+               .value = ISO_S_WAIT_CLK,
+               .str = "wait clock",
+       },
+       {
+               .value = ISO_S_WAIT_RST,
+               .str = "wait reset",
+       },
+       {
+               .value = ISO_S_WAIT_ATR,
+               .str = "wait ATR",
+       },
+       {
+               .value = ISO_S_IN_ATR,
+               .str = "in ATR",
+       },
+       {
+               .value = ISO_S_IN_PTS,
+               .str = "in PTS",
+       },
+       {
+               .value = ISO_S_WAIT_TPDU,
+               .str = "wait TPDU",
+       },
+       {
+               .value = ISO_S_IN_TPDU,
+               .str = "in TPDU",
+       },
+       {
+               .value = 0,
+               .str = NULL,
+       },
+};
+
+
 /* detailed sub-states of ISO_S_IN_PTS */
 enum pts_state {
        PTS_S_WAIT_REQ_PTSS,
@@ -285,8 +325,9 @@
        if (ch->state == new_state)
                return;

-       TRACE_DEBUG("%u: 7816 card state %u -> %u\r\n", ch->num,
-                   ch->state, new_state);
+       TRACE_DEBUG("%u: 7816 card state %u (%s) -> %u (%s)\r\n", ch->num,
+                   ch->state, get_value_string(iso7816_3_card_state_names, 
ch->state),
+                   new_state, get_value_string(iso7816_3_card_state_names, 
new_state));
        ch->state = new_state;

        switch (new_state) {

--
To view, visit https://gerrit.osmocom.org/10316
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: Idf301e09cf14e2412e29dcb252563bc6e4e5c630
Gerrit-Change-Number: 10316
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kre...@sysmocom.de>

Reply via email to