From a0e14a16f29040bd000cedd58f43001f3df48626 Mon Sep 17 00:00:00 2001 From: Eric Wild Date: Wed, 23 Sep 2026 17:51:04 +0200 Subject: [PATCH] transport: trace APDUs when they are sent Right now APDUs that never return/fail are omitted from the trace output. Move the print, so it actually tells me what failed.. Change-Id: I828ea36b06da36b6bb0aa073d235d4f49cbb3161 --- pySim-shell.py | 4 +++- pySim/transport/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pySim-shell.py b/pySim-shell.py index be1d783b..2d9d3567 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -210,8 +210,10 @@ Online manual available at https://downloads.osmocom.org/docs/pysim/master/html/ def __init__(self, cmd2_app): self.cmd2 = cmd2_app - def trace_response(self, cmd, sw, resp): + def trace_command(self, cmd): self.cmd2.poutput("-> %s %s" % (cmd[:10], cmd[10:])) + + def trace_response(self, cmd, sw, resp): self.cmd2.poutput("<- %s: %s" % (sw, resp)) def update_prompt(self): diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py index 5a630c81..f99fd89e 100644 --- a/pySim/transport/__init__.py +++ b/pySim/transport/__init__.py @@ -45,8 +45,10 @@ class ApduTracer: class StdoutApduTracer(ApduTracer): """Minimalistic APDU tracer, printing commands to stdout.""" - def trace_response(self, cmd, sw, resp): + def trace_command(self, cmd): log.info("-> %s %s", cmd[:10], cmd[10:]) + + def trace_response(self, cmd, sw, resp): log.info("<- %s: %s", sw, resp) def trace_reset(self):