Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/42781?usp=email )
Change subject: 7816fsm: state_chg before card_uart_tx in tpdu_s_procedure_action ......................................................................
7816fsm: state_chg before card_uart_tx in tpdu_s_procedure_action
State change must precede the TX to ensure we don't lose TX_COMPLETE notifications that arrive at a bad time.
Change-Id: Id66f836452674209e25dc3ee4c37d616de30001b --- M ccid_common/iso7816_fsm.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/81/42781/1
diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c index 407c1fb..9899e16 100644 --- a/ccid_common/iso7816_fsm.c +++ b/ccid_common/iso7816_fsm.c @@ -1371,8 +1371,8 @@ delay_us(1); gpio_set_pin_level(PIN_PB12, false); #endif - card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), msgb_l2len(tfp->tpdu), true); osmo_fsm_inst_state_chg(fi, TPDU_S_TX_REMAINING, 0, 0); + card_uart_tx(ip->uart, msgb_l2(tfp->tpdu), msgb_l2len(tfp->tpdu), true); } else { /* 7816-3 10.3.2 special case outgoing transfer 0 means 256 */ int len_expected = tpduh->p3 == 0 ? 256 : tpduh->p3; @@ -1391,8 +1391,8 @@ if (tfp->is_command) { /* transmit *next*, not first byte */ OSMO_ASSERT(msgb_l3len(tfp->tpdu) >= 0); - card_uart_tx(ip->uart, msgb_l3(tfp->tpdu), 1, false); osmo_fsm_inst_state_chg(fi, TPDU_S_TX_SINGLE, 0, 0); + card_uart_tx(ip->uart, msgb_l3(tfp->tpdu), 1, false); } else { card_uart_set_rx_threshold(ip->uart, 1); card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 1);