<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20691">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">t0: fix wtime calculation, for real this time<br><br>ETU calculation is 1 etu = fi/di * 1/f as per chapter 7.1.<br><br>wtime/WWT is usually mentioned as being 9600 etu in iso 7816-3 - but<br>it's actually specified for t=0 as WT=WI*960*Fi/f in chapter 10.2 - no<br>di involved here, so the rightmost fraction is not ETU!<br><br>-> as soon as di is not 1 after a pps exchange the timeout value was off<br>by a factor of di if it was just used as a multiplier for ETU.<br><br>Change-Id: Icd4fa83e1177873e90200529331d3a1fce8be1c6<br>---<br>M ccid_common/ccid_slot_fsm.c<br>1 file changed, 2 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/ccid_common/ccid_slot_fsm.c b/ccid_common/ccid_slot_fsm.c</span><br><span>index 2338919..18aa61f 100644</span><br><span>--- a/ccid_common/ccid_slot_fsm.c</span><br><span>+++ b/ccid_common/ccid_slot_fsm.c</span><br><span>@@ -246,6 +246,7 @@</span><br><span>          uint16_t F = iso7816_3_fi_table[cs->proposed_pars.fi];</span><br><span>            uint8_t D = iso7816_3_di_table[cs->proposed_pars.di];</span><br><span>             uint32_t fmax = iso7816_3_fmax_table[cs->proposed_pars.fi];</span><br><span style="color: hsl(120, 100%, 40%);">+                uint8_t D_or_one = D > 0 ? D : 1;</span><br><span> </span><br><span>             /* 7816-3 5.2.3</span><br><span>               * No  information  shall  be  exchanged  when  switching  the</span><br><span>@@ -256,7 +257,7 @@</span><br><span>                  */</span><br><span>          card_uart_ctrl(ss->cuart, CUART_CTL_SET_CLOCK_FREQ, fmax);</span><br><span>                card_uart_ctrl(ss->cuart, CUART_CTL_SET_FD, F/D);</span><br><span style="color: hsl(0, 100%, 40%);">-            card_uart_ctrl(ss->cuart, CUART_CTL_WTIME, cs->proposed_pars.t0.waiting_integer * 960);</span><br><span style="color: hsl(120, 100%, 40%);">+         card_uart_ctrl(ss->cuart, CUART_CTL_WTIME, cs->proposed_pars.t0.waiting_integer * 960 * D_or_one);</span><br><span> </span><br><span>                 cs->pars = cs->proposed_pars;</span><br><span>          resp = ccid_gen_parameters_t0(cs, ss->seq, CCID_CMD_STATUS_OK, 0);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20691">change 20691</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20691"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ccid-firmware </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Icd4fa83e1177873e90200529331d3a1fce8be1c6 </div>
<div style="display:none"> Gerrit-Change-Number: 20691 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Hoernchen <ewild@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>