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/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23473 ) Change subject: pySim-shell: add ADF.ISIM / ADF.USIM dynamically ...................................................................... pySim-shell: add ADF.ISIM / ADF.USIM dynamically currently ADF.ISIM and ADF.USIM are always added regardless if there is a matching application on the card or not. Lets check what applications are actually installed and add ADF.ISIM and ADF.USIM dynamically. Change-Id: I42ee23375f98e6322708c1c4db6d65e1425feecd Related: OS#4963 --- M pySim-shell.py M pySim/cards.py 2 files changed, 18 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/73/23473/1 diff --git a/pySim-shell.py b/pySim-shell.py index 946b3e5..2978380 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -58,8 +58,6 @@ self.card = card self.rs = rs self.py_locals = { 'card': self.card, 'rs' : self.rs } - self.card.read_aids() - self.poutput('AIDs on card: %s' % (self.card._aids)) self.numeric_path = False self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', onchange_cb=self._onchange_numeric_path)) @@ -254,14 +252,26 @@ sys.exit(2) profile = CardProfileUICC() + rs = RuntimeState(card, profile) - # FIXME: do this dynamically rs.mf.add_file(DF_TELECOM()) rs.mf.add_file(DF_GSM()) - rs.mf.add_application(ADF_USIM()) - rs.mf.add_application(ADF_ISIM()) app = PysimApp(card, rs) + aids = card.read_aids() + if aids: + app.poutput("AIDs on card:") + for a in aids: + if "a0000000871002" in a: + app.poutput(" USIM: %s" % a) + rs.mf.add_application(ADF_USIM()) + elif "a0000000871004" in a: + app.poutput(" ISIM: %s" % a) + rs.mf.add_application(ADF_ISIM()) + else: + app.poutput(" unknown application: %s" % a) + else: + app.poutput("error: could not determine card applications") rs.select('MF', app) app.cmdloop() diff --git a/pySim/cards.py b/pySim/cards.py index c640591..857d0b6 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -207,6 +207,7 @@ # Fetch all the AIDs present on UICC def read_aids(self): + self._aids = [] try: # Find out how many records the EF.DIR has # and store all the AIDs in the UICC @@ -218,6 +219,8 @@ self._aids.append(rec[0][8:8 + int(rec[0][6:8], 16) * 2]) except Exception as e: print("Can't read AIDs from SIM -- %s" % (str(e),)) + self._aids = [] + return self._aids # Select ADF.U/ISIM in the Card using its full AID def select_adf_by_aid(self, adf="usim"): -- To view, visit https://gerrit.osmocom.org/c/pysim/+/23473 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I42ee23375f98e6322708c1c4db6d65e1425feecd Gerrit-Change-Number: 23473 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210323/810236b4/attachment.htm>