diff options
author | Harald Welte <laforge@osmocom.org> | 2021-05-25 22:21:44 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-05-25 22:23:00 +0200 |
commit | 485692bc77a7a3eacbba6291cbad9724c9bb9635 (patch) | |
tree | 3079deeab2b43478d5819273e448471c14f6457f /pySim-shell.py | |
parent | 34b05d3707cc06c7ef44d4aa1d3631aee33dc5a9 (diff) |
shell: Fix activate_file + deactivate_file commands
We cannot re-activate a deactivated file after we have selected somethng
else, as SELECT will fail on the deactivated file. Hence, the
deactivate_file command needs to be used with a file name as argument.
Change-Id: Ief4d2bf8ea90497a8f25d1986aeea935c615f9bb
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-x | pySim-shell.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pySim-shell.py b/pySim-shell.py index edd8112..59bfa28 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -419,13 +419,17 @@ class Iso7816Commands(CommandSet): def do_deactivate_file(self, opts): """Deactivate the current EF""" - fid = self._cmd.rs.selected_file.fid - (data, sw) = self._cmd.card._scc.deactivate_file(fid) + (data, sw) = self._cmd.card._scc.deactivate_file() def do_activate_file(self, opts): - """Activate the current EF""" - fid = self._cmd.rs.selected_file.fid - (data, sw) = self._cmd.card._scc.activate_file(fid) + """Activate the specified EF""" + path = opts.arg_list[0] + (data, sw) = self._cmd.rs.activate_file(path) + + def complete_activate_file(self, text, line, begidx, endidx) -> List[str]: + """Command Line tab completion for ACTIVATE FILE""" + index_dict = { 1: self._cmd.rs.selected_file.get_selectable_names() } + return self._cmd.index_based_complete(text, line, begidx, endidx, index_dict=index_dict) open_chan_parser = argparse.ArgumentParser() open_chan_parser.add_argument('chan_nr', type=int, default=0, help='Channel Number') |