mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
cardem: add state name in trace
this helps reading the output while debugging quite a lot Change-Id: Idf301e09cf14e2412e29dcb252563bc6e4e5c630
This commit is contained in:
@@ -54,6 +54,22 @@ enum iso7816_3_card_state {
|
||||
ISO_S_IN_TPDU, /* inside a TPDU */
|
||||
};
|
||||
|
||||
const struct value_string iso7816_3_card_state_names[] = {
|
||||
OSMO_VALUE_STRING(ISO_S_WAIT_POWER),
|
||||
OSMO_VALUE_STRING(ISO_S_WAIT_CLK),
|
||||
OSMO_VALUE_STRING(ISO_S_WAIT_RST),
|
||||
OSMO_VALUE_STRING(ISO_S_WAIT_ATR),
|
||||
OSMO_VALUE_STRING(ISO_S_IN_ATR),
|
||||
OSMO_VALUE_STRING(ISO_S_IN_PTS),
|
||||
OSMO_VALUE_STRING(ISO_S_WAIT_TPDU),
|
||||
OSMO_VALUE_STRING(ISO_S_IN_TPDU),
|
||||
{
|
||||
.value = 0,
|
||||
.str = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
/* detailed sub-states of ISO_S_IN_PTS */
|
||||
enum pts_state {
|
||||
PTS_S_WAIT_REQ_PTSS,
|
||||
@@ -285,8 +301,9 @@ static void card_set_state(struct card_handle *ch,
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user