<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-remsim/+/17243">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">client: Work around "stock on PTS" problem<br><br>I can occasionally see osmo-remsim-client-st2 get stuck when the Modem<br>(in this case a Quectel EC20) is performing PTS with the card.<br><br>In the log of osmo-remsim-client-st2 I can see:<br><br>SIMtrace => PTS req: ff 10 94 7b 00 00<br>SIMtrace -> 01 07 00 00 00 00 15 00 04 ff 10 94 7b 00 00 ff 10 94 7b<br>SIMtrace => PTS req: ff 10 94 7b 00 00<br>SIMtrace IRQ 01 04 00 00 00 00 15 00 13 00 00 00 00 00 09 04 0a 80 25 00 00<br><br>after which the communication doesn't proceed. After a long time, the<br>modem seems to retry without PTS and then proceeds with normal SIM card<br>communication.<br><br>Interestingly, both the firmware and a usbmon trace agree that the first<br>APDU header after the PTS is actually sent in an USB IN transfer:<br><br>-I- 0: computed Fi(1) Di(1) ratio: 372<br>-I- 0: computed Fi(9) Di(4) ratio: 64<br>-I- 0: send_tpdu_header: 00 a4 00 04 02<br>-I- 0: flush_rx_buffer (5)<br><br>usbmon shows 010600000000130001000000050000a4000402<br><br>It's unclear why the host program doesn't get the data from the IN<br>transfer.  However, if multiple asynchronous IN EP URB are submited,<br>the problem can be reproducibly avoided.  Let's do that.<br><br>Change-Id: I2fa5f71869b124b73e0c312befce1ca268e9a9a2<br>Closes: OS#4409<br>---<br>M src/client/simtrace2-remsim_client.c<br>1 file changed, 4 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/43/17243/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/client/simtrace2-remsim_client.c b/src/client/simtrace2-remsim_client.c</span><br><span>index 2929574..e495f10 100644</span><br><span>--- a/src/client/simtrace2-remsim_client.c</span><br><span>+++ b/src/client/simtrace2-remsim_client.c</span><br><span>@@ -1062,7 +1062,7 @@</span><br><span> {</span><br><span>        struct st_transport *transp = ci->slot->transp;</span><br><span>        struct usb_interface_match _ifm, *ifm = &_ifm;</span><br><span style="color: hsl(0, 100%, 40%);">-      int rc;</span><br><span style="color: hsl(120, 100%, 40%);">+       int rc, i;</span><br><span> </span><br><span>       ifm->vendor = cfg->usb.vendor_id;</span><br><span>      ifm->product = cfg->usb.product_id;</span><br><span>@@ -1163,7 +1163,9 @@</span><br><span>    printf("Entering main loop\n");</span><br><span> </span><br><span>        allocate_and_submit_irq(ci);</span><br><span style="color: hsl(0, 100%, 40%);">-    allocate_and_submit_in(ci);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* submit multiple IN URB in order to work around OS#4409 */</span><br><span style="color: hsl(120, 100%, 40%);">+  for (i = 0; i < 4; i++)</span><br><span style="color: hsl(120, 100%, 40%);">+            allocate_and_submit_in(ci);</span><br><span> </span><br><span>      while (!g_leave_main) {</span><br><span>              osmo_select_main(false);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-remsim/+/17243">change 17243</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-remsim/+/17243"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-remsim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I2fa5f71869b124b73e0c312befce1ca268e9a9a2 </div>
<div style="display:none"> Gerrit-Change-Number: 17243 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>