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/+/25793 ) Change subject: CardModel: Document how this 'magic' works in some comments. ...................................................................... CardModel: Document how this 'magic' works in some comments. Change-Id: If16ade6e1098a87f749259bad6dea805ddb61ede --- M pySim-shell.py M pySim/filesystem.py 2 files changed, 9 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/pySim-shell.py b/pySim-shell.py index 871c45e..5aa311c 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -48,6 +48,9 @@ from pySim.ts_31_102 import CardApplicationUSIM from pySim.ts_31_103 import CardApplicationISIM +# we need to import this module so that the SysmocomSJA2 sub-class of +# CardModel is created, which will add the ATR-based matching and +# calling of SysmocomSJA2.add_files. See CardModel.apply_matching_models import pySim.sysmocom_sja2 from pySim.card_key_provider import CardKeyProviderCsv, card_key_provider_register, card_key_provider_get_field diff --git a/pySim/filesystem.py b/pySim/filesystem.py index 8edac41..fe781de 100644 --- a/pySim/filesystem.py +++ b/pySim/filesystem.py @@ -1435,7 +1435,9 @@ class CardModel(abc.ABC): - """A specific card model, typically having some additional vendor-specific files""" + """A specific card model, typically having some additional vendor-specific files. All + you need to do is to define a sub-class with a list of ATRs or an overridden match + method.""" _atrs = [] @classmethod @@ -1456,6 +1458,9 @@ @staticmethod def apply_matching_models(scc:SimCardCommands, rs:RuntimeState): + """Check if any of the CardModel sub-classes 'match' the currently inserted card + (by ATR or overriding the 'match' method). If so, call their 'add_files' + method.""" for m in CardModel.__subclasses__(): if m.match(scc): m.add_files(rs) -- To view, visit https://gerrit.osmocom.org/c/pysim/+/25793 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: If16ade6e1098a87f749259bad6dea805ddb61ede Gerrit-Change-Number: 25793 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-Reviewer: Jenkins Builder 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/20211014/ecec839f/attachment.htm>