<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/24506">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">simtrace2-cardem-pcsc: Reset the real card if reader resets cardem<br><br>When the cardem detects a reset from the phone/modem, pass this on<br>to the actual card via the PC/SC reader.  This is important to<br>reset the card state whenever requested by the stack/driver on the<br>phone/modem.<br><br>Change-Id: I7056476c5f81e8aa8f550afb86bf2380d1497ebb<br>Depends: libosmocore 20199da02d37a6d284915a27ec12641e79b8781c<br>---<br>M host/src/simtrace2-cardem-pcsc.c<br>1 file changed, 25 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/06/24506/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c</span><br><span>index 532c5ba..af34d3f 100644</span><br><span>--- a/host/src/simtrace2-cardem-pcsc.c</span><br><span>+++ b/host/src/simtrace2-cardem-pcsc.c</span><br><span>@@ -74,6 +74,27 @@</span><br><span>           flags & CEMU_STATUS_F_RCEMU_ACTIVE ? "RCEMU " : "");</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static uint32_t last_flags = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void update_flags(struct osmo_st2_cardem_inst *ci, uint32_t flags)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       struct osim_card_hdl *card = ci->chan->card;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if ((flags & CEMU_STATUS_F_VCC_PRESENT) && (flags & CEMU_STATUS_F_CLK_ACTIVE) &&</span><br><span style="color: hsl(120, 100%, 40%);">+          !(flags & CEMU_STATUS_F_RESET_ACTIVE)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (last_flags & CEMU_STATUS_F_RESET_ACTIVE) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    /* a reset has just ended, forward it to the real card */</span><br><span style="color: hsl(120, 100%, 40%);">+                     bool cold_reset = true;</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (last_flags & CEMU_STATUS_F_VCC_PRESENT)</span><br><span style="color: hsl(120, 100%, 40%);">+                               cold_reset = false;</span><br><span style="color: hsl(120, 100%, 40%);">+                   LOGCI(ci, LOGL_NOTICE, "%s Resetting card in reader...\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                          cold_reset ? "Cold" : "Warm");</span><br><span style="color: hsl(120, 100%, 40%);">+                    osim_card_reset(card, cold_reset);</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     last_flags = flags;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /***********************************************************************</span><br><span>  * Incoming Messages</span><br><span>  ***********************************************************************/</span><br><span>@@ -89,6 +110,8 @@</span><br><span>               status->flags, status->fi, status->di, status->wi,</span><br><span>               status->waiting_time, fbuf);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   update_flags(ci, status->flags);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>        return 0;</span><br><span> }</span><br><span> </span><br><span>@@ -195,6 +218,8 @@</span><br><span>             status->flags, status->fi, status->di, status->wi,</span><br><span>               status->waiting_time, fbuf);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   update_flags(ci, status->flags);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>        return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/24506">change 24506</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/simtrace2/+/24506"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I7056476c5f81e8aa8f550afb86bf2380d1497ebb </div>
<div style="display:none"> Gerrit-Change-Number: 24506 </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>