pySim-trace: mark card reset in the trace
The trace log currently does not contain any information about card
resets. This makes the trace difficult to follow. Let's use the
CardReset object to display the ATR in the trace.
Related: OS#6094
Change-Id: Ia550a8bd2f45d2ad622cb2ac2a2905397db76bce
diff --git a/pySim/apdu/__init__.py b/pySim/apdu/__init__.py
index cc0f701..b884e23 100644
--- a/pySim/apdu/__init__.py
+++ b/pySim/apdu/__init__.py
@@ -448,4 +448,11 @@
class CardReset:
- pass
+ def __init__(self, atr: bytes):
+ self.atr = atr
+
+ def __str__(self):
+ if (self.atr):
+ return '%s(%s)' % (type(self).__name__, b2h(self.atr))
+ else:
+ return '%s' % (type(self).__name__)