[M] Change in simtrace2[master]: firmware: card_emu: use Di in the waiting time
Attention is currently required from: Hoernchen, laforge, lynxis lazus. Hello Jenkins Builder, laforge, lynxis lazus, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/simtrace2/+/43126?usp=email to look at the new patch set (#2). The following approvals got outdated and were removed: Code-Review+1 by laforge, Code-Review+2 by lynxis lazus, Verified+1 by Jenkins Builder The change is no longer submittable: Code-Review and Verified are unsatisfied now. Change subject: firmware: card_emu: use Di in the waiting time ...................................................................... firmware: card_emu: use Di in the waiting time ISO 7816-3 section 10.2 defines WT = WI x 960 x Fi/f seconds, store as etu, etu = Fi / (D x f) seconds, so the Fi cancels, but the D does not: WT [etu] = WI x 960 x D cemu dropped both (?!) -> WI x 960. The old comment explains why Fi can be dropped, which is right, but what about Di ?! sniffer gets it right (wt_wi * 960UL * wt_d), so the two state machines disagreed here again, by up to a factor of 64???!!?!!? This was fixed in osmo-ccid-firmware in 066489d in 2020 but not ported to st2. Additionally the waiting time was only recalculated at the end of the ATR, where D is still 1 by definition, so a PPS increasing D reprogrammed the baud rate but left the waiting time untouched??! etu duration shrinks with D by the same factor, wall clock WT is independent of D, which is the whole point. The old code decreased the waiting time by a factor of D: after a PPS to D=8 the card emitted its NULL procedure byte at ~0.09s instead of ~0.71s with a reader deadline of ~1.43s, and the inactivity timeout fires 8x too early, which probably led to unexplained wtime_exp errors. Update wt when WI becomes known (end of ATR) and where D changes (after the PPS response) + tests. Change-Id: I4263176d6073029d01f9ff5b11a6311617956af6 --- M firmware/libcommon/source/card_emu.c M firmware/test/card_emu_tests.c 2 files changed, 97 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/26/43126/2 -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43126?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I4263176d6073029d01f9ff5b11a6311617956af6 Gerrit-Change-Number: 43126 Gerrit-PatchSet: 2 Gerrit-Owner: Hoernchen <ewild@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> Gerrit-Attention: Hoernchen <ewild@sysmocom.de> Gerrit-Attention: laforge <laforge@osmocom.org> Gerrit-Attention: lynxis lazus <lynxis@fe80.eu>
participants (1)
-
Hoernchen