Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/43553?usp=email )
Change subject: pySim-shell: let --apdu-trace cover the session ......................................................................
pySim-shell: let --apdu-trace cover the session
pySim has two APDU tracers: the StdoutApduTracer that --apdu-trace installs in the transport for every program using pySim.transport, and pySim-shell Cmd2ApduTracer for "set apdu_trace true", which prints with cmd2. The command line option exists because the setting applies too late to see the pySim startup APDUs.
The guard in init_reader() exists but is useless: if opts.apdu_trace and not 'apdu_tracer' in kwargs: no caller supplies a tracer that way, every tool calls init_reader() without one?.
The current help string does not say "trace or maybe not lol" so set the setting from the transport rather than hardcoding False, so the option implies "set apdu_trace true", and it finally works as advertised.
Change-Id: I83469e15f4cdd67418cd11df3869f2536105dbc8 --- M pySim-shell.py 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/53/43553/1
diff --git a/pySim-shell.py b/pySim-shell.py index d31cf6a..8e490f6 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -101,7 +101,7 @@ self.numeric_path = False self.conserve_write = True self.json_pretty_print = True - self.apdu_trace = False + self.apdu_trace = getattr(sl, 'apdu_tracer', None) is not None self.apdu_strict = False
self.add_settable(cmd2.Settable('numeric_path', bool,