From 66b337079a17aea5105b64cc381103157dcc9a9d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 16 Jan 2024 18:59:43 +0100 Subject: [PATCH] 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 --- pySim-shell.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pySim-shell.py b/pySim-shell.py index c6454038..5b80588c 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -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