dexter has uploaded this change for review.

View Change

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(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/07/38607/1
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 change 38607. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I27bf9fdb131d8bdeba07f4dfd2b76b38f9bfdd17
Gerrit-Change-Number: 38607
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>