Change in pysim[master]: cards.py: Added method to select ADF by its full AID

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Thu Apr 16 05:58:50 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/17834 )


Change subject: cards.py: Added method to select ADF by its full AID
......................................................................

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
---
M pySim-read.py
M pySim/cards.py
2 files changed, 19 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/34/17834/1

diff --git a/pySim-read.py b/pySim-read.py
index 4b3b1be..3e25c76 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -236,5 +236,6 @@
 	else:
 		print("SIM Service Table: Can't read, response code = %s" % (sw,))
 
+
 	# Done for this card and maybe for everything ?
 	print("Done !\n")
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 @@
 		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):
 	"""

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/17834
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie5f29eec14f099add1d0978e3e7d4ed3c9130854
Gerrit-Change-Number: 17834
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200416/7db06202/attachment.htm>


More information about the gerrit-log mailing list