<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/pysim/+/26280">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cards: select_adf_by_aid: split off aid completion<br><br>The function select_adf_by_aid first searches for the complete AID in<br>the set of AIDs that were read from EF.DIR. Lets put this task into a<br>separate helper method<br><br>Change-Id: I88447d47bc96d0d4ff5cea694b46e854232cdf86<br>---<br>M pySim/cards.py<br>1 file changed, 11 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/26280/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pySim/cards.py b/pySim/cards.py</span><br><span>index 8f5004e..70c3956 100644</span><br><span>--- a/pySim/cards.py</span><br><span>+++ b/pySim/cards.py</span><br><span>@@ -278,13 +278,13 @@</span><br><span>                         self._aids = []</span><br><span>              return self._aids</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   def select_adf_by_aid(self, adf="usim"):</span><br><span style="color: hsl(0, 100%, 40%);">-              """Select ADF.U/ISIM in the Card using its full AID"""</span><br><span style="color: hsl(120, 100%, 40%);">+  def _complete_aid(self, adf="usim"):</span><br><span style="color: hsl(120, 100%, 40%);">+                """find the complete version of an ADF.U/ISIM AID"""</span><br><span>           # Find full AID by partial AID:</span><br><span>              if is_hex(adf):</span><br><span>                      for aid in self._aids:</span><br><span>                               if len(aid) >= len(adf) and adf == aid[0:len(adf)]:</span><br><span style="color: hsl(0, 100%, 40%);">-                                  return self._scc.select_adf(aid)</span><br><span style="color: hsl(120, 100%, 40%);">+                                      return aid</span><br><span>           # Find full AID by application name:</span><br><span>                 elif adf in ["usim", "isim"]:</span><br><span>                    # First (known) halves of the U/ISIM AID</span><br><span>@@ -293,7 +293,14 @@</span><br><span>                      aid_map["isim"] = "a0000000871004"</span><br><span>                       for aid in self._aids:</span><br><span>                               if aid_map[adf] in aid:</span><br><span style="color: hsl(0, 100%, 40%);">-                                 return self._scc.select_adf(aid)</span><br><span style="color: hsl(120, 100%, 40%);">+                                      return aid</span><br><span style="color: hsl(120, 100%, 40%);">+            return None</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ def select_adf_by_aid(self, adf="usim"):</span><br><span style="color: hsl(120, 100%, 40%);">+            """Select ADF.U/ISIM in the Card using its full AID"""</span><br><span style="color: hsl(120, 100%, 40%);">+          aid = _complete_aid(self, adf="usim")</span><br><span style="color: hsl(120, 100%, 40%);">+               if aid:</span><br><span style="color: hsl(120, 100%, 40%);">+                       return self._scc.select_adf(aid)</span><br><span>             return (None, None)</span><br><span> </span><br><span>      def erase_binary(self, ef):</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/26280">change 26280</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/pysim/+/26280"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: pysim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I88447d47bc96d0d4ff5cea694b46e854232cdf86 </div>
<div style="display:none"> Gerrit-Change-Number: 26280 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>