Change in pysim[master]: filesystem: fix reset mechanism

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
Sun Oct 31 07:27:18 UTC 2021


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

Change subject: filesystem: fix reset mechanism
......................................................................

filesystem: fix reset mechanism

Currently we call the reset_card and get_atr methods directly at the
transport layer via the private _scc and _tp object of the card. This is
a violation. Fix and use the reset methods that are already in the
SimCard object.

Change-Id: I0e9d2a62a42a7387e7ca69d2ae830782a61aed89
---
M pySim/cards.py
M pySim/filesystem.py
2 files changed, 6 insertions(+), 3 deletions(-)

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



diff --git a/pySim/cards.py b/pySim/cards.py
index 4511271..8f5004e 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -60,7 +60,11 @@
 		self._aids = []
 
 	def reset(self):
-		self._scc.reset_card()
+		rc = self._scc.reset_card()
+		if rc is 1:
+			return self._scc.get_atr()
+		else:
+			return None
 
 	def erase(self):
 		print("warning: erasing is not supported for specified card type!")
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index cc9176f..dcc2608 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -1068,8 +1068,7 @@
         Args:
             cmd_app : Command Application State (for unregistering old file commands)
         """
-        self.card._scc._tp.reset_card()
-        atr = i2h(self.card._scc._tp.get_atr())
+        atr = i2h(self.card.reset())
         # select MF to reset internal state and to verify card really works
         self.select('MF', cmd_app)
         return atr

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0e9d2a62a42a7387e7ca69d2ae830782a61aed89
Gerrit-Change-Number: 26041
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/20211031/127dfbd4/attachment.htm>


More information about the gerrit-log mailing list