aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ccid_common/ccid_slot_fsm.c21
-rw-r--r--ccid_common/iso7816_fsm.c24
-rw-r--r--ccid_common/iso7816_fsm.h4
3 files changed, 13 insertions, 36 deletions
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 @@ static int iso_handle_fsm_events(struct ccid_slot *cs, bool enable){
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 @@ static int iso_fsm_slot_set_params(struct ccid_slot *cs, uint8_t seq, enum ccid_
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 @@ static void iso7816_3_reset_action(struct osmo_fsm_inst *fi, uint32_t event, voi
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 @@ static void iso7816_3_allstate_action(struct osmo_fsm_inst *fi, uint32_t event,
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 @@ static void iso7816_3_allstate_action(struct osmo_fsm_inst *fi, uint32_t event,
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 @@ static void iso7816_3_s_ins_pps_rsp_action(struct osmo_fsm_inst *fi, uint32_t ev
/* 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 @@ static const struct osmo_fsm_state iso7816_3_states[] = {
[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 @@ static const struct osmo_fsm_state iso7816_3_states[] = {
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 @@ enum iso7816_3_event {
/* 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 */