aboutsummaryrefslogtreecommitdiffstats
path: root/pySim-shell.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-10-21 20:06:19 +0200
committerHarald Welte <laforge@osmocom.org>2023-10-21 21:47:04 +0200
commitbdf595756ec344cad9db619bff578466c338b855 (patch)
tree439d4827742dc2f27d7767560f73415505587fb8 /pySim-shell.py
parent79972522677a31258bfe91935a1cd52713edebea (diff)
pySim-shell: Create/delete RuntimeLchan objects on open/close of channel
We already have the open channel and close_channel commands in pySim-shell. They are sent to the card and acknowledged, respectively. We also already do have code that can track multiple different logical channels (the rs.lchan array). However, this is currently only used by pySim-trace, and not by pySim-shell. Let's change that. Change-Id: Idacee2dc57e8afe85c79bc85b259064e7f5b83a2 Related: OS#6230
Diffstat (limited to 'pySim-shell.py')
-rwxr-xr-xpySim-shell.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pySim-shell.py b/pySim-shell.py
index a79949c..867795c 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -948,6 +948,8 @@ class Iso7816Commands(CommandSet):
"""Open a logical channel."""
(data, sw) = self._cmd.card._scc.manage_channel(
mode='open', lchan_nr=opts.chan_nr)
+ # this is executed only in successful case, as unsuccessful raises exception
+ self._cmd.lchan.add_lchan(opts.chan_nr)
close_chan_parser = argparse.ArgumentParser()
close_chan_parser.add_argument(
@@ -958,6 +960,8 @@ class Iso7816Commands(CommandSet):
"""Close a logical channel."""
(data, sw) = self._cmd.card._scc.manage_channel(
mode='close', lchan_nr=opts.chan_nr)
+ # this is executed only in successful case, as unsuccessful raises exception
+ self._cmd.rs.del_lchan(opts.chan_nr)
def do_status(self, opts):
"""Perform the STATUS command."""