diff options
authorPhilipp Maier <pmaier@sysmocom.de>2021-03-01 18:38:52 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-03-01 18:42:35 +0100
commit928971d52f12247d3f598243ed9786f8c6eb56ea (patch)
parent013ff2e24b0304ec059f071f49f5f2caf2c2963c (diff)
filesystem: fall back to profile when app does not define interpret_swpmaier/shell
An application can have own status words that are different from what is defined in the card profile. However, the ADF still may lack the interpret_sw method. If this is the case we fall back to the card profile. Change-Id: I52812af2a6ea33ed801c8bcebcc7487240af148b Related: OS#4963
1 files changed, 7 insertions, 0 deletions
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index f3d5687..a1f9b8e 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -575,6 +575,13 @@ class RuntimeState(object):
or the underlying profile."""
app = self.get_application()
if app:
+ # The application either comes with its own interpret_sw
+ # method or we will use the interpret_sw method from the
+ # card profile.
+ if hasattr(app, "interpret_sw"):
+ return app.interpret_sw(sw)
+ else:
+ return self.profile.interpret_sw(sw)
return app.interpret_sw(sw)
return self.profile.interpret_sw(sw)