mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-17 02:48:34 +03:00
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
This commit is contained in:
@@ -550,11 +550,33 @@ class RuntimeState(object):
|
||||
self.selected_file = self.mf
|
||||
self.profile = profile
|
||||
# add applications + MF-files from profile
|
||||
for a in self.profile.applications:
|
||||
apps = self._match_applications()
|
||||
for a in apps:
|
||||
self.mf.add_application(a)
|
||||
for f in self.profile.files_in_mf:
|
||||
self.mf.add_file(f)
|
||||
|
||||
def _match_applications(self):
|
||||
"""match the applications from the profile with applications on the card"""
|
||||
apps_profile = self.profile.applications
|
||||
aids_card = self.card.read_aids()
|
||||
apps_taken = []
|
||||
if aids_card:
|
||||
aids_taken = []
|
||||
print("AIDs on card:")
|
||||
for a in aids_card:
|
||||
for f in apps_profile:
|
||||
if f.aid in a:
|
||||
print(" %s: %s" % (f.name, a))
|
||||
aids_taken.append(a)
|
||||
apps_taken.append(f)
|
||||
aids_unknown = set(aids_card) - set(aids_taken)
|
||||
for a in aids_unknown:
|
||||
print(" unknown: %s" % a)
|
||||
else:
|
||||
print("error: could not determine card applications")
|
||||
return apps_taken
|
||||
|
||||
def get_cwd(self):
|
||||
"""Obtain the current working directory."""
|
||||
if isinstance(self.selected_file, CardDF):
|
||||
|
||||
Reference in New Issue
Block a user