Change in pysim[master]: cards: remove empty erase() methods.

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/.

laforge gerrit-no-reply at lists.osmocom.org
Sat May 23 11:50:14 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/18418 )

Change subject: cards: remove empty erase() methods.
......................................................................

cards: remove empty erase() methods.

Some of the cards do not implement the erase method that each card
should have. However, having an empty method in each of those classes
does not make too much sense. Lets rather have an erase method in the
superclass (Card) that prints a warning to inform the user that erasing
the spcified card is not supported.

Change-Id: If5add960ec0cab58a01d8f83e6af8cb86ec70a8d
---
M pySim/cards.py
1 file changed, 4 insertions(+), 20 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pySim/cards.py b/pySim/cards.py
index 73b0763..c7b34eb 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -37,6 +37,10 @@
 	def reset(self):
 		self._scc.reset_card()
 
+	def erase(self):
+		print("warning: erasing is not supported for specified card type!")
+		return
+
 	def verify_adm(self, key):
 		'''
 		Authenticate with ADM key
@@ -529,8 +533,6 @@
 
 		# FIXME: EF.MSISDN
 
-	def erase(self):
-		return
 
 class SysmoSIMgr1(GrcardSim):
 	"""
@@ -575,9 +577,6 @@
 			)
 		data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par)
 
-	def erase(self):
-		return
-
 
 class SysmoSIMgr2(Card):
 	"""
@@ -653,8 +652,6 @@
 		if p.get('smsp'):
 			data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
 
-	def erase(self):
-		return
 
 class SysmoUSIMSJS1(Card):
 	"""
@@ -759,9 +756,6 @@
 			r = self._scc.select_file(['3f00', '7f10'])
 			data, sw = self._scc.update_record('6F40', 1, data, force_len=True)
 
-	def erase(self):
-		return
-
 
 class FairwavesSIM(Card):
 	"""
@@ -903,10 +897,6 @@
 			if sw != '9000':
 				print("Programming ACC failed with code %s"%sw)
 
-	def erase(self):
-		return
-
-
 class OpenCellsSim(Card):
 	"""
 	OpenCellsSim
@@ -1046,9 +1036,6 @@
 
 		return None
 
-	def erase(self):
-		return
-
 
 class SysmoISIMSJA2(Card):
 	"""
@@ -1169,9 +1156,6 @@
 
 		return
 
-	def erase(self):
-		return
-
 
 # In order for autodetection ...
 _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim,

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: If5add960ec0cab58a01d8f83e6af8cb86ec70a8d
Gerrit-Change-Number: 18418
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200523/f7821350/attachment.htm>


More information about the gerrit-log mailing list