dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/37614?usp=email )
Change subject: pySim-shell: fix reset command
......................................................................
pySim-shell: fix reset command
The reset command resets the card using the card object. This unfortunately
leaves the RuntimeState uninformed about the event. However, the RuntimeState
class also has a reset method that resets the card and the RuntimeState. Let's
use this reset method. Also fix this method so that it ensures that the SCP is
also no longer present.
Related: OS#6092
Change-Id: I1ad29c9e7ce7d80bebc92fa173ed7a44ee4c2998
---
M pySim-shell.py
M pySim/runtime.py
2 files changed, 21 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/14/37614/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 2eb37ea..e99c365 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -265,10 +265,8 @@
@cmd2.with_category(CUSTOM_CATEGORY)
def do_reset(self, opts):
"""Reset the Card."""
- atr = self.card.reset()
- if self.lchan and self.lchan.scc.scp:
- self.lchan.scc.scp = None
- self.poutput('Card ATR: %s' % i2h(atr))
+ atr = self.rs.reset(self)
+ self.poutput('Card ATR: %s' % atr)
self.update_prompt()
class InterceptStderr(list):
diff --git a/pySim/runtime.py b/pySim/runtime.py
index a56df4d..db1641f 100644
--- a/pySim/runtime.py
+++ b/pySim/runtime.py
@@ -134,10 +134,13 @@
"""
# delete all lchan != 0 (basic lchan)
for lchan_nr in list(self.lchan.keys()):
+ self.lchan[lchan_nr].scc.scp = None
if lchan_nr == 0:
continue
del self.lchan[lchan_nr]
atr = i2h(self.card.reset())
+ if (cmd_app):
+ cmd_app.lchan = self.lchan[0]
# select MF to reset internal state and to verify card really works
self.lchan[0].select('MF', cmd_app)
self.lchan[0].selected_adf = None
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/37614?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1ad29c9e7ce7d80bebc92fa173ed7a44ee4c2998
Gerrit-Change-Number: 37614
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange