From 37719a0fcf2991faa138799073e25559e2ba8c7b Mon Sep 17 00:00:00 2001 From: Eric Wild Date: Wed, 23 Sep 2026 17:51:04 +0200 Subject: [PATCH] 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 --- pySim-shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySim-shell.py b/pySim-shell.py index 4f845142..be1d783b 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -101,7 +101,7 @@ Online manual available at https://downloads.osmocom.org/docs/pysim/master/html/ 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,