dexter has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/38607?usp=email )

Change subject: pySim-shell: fix reset command for no-profile mode
......................................................................

pySim-shell: fix reset command for no-profile mode

There are situations where no card profile can be determined. In this case no
RuntimeState will be present. This is in particular the case when pySim-shell
is used on a card that is not provisioned/initialized yet. In those cases we
have to go the direct route and reset the card directly.

Related: OS#6367
Change-Id: I27bf9fdb131d8bdeba07f4dfd2b76b38f9bfdd17
---
M pySim-shell.py
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve




diff --git a/pySim-shell.py b/pySim-shell.py
index f53efd3..413d3f7 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -274,7 +274,12 @@
     @cmd2.with_category(CUSTOM_CATEGORY)
     def do_reset(self, opts):
         """Reset the Card."""
-        atr = self.rs.reset(self)
+        if self.rs is None:
+            # In case no runtime state is available we go the direct route
+            self.card._scc.reset_card()
+            atr = b2h(self.card._scc.get_atr())
+        else:
+            atr = self.rs.reset(self)
         self.poutput('Card ATR: %s' % atr)
         self.update_prompt()


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38607?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I27bf9fdb131d8bdeba07f4dfd2b76b38f9bfdd17
Gerrit-Change-Number: 38607
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to