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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/16615 ) Change subject: card_emu: Always print state names in string representation ...................................................................... card_emu: Always print state names in string representation Change-Id: I81469e40f3720afdcb47048b45c63d6474887640 --- M firmware/libcommon/source/card_emu.c 1 file changed, 27 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/15/16615/1 diff --git a/firmware/libcommon/source/card_emu.c b/firmware/libcommon/source/card_emu.c index 34fac1b..4c29d41 100644 --- a/firmware/libcommon/source/card_emu.c +++ b/firmware/libcommon/source/card_emu.c @@ -110,6 +110,22 @@ PTS_S_WAIT_RESP_PCK = PTS_S_WAIT_REQ_PCK | 0x10, }; +const struct value_string pts_state_names[] = { + { PTS_S_WAIT_REQ_PTSS, "WAIT_REQ_PTSS" }, + { PTS_S_WAIT_REQ_PTS0, "WAIT_REQ_PTS0" }, + { PTS_S_WAIT_REQ_PTS1, "WAIT_REQ_PTS1" }, + { PTS_S_WAIT_REQ_PTS2, "WAIT_REQ_PTS2" }, + { PTS_S_WAIT_REQ_PTS3, "WAIT_REQ_PTS3" }, + { PTS_S_WAIT_REQ_PCK, "WAIT_REQ_PCK" }, + { PTS_S_WAIT_RESP_PTSS, "WAIT_RESP_PTSS" }, + { PTS_S_WAIT_RESP_PTS0, "WAIT_RESP_PTS0" }, + { PTS_S_WAIT_RESP_PTS1, "WAIT_RESP_PTS1" }, + { PTS_S_WAIT_RESP_PTS2, "WAIT_RESP_PTS2" }, + { PTS_S_WAIT_RESP_PTS3, "WAIT_RESP_PTS3" }, + { PTS_S_WAIT_RESP_PCK, "WAIT_RESP_PCK" }, + { 0, NULL } +}; + /* PTS field byte index */ #define _PTSS 0 #define _PTS0 1 @@ -542,8 +558,9 @@ /* Update the PTS sub-state */ static void set_pts_state(struct card_handle *ch, enum pts_state new_ptss) { - TRACE_DEBUG("%u: 7816 PTS state %u -> %u\r\n", - ch->num, ch->pts.state, new_ptss); + TRACE_DEBUG("%u: 7816 PTS state %s -> %s\r\n", ch->num, + get_value_string(pts_state_names, ch->pts.state), + get_value_string(pts_state_names, new_ptss)); ch->pts.state = new_ptss; } @@ -623,8 +640,8 @@ memcpy(ch->pts.resp, ch->pts.req, sizeof(ch->pts.resp)); break; default: - TRACE_ERROR("%u: process_byte_pts() in invalid state %u\r\n", - ch->num, ch->pts.state); + TRACE_ERROR("%u: process_byte_pts() in invalid PTS state %s\r\n", ch->num, + get_value_string(pts_state_names, ch->pts.state)); break; } /* calculate the next state and set it */ @@ -674,8 +691,8 @@ byte = ch->pts.resp[_PCK]; break; default: - TRACE_ERROR("%u: get_byte_pts() in invalid state %u\r\n", - ch->num, ch->pts.state); + TRACE_ERROR("%u: get_byte_pts() in invalid PTS state %s\r\n", ch->num, + get_value_string(pts_state_names, ch->pts.state)); return 0; } @@ -880,8 +897,8 @@ add_tpdu_byte(ch, byte); break; default: - TRACE_ERROR("%u: process_byte_tpdu() in invalid state %u\r\n", - ch->num, ch->tpdu.state); + TRACE_ERROR("%u: process_byte_tpdu() in invalid TPDU state %s\r\n", ch->num, + get_value_string(tpdu_state_names, ch->tpdu.state)); } /* ensure we stay in TPDU ISO state */ @@ -982,8 +999,8 @@ new_state = process_byte_pts(ch, byte); goto out_silent; default: - TRACE_ERROR("%u: Received UART char in invalid 7816 state " - "%u\r\n", ch->num, ch->state); + TRACE_ERROR("%u: Received UART char in invalid 7816 state %s\r\n", ch->num, + get_value_string(iso7816_3_card_state_names, ch->state)); break; } -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/16615 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I81469e40f3720afdcb47048b45c63d6474887640 Gerrit-Change-Number: 16615 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191216/bb522f04/attachment.htm>