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/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/21113 )
Change subject: ccid/7816 fsm: better pps error handling
......................................................................
ccid/7816 fsm: better pps error handling
Change-Id: Id138a600dbe2dd1b8d153b764f73d65e2fd444dd
---
M ccid_common/ccid_slot_fsm.c
M ccid_common/iso7816_fsm.c
M ccid_common/iso7816_fsm.h
3 files changed, 13 insertions(+), 36 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/13/21113/1
diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c
index 5fc74e0..a8c4e54 100644
--- a/ccid_common/ccid_slot_fsm.c
+++ b/ccid_common/ccid_slot_fsm.c
@@ -265,19 +265,12 @@
cs->event = 0;
break;
case ISO7816_E_PPS_UNSUPPORTED_IND:
- tpdu = data;
-
- /* perform deactivation */
- card_uart_ctrl(ss->cuart, CUART_CTL_RST, true);
- card_uart_ctrl(ss->cuart, CUART_CTL_POWER_5V0, false);
- cs->icc_powered = false;
-
- /* failed comand */
- resp = ccid_gen_parameters_t0(cs, ss->seq, CCID_CMD_STATUS_FAILED, 0);
- ccid_slot_send_unbusy(cs, resp);
-
- cs->event = 0;
- break;
+ /* unsupported means no response, failed means request/response mismatch
+ * yet both lead to a deactivation, and the host always gets a fi/di error
+ * 10 "FI - DI pair invalid or not supported" since that part of the
+ * ccid setparameters is handled by the pps exchange
+ */
+ /* fall-through */
case ISO7816_E_PPS_FAILED_IND:
tpdu = data;
@@ -389,7 +382,7 @@
LOGPCS(cs, LOGL_DEBUG, "scheduling PPS transfer, PPS1: %2x\n", PPS1);
/* pass PPS1 instead of msgb */
- osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_XCEIVE_PPS_CMD, PPS1);
+ osmo_fsm_inst_dispatch(ss->fi, ISO7816_E_XCEIVE_PPS_CMD, (void*)PPS1);
/* continues in iso_fsm_clot_user_cb once response/error/timeout is received */
return 0;
}
diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 66250d5..e819e64 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -311,17 +311,6 @@
break;
case ISO7816_E_POWER_UP_IND:
break;
- case ISO7816_E_PPS_UNSUPPORTED_IND:
- case ISO7816_E_PPS_FAILED_IND:
- msg = data;
- /* notify user about PPS result */
- ip->user_cb(fi, event, 0, msg);
- break;
- case ISO7816_E_TPDU_FAILED_IND:
- msg = data;
- /* hand finished TPDU to user */
- ip->user_cb(fi, event, 0, msg);
- break;
default:
OSMO_ASSERT(0);
}
@@ -441,7 +430,7 @@
ip->user_cb(fi, ISO7816_E_ATR_ERR_IND, 0, atp->atr);
if(fi->state == ISO7816_S_WAIT_PPS_RSP || fi->state == ISO7816_S_IN_PPS_RSP)
- ip->user_cb(fi, ISO7816_E_PPS_FAILED_IND, 0, ppp->tx_cmd);
+ ip->user_cb(fi, ISO7816_E_PPS_UNSUPPORTED_IND, 0, ppp->tx_cmd);
if(fi->state == ISO7816_S_WAIT_TPDU || fi->state == ISO7816_S_IN_TPDU)
ip->user_cb(fi, ISO7816_E_TPDU_FAILED_IND, 0, tpdup->tpdu);
@@ -462,7 +451,7 @@
break;
}
if(fi->state == ISO7816_S_WAIT_PPS_RSP || fi->state == ISO7816_S_IN_PPS_RSP)
- ip->user_cb(fi, ISO7816_E_PPS_FAILED_IND, 0, ppp->tx_cmd);
+ ip->user_cb(fi, ISO7816_E_PPS_UNSUPPORTED_IND, 0, ppp->tx_cmd);
if(fi->state == ISO7816_S_WAIT_TPDU || fi->state == ISO7816_S_IN_TPDU)
ip->user_cb(fi, ISO7816_E_TPDU_FAILED_IND, 0, tpdup->tpdu);
@@ -516,7 +505,6 @@
/* notify user about PPS result */
ip->user_cb(fi, event, 0, ppsrsp);
break;
- case ISO7816_E_PPS_UNSUPPORTED_IND:
case ISO7816_E_PPS_FAILED_IND:
case ISO7816_E_RX_ERR_IND:
/* error cases lead to slot reset */
@@ -533,10 +521,7 @@
[ISO7816_S_RESET] = {
.name = "RESET",
.in_event_mask = S(ISO7816_E_RESET_REL_IND) |
- S(ISO7816_E_POWER_UP_IND) |
- S(ISO7816_E_PPS_FAILED_IND)|
- S(ISO7816_E_PPS_UNSUPPORTED_IND)|
- S(ISO7816_E_TPDU_FAILED_IND),
+ S(ISO7816_E_POWER_UP_IND),
.out_state_mask = S(ISO7816_S_WAIT_ATR) |
S(ISO7816_S_RESET),
.action = iso7816_3_reset_action,
@@ -600,8 +585,7 @@
S(ISO7816_E_RX_COMPL) |
S(ISO7816_E_RX_ERR_IND) |
S(ISO7816_E_PPS_DONE_IND) |
- S(ISO7816_E_PPS_FAILED_IND) |
- S(ISO7816_E_PPS_UNSUPPORTED_IND),
+ S(ISO7816_E_PPS_FAILED_IND),
.out_state_mask = S(ISO7816_S_RESET) |
S(ISO7816_S_WAIT_TPDU) |
S(ISO7816_S_IN_PPS_RSP),
diff --git a/ccid_common/iso7816_fsm.h b/ccid_common/iso7816_fsm.h
index fcba87b..fb37396 100644
--- a/ccid_common/iso7816_fsm.h
+++ b/ccid_common/iso7816_fsm.h
@@ -41,8 +41,8 @@
/* TODO: PPS request */
ISO7816_E_XCEIVE_PPS_CMD,
ISO7816_E_PPS_DONE_IND,
- ISO7816_E_PPS_FAILED_IND,
- ISO7816_E_PPS_UNSUPPORTED_IND,
+ ISO7816_E_PPS_FAILED_IND, /*!< card disagrees with parameters, but responds */
+ ISO7816_E_PPS_UNSUPPORTED_IND, /*!< card does not respond to PPS */
/* TODO: Clock stop request */
/* TODO: Rx FIFO overrun */
/* TODO: Rx buffer overrun */
--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/21113
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Id138a600dbe2dd1b8d153b764f73d65e2fd444dd
Gerrit-Change-Number: 21113
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201111/e4c769fb/attachment.htm>