check RST/VCC/CLK line at every step of the activation

ISO-7816 specifies a card activation sequence: VCC on, CLK active, then RST
release.
we now check for the end state at every state of the activation in case the
reader does not strictly follows the sequence.

change has been tested on OWHW slot 1.

Change-Id: Ie55505ab3a70cbd64281af40af53d5e120313228
This commit is contained in:
Kévin Redon
2019-11-14 20:11:42 +01:00
parent 7233cf803a
commit ac7e73a579

View File

@@ -380,6 +380,13 @@ static void card_set_state(struct card_handle *ch,
case ISO_S_WAIT_RST:
/* disable Rx and Tx of UART */
card_emu_uart_enable(ch->uart_chan, 0);
/* check end activation state (only necessary if the reader to not respect the activation sequence) */
if (ch->vcc_active && ch->clocked && !ch->in_reset) {
/* enable the TC/ETU counter once reset has been released */
tc_etu_enable(ch->tc_chan);
/* prepare to send the ATR */
card_set_state(ch, ISO_S_WAIT_ATR);
}
break;
case ISO_S_WAIT_ATR:
/* Reset to initial Fi / Di ratio */