pySim-shell: Permit 'reset' command also in unqeuipped stage

If we are not 'equipped' as we could not detect any known applications
on the card, we used to only permit the 'apdu' command. However, we
should also permit the 'reset' command, as it also is something that's
possible with ever card, even of unknown types.

Change-Id: I23199da727973d7095ac18031f49e1e8423aa287
This commit is contained in:
Harald Welte 2024-01-16 18:59:43 +01:00 committed by laforge
parent 4f3d11b378
commit 66b337079a
1 changed files with 7 additions and 6 deletions

View File

@ -254,6 +254,13 @@ Online manual available at https://downloads.osmocom.org/docs/pysim/master/html/
if not sw_match(sw, opts.expect_sw):
raise SwMatchError(sw, opts.expect_sw)
@cmd2.with_category(CUSTOM_CATEGORY)
def do_reset(self, opts):
"""Reset the Card."""
atr = self.card.reset()
self.poutput('Card ATR: %s' % i2h(atr))
self.update_prompt()
class InterceptStderr(list):
def __init__(self):
self._stderr_backup = sys.stderr
@ -702,12 +709,6 @@ class PySimCommands(CommandSet):
raise RuntimeError(
"unable to export %i dedicated files(s)%s" % (context['ERR'], exception_str_add))
def do_reset(self, opts):
"""Reset the Card."""
atr = self._cmd.card.reset()
self._cmd.poutput('Card ATR: %s' % i2h(atr))
self._cmd.update_prompt()
def do_desc(self, opts):
"""Display human readable file description for the currently selected file"""
desc = self._cmd.lchan.selected_file.desc