<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/pysim/+/18417">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cards: add methods to help erasing of file contents<br><br>Resetting the contents of a file before re-writing it with parameters<br>might be helpful when implementing the currently empty erase() methods<br>of the various card implementations. Lets add two methods, one for<br>resetting a binary file and one for resetting a specific record in a<br>record oriented file<br><br>Change-Id: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d<br>---<br>M pySim/cards.py<br>1 file changed, 10 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/18417/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 1c0add0..73b0763 100644</span><br><span>--- a/pySim/cards.py</span><br><span>+++ b/pySim/cards.py</span><br><span>@@ -248,6 +248,16 @@</span><br><span> </span><br><span>            return None</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       # Erase the contents of a file</span><br><span style="color: hsl(120, 100%, 40%);">+        def erase_binary(self, ef):</span><br><span style="color: hsl(120, 100%, 40%);">+           len = self._scc.binary_size(ef)</span><br><span style="color: hsl(120, 100%, 40%);">+               self._scc.update_binary(ef, "ff" * len, offset=0, verify=True)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    # Erase the contents of a single record</span><br><span style="color: hsl(120, 100%, 40%);">+       def erase_record(self, ef, rec_no):</span><br><span style="color: hsl(120, 100%, 40%);">+           len = self._scc.record_size(ef)</span><br><span style="color: hsl(120, 100%, 40%);">+               self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> class _MagicSimBase(Card):</span><br><span>  """</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/18417">change 18417</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/+/18417"/><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: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d </div>
<div style="display:none"> Gerrit-Change-Number: 18417 </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>