Change in osmo-ccid-firmware[master]: 7816 fsm: adjust atr start timeout

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.org
Sat Oct 17 17:20:19 UTC 2020


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20710 )


Change subject: 7816 fsm: adjust atr start timeout
......................................................................

7816 fsm: adjust atr start timeout

The calculation was still expecting timeouts measured in GT instead of
WT, so the actual wait time for empty sim trays (or unresponsive cards)
was 58 seconds instead of ~ 1.5s - a bit longer than necessary.
Total timeout if the atr reception has started is still approximately
45s as per spec (9600 ETU x 32).

Change-Id: I9f0ae104fac690127ab039ee7d9005e8d3896a1c
---
M ccid_common/iso7816_fsm.c
1 file changed, 6 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/10/20710/1

diff --git a/ccid_common/iso7816_fsm.c b/ccid_common/iso7816_fsm.c
index 1835368..bf19539 100644
--- a/ccid_common/iso7816_fsm.c
+++ b/ccid_common/iso7816_fsm.c
@@ -250,10 +250,9 @@
 		card_uart_ctrl(ip->uart, CUART_CTL_RX, true);
 
 		/* let's be reasonable here: the 40k cycle delay to ATR start is
-		 * ~1.4ms @ 2.5Mhz/6720 baud, 1ETU = 372 cycles -> 40k/372=107/12ETU ~ 9 byte
-		 * default timeout for rx is 9600 ETU, ATR might be missing the TCK
-		 * so it might time out, so just add this delay */
-		card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 32+9);
+		 * ~1.4ms @ 2.5Mhz/6720 baud, 1ETU = 372 cycles -> 40k/372=107/12ETU(GT!) ~ 9 byte
+		 * but this is WT not GT, so default 9600 x ETU -> 1 byte wait time is ~1.5s */
+		card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 1);
 		osmo_fsm_inst_state_chg(fi, ISO7816_S_WAIT_ATR, 0, 0);
 		break;
 	case ISO7816_E_POWER_UP_IND:
@@ -280,6 +279,9 @@
 
 	switch (event) {
 	case ISO7816_E_RX_SINGLE:
+		/* let's expect at most 32 more bytes */
+		card_uart_ctrl(ip->uart, CUART_CTL_RX_TIMER_HINT, 32);
+
 		osmo_fsm_inst_state_chg(fi, ISO7816_S_IN_ATR, 0, 0);
 		osmo_fsm_inst_dispatch(ip->atr_fi, event, data);
 		break;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20710
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: I9f0ae104fac690127ab039ee7d9005e8d3896a1c
Gerrit-Change-Number: 20710
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/20201017/ba9ba898/attachment.htm>


More information about the gerrit-log mailing list