mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-28 00:08:36 +03:00
cards.py: Added method to select ADF by its full AID
If AID of the desired ADF is in the list of AIDs of the Card/Card subclass object then ADF is selected or else None is returned Change-Id: Ie5f29eec14f099add1d0978e3e7d4ed3c9130854
This commit is contained in:
@@ -236,5 +236,6 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
print("SIM Service Table: Can't read, response code = %s" % (sw,))
|
print("SIM Service Table: Can't read, response code = %s" % (sw,))
|
||||||
|
|
||||||
|
|
||||||
# Done for this card and maybe for everything ?
|
# Done for this card and maybe for everything ?
|
||||||
print("Done !\n")
|
print("Done !\n")
|
||||||
|
|||||||
@@ -234,6 +234,24 @@ class Card(object):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Can't read AIDs from SIM -- %s" % (str(e),))
|
print("Can't read AIDs from SIM -- %s" % (str(e),))
|
||||||
|
|
||||||
|
# Select ADF.U/ISIM in the Card using its full AID
|
||||||
|
def select_adf_by_aid(self, adf="usim"):
|
||||||
|
# Check for valid ADF name
|
||||||
|
if adf not in ["usim", "isim"]:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# First (known) halves of the U/ISIM AID
|
||||||
|
aid_map = {}
|
||||||
|
aid_map["usim"] = "a0000000871002"
|
||||||
|
aid_map["isim"] = "a0000000871004"
|
||||||
|
|
||||||
|
for aid in self._aids:
|
||||||
|
if aid_map[adf] in aid:
|
||||||
|
(res, sw) = self._scc.select_adf(aid)
|
||||||
|
return sw
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class _MagicSimBase(Card):
|
class _MagicSimBase(Card):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user