This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/23601 ) Change subject: transport: Pass status word interpreter to exception handler ...................................................................... transport: Pass status word interpreter to exception handler Prior to this patch, any SwMatchError raised within the 'transport' would not be interpreted. EXCEPTION of type 'SwMatchError' occurred with message: 'SW match failed! Expected 9000 and got 6982.' vs (now) EXCEPTION of type 'SwMatchError' occurred with message: 'SW match failed! Expected 9000 and got 6982: Command not allowed - Security status not satisfied' Change-Id: I08b7f2b6bd422f7f2f36094bc8a29b187ff882a6 --- M pySim-shell.py M pySim/transport/__init__.py 2 files changed, 9 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve diff --git a/pySim-shell.py b/pySim-shell.py index ae8a5a2..e73ec35 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -433,6 +433,8 @@ profile.add_application(CardApplicationISIM) rs = RuntimeState(card, profile) + # inform the transport that we can do context-specific SW interpretation + sl.set_sw_interpreter(rs) # FIXME: do this dynamically rs.mf.add_file(DF_TELECOM()) diff --git a/pySim/transport/__init__.py b/pySim/transport/__init__.py index 24d7521..fb8f31d 100644 --- a/pySim/transport/__init__.py +++ b/pySim/transport/__init__.py @@ -28,6 +28,12 @@ class LinkBase(object): """Base class for link/transport to card.""" + sw_interpreter = None + + def set_sw_interpreter(self, interp): + """Set an (optional) status word interpreter.""" + self.sw_interpreter = interp + def wait_for_card(self, timeout:int=None, newcardonly:bool=False): """Wait for a card and connect to it @@ -103,7 +109,7 @@ rv = self.send_apdu(pdu) if not sw_match(rv[1], sw): - raise SwMatchError(rv[1], sw.lower()) + raise SwMatchError(rv[1], sw.lower(), self.sw_interpreter) return rv def init_reader(opts) -> Optional[LinkBase]: -- To view, visit https://gerrit.osmocom.org/c/pysim/+/23601 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I08b7f2b6bd422f7f2f36094bc8a29b187ff882a6 Gerrit-Change-Number: 23601 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210406/d8bbaef1/attachment.htm>