aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-06-06 17:00:51 +0200
committerHarald Welte <laforge@osmocom.org>2023-06-07 11:10:33 +0200
commit659781cbe1a4b43cf15d9d4971ffec3946514fa8 (patch)
treeb47bd035d07d8e94144896a4d38ca4446035d2e7 /pySim-shell.py
parent4e5aa304fc626879ce76deb216e53bd92ba77dc5 (diff)
Move "suspend_uicc" command from pySim-shell to ts_102_221.py
The SUSPEND UICC command is a TS 102 221 (UICC) command, so move it to the UICC Card Profile. Also, make sure that any shell command sets specified in the CardProfile are actually installed during equip(). Change-Id: I574348951f06b749aeff986589186110580328bc
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/pySim-shell.py b/pySim-shell.py
index d6d9a64..3f0818a 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -219,6 +219,9 @@ class PysimApp(cmd2.Cmd):
self._onchange_conserve_write(
'conserve_write', False, self.conserve_write)
self._onchange_apdu_trace('apdu_trace', False, self.apdu_trace)
+ if self.rs.profile:
+ for cmd_set in self.rs.profile.shell_cmdsets:
+ self.register_command_set(cmd_set)
self.register_command_set(Iso7816Commands())
self.register_command_set(Ts102222Commands())
self.register_command_set(PySimCommands())
@@ -283,6 +286,9 @@ class PysimApp(cmd2.Cmd):
@cmd2.with_category(CUSTOM_CATEGORY)
def do_equip(self, opts):
"""Equip pySim-shell with card"""
+ if self.rs.profile:
+ for cmd_set in self.rs.profile.shell_cmdsets:
+ self.unregister_command_set(cmd_set)
rs, card = init_card(sl)
self.equip(card, rs)
@@ -934,20 +940,6 @@ class Iso7816Commands(CommandSet):
fcp_dec = self._cmd.lchan.status()
self._cmd.poutput_json(fcp_dec)
- suspend_uicc_parser = argparse.ArgumentParser()
- suspend_uicc_parser.add_argument('--min-duration-secs', type=int, default=60,
- help='Proposed minimum duration of suspension')
- suspend_uicc_parser.add_argument('--max-duration-secs', type=int, default=24*60*60,
- help='Proposed maximum duration of suspension')
-
- # not ISO7816-4 but TS 102 221
- @cmd2.with_argparser(suspend_uicc_parser)
- def do_suspend_uicc(self, opts):
- """Perform the SUSPEND UICC command. Only supported on some UICC."""
- (duration, token, sw) = self._cmd.card._scc.suspend_uicc(min_len_secs=opts.min_duration_secs,
- max_len_secs=opts.max_duration_secs)
- self._cmd.poutput(
- 'Negotiated Duration: %u secs, Token: %s, SW: %s' % (duration, token, sw))
class Proact(ProactiveHandler):
def receive_fetch(self, pcmd: ProactiveCommand):