Change in pysim[master]: cards: add methods to help erasing of file contents

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Fri May 22 12:43:24 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/18417 )


Change subject: cards: add methods to help erasing of file contents
......................................................................

cards: add methods to help erasing of file contents

Resetting the contents of a file before re-writing it with parameters
might be helpful when implementing the currently empty erase() methods
of the various card implementations. Lets add two methods, one for
resetting a binary file and one for resetting a specific record in a
record oriented file

Change-Id: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d
---
M pySim/cards.py
1 file changed, 10 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/18417/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 1c0add0..73b0763 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -248,6 +248,16 @@
 
 		return None
 
+	# Erase the contents of a file
+	def erase_binary(self, ef):
+		len = self._scc.binary_size(ef)
+		self._scc.update_binary(ef, "ff" * len, offset=0, verify=True)
+
+	# Erase the contents of a single record
+	def erase_record(self, ef, rec_no):
+		len = self._scc.record_size(ef)
+		self._scc.update_record(ef, rec_no, "ff" * len, force_len=False, verify=True)
+
 
 class _MagicSimBase(Card):
 	"""

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/18417
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3c3a4ef3d3f358404af307a68a20b7059f1a9e8d
Gerrit-Change-Number: 18417
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200522/ec3a441c/attachment.htm>


More information about the gerrit-log mailing list