aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-04-10 18:39:32 +0200
committerHarald Welte <laforge@osmocom.org>2021-04-11 12:20:29 +0200
commit703f933b40610ab30eb53368609b42ace4def200 (patch)
tree3bcf3c40498d6ca566675372746978fa8ca0471a /pySim-shell.py
parenta463161ae22bb111dcc8c9fc8a9b17a78f6a3121 (diff)
pySim-shell: Add open_channel + close_channel commands
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/pySim-shell.py b/pySim-shell.py
index b2ccb9a..132733d 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -413,6 +413,23 @@ class Iso7816Commands(CommandSet):
fid = self._cmd.rs.selected_file.fid
(data, sw) = self._cmd.card._scc.activate_file(fid)
+ open_chan_parser = argparse.ArgumentParser()
+ open_chan_parser.add_argument('chan_nr', type=int, default=0, help='Channel Number')
+
+ @cmd2.with_argparser(open_chan_parser)
+ def do_open_channel(self, opts):
+ """Open a logical channel."""
+ (data, sw) = self._cmd.card._scc.manage_channel(mode='open', lchan_nr=opts.chan_nr)
+
+ close_chan_parser = argparse.ArgumentParser()
+ close_chan_parser.add_argument('chan_nr', type=int, default=0, help='Channel Number')
+
+ @cmd2.with_argparser(close_chan_parser)
+ def do_close_channel(self, opts):
+ """Close a logical channel."""
+ (data, sw) = self._cmd.card._scc.manage_channel(mode='close', lchan_nr=opts.chan_nr)
+
+
def parse_options():
parser = OptionParser(usage="usage: %prog [options]")