filesystem: actively probe applications

A profile can cover lots of different applications. Those applications
may not exist on all card models. To exclude applications that are not
installed on the particular card EF.DIR is evaluated. However, there may
be applications that are not registered in EF.DIR but supported by the
profile. To cover those as well, lets try to select the applications we
do not see in EF.DIR. If selecting works we know that the application
exists on the card and we can include them in the RuntimeState.

Change-Id: I3fa77a68664fe50d690a18adfb1ae1a88a189827
This commit is contained in:
Philipp Maier 2021-12-01 11:48:27 +01:00
parent e903a40530
commit 8d8bdef637
1 changed files with 12 additions and 3 deletions

View File

@ -1101,14 +1101,23 @@ class RuntimeState(object):
for a in aids_card:
for f in apps_profile:
if f.aid in a:
print(" %s: %s" % (f.name, a))
print(" %s: %s (EF.DIR)" % (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)
print(" unknown: %s (EF.DIR)" % a)
else:
print("error: could not determine card applications")
print("warning: EF.DIR seems to be empty!")
# Some card applications may not be registered in EF.DIR, we will actively
# probe for those applications
for f in set(apps_profile) - set(apps_taken):
data, sw = self.card.select_adf_by_aid(f.aid)
if sw == "9000":
print(" %s: %s" % (f.name, a))
apps_taken.append(f)
return apps_taken
def reset(self, cmd_app=None) -> Hexstr: