aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-03-18 17:09:33 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-03-18 17:18:13 +0100
commitbd8ed2c4dbc3c622e439617195f0adf53f165464 (patch)
tree8ab1bd263497e6c08cf185c850d49873f5b475f8
parent415557361737586b6d45e74ffa62ec0dd8830164 (diff)
filesystem: fix flag model used with get_selectable_names()
The flags NAMES, FIDS and APPS do not properly distinguish between applications and normal files. With APPS it is only possible to exclude or include the selectable applications in a list with NAMES or FIDS, but it is not possible to get only the application names or identifiers. - remove the APPS flag - rename NAMES to FNAMES and make it only normal file related - add ANAMES and relate it only to application (ADF) names - add AIDS and relate it only to application identifiers Change-Id: Id07e0dcbab10cd78c1b78d37319b7b0e5e83b64d Related: OS#4963
-rw-r--r--pySim/filesystem.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 664c722..ad020af 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -93,7 +93,7 @@ class CardFile(object):
sels.update({alias: self})
if self.fid and (flags == [] or 'FIDS' in flags):
sels.update({self.fid: self})
- if self.name and (flags == [] or 'NAMES' in flags):
+ if self.name and (flags == [] or 'FNAMES' in flags):
sels.update({self.name: self})
return sels
@@ -111,8 +111,7 @@ class CardFile(object):
mf = self.get_mf()
if mf:
sels.update(mf._get_self_selectables(flags = flags))
- if flags == [] or 'APPS' in flags:
- sels.update(mf.get_app_selectables(flags))
+ sels.update(mf.get_app_selectables(flags = flags))
return sels
def get_selectable_names(self, flags = []):
@@ -169,7 +168,7 @@ class CardDF(CardFile):
sels = super().get_selectables(flags)
if flags == [] or 'FIDS' in flags:
sels.update({x.fid: x for x in self.children.values() if x.fid})
- if flags == [] or 'NAMES' in flags:
+ if flags == [] or 'FNAMES' in flags:
sels.update({x.name: x for x in self.children.values() if x.name})
return sels
@@ -226,16 +225,15 @@ class CardMF(CardDF):
def get_selectables(self, flags = []):
"""Get list of completions (DF/EF/ADF names) from current DF"""
sels = super().get_selectables(flags)
- if flags == [] or 'APPS' in flags:
- sels.update(self.get_app_selectables(flags))
+ sels.update(self.get_app_selectables(flags))
return sels
def get_app_selectables(self, flags = []):
"""Get applications by AID + name"""
sels = {}
- if flags == [] or 'FIDS' in flags:
+ if flags == [] or 'AIDS' in flags:
sels.update({x.aid: x for x in self.applications.values()})
- if flags == [] or 'NAMES' in flags:
+ if flags == [] or 'ANAMES' in flags:
sels.update({x.name: x for x in self.applications.values() if x.name})
return sels