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
This commit is contained in:
Philipp Maier
2024-11-01 18:18:06 +01:00
parent 5887fb70fb
commit daa1c74047

View File

@@ -274,6 +274,11 @@ Online manual available at https://downloads.osmocom.org/docs/pysim/master/html/
@cmd2.with_category(CUSTOM_CATEGORY)
def do_reset(self, opts):
"""Reset the Card."""
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()