aboutsummaryrefslogtreecommitdiffstats
path: root/pySim
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-22 08:04:59 +0100
committerSupreeth Herle <herlesupreeth@gmail.com>2020-04-16 07:55:15 +0200
commitf9f3e5e0c1be4963a734910a39bbec26f6990e1b (patch)
tree216c6c6cd2d4a07cb7fe5123aef45c4244a83525 /pySim
parent3bf43639ce6fff62958afb20d0d2a688193c0799 (diff)
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
Diffstat (limited to 'pySim')
-rw-r--r--pySim/cards.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pySim/cards.py b/pySim/cards.py
index a12b111..c0462fb 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -234,6 +234,24 @@ class Card(object):
except Exception as 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):
"""