From a1850aeccca3c6b62d883612d122e4d022bb4b05 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 25 Oct 2023 18:05:09 +0200 Subject: [PATCH] filesystem: add flag to tell whether an ADF supports an FS or not An ADF may or may not support a file system. For example ADF.ARA-M does not have any filesystem support, which means the SELECT we may use from this ADF is limited and an can only select a different application. To know about this in advance let's add a flag that we set when we instantiate an ADF. Change-Id: Ifd0f7c34164685ea18d8a746394e55416fa0aa66 Related: OS#5418 --- pySim/filesystem.py | 3 ++- pySim/ts_31_102.py | 4 ++-- pySim/ts_31_103.py | 4 ++-- pySim/ts_31_104.py | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pySim/filesystem.py b/pySim/filesystem.py index 800f2cc8..d39162c3 100644 --- a/pySim/filesystem.py +++ b/pySim/filesystem.py @@ -504,11 +504,12 @@ class CardMF(CardDF): class CardADF(CardDF): """ADF (Application Dedicated File) in the smart card filesystem""" - def __init__(self, aid: str, **kwargs): + def __init__(self, aid: str, has_fs: bool=False, **kwargs): super().__init__(**kwargs) # reference to CardApplication may be set from CardApplication constructor self.application = None # type: Optional[CardApplication] self.aid = aid # Application Identifier + self.has_fs = has_fs # Flag to tell whether the ADF supports a filesystem or not mf = self.get_mf() if mf: mf.add_application_df(self) diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index 0fcf8836..28781e12 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -1369,9 +1369,9 @@ class DF_SAIP(CardDF): class ADF_USIM(CardADF): - def __init__(self, aid='a0000000871002', name='ADF.USIM', fid=None, sfid=None, + def __init__(self, aid='a0000000871002', has_fs=True, name='ADF.USIM', fid=None, sfid=None, desc='USIM Application'): - super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc) + super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc) # add those commands to the general commands of a TransparentEF self.shell_commands += [self.AddlShellCommands()] diff --git a/pySim/ts_31_103.py b/pySim/ts_31_103.py index 4327a1a9..5268c700 100644 --- a/pySim/ts_31_103.py +++ b/pySim/ts_31_103.py @@ -258,9 +258,9 @@ class EF_MuDMiDConfigData(BerTlvEF): class ADF_ISIM(CardADF): - def __init__(self, aid='a0000000871004', name='ADF.ISIM', fid=None, sfid=None, + def __init__(self, aid='a0000000871004', has_fs=True, name='ADF.ISIM', fid=None, sfid=None, desc='ISIM Application'): - super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc) + super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc) files = [ EF_IMPI(), diff --git a/pySim/ts_31_104.py b/pySim/ts_31_104.py index 0adafba9..239acbf3 100644 --- a/pySim/ts_31_104.py +++ b/pySim/ts_31_104.py @@ -30,9 +30,9 @@ from pySim.ts_102_221 import EF_ARR class ADF_HPSIM(CardADF): - def __init__(self, aid='a000000087100A', name='ADF.HPSIM', fid=None, sfid=None, + def __init__(self, aid='a000000087100A', has_fs=True, name='ADF.HPSIM', fid=None, sfid=None, desc='HPSIM Application'): - super().__init__(aid=aid, fid=fid, sfid=sfid, name=name, desc=desc) + super().__init__(aid=aid, has_fs=has_fs, fid=fid, sfid=sfid, name=name, desc=desc) files = [ EF_ARR(fid='6f06', sfid=0x06),