Change in pysim[master]: Move reading of USIM service table to generic USIM class

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
Tue Sep 29 10:52:09 UTC 2020


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


Change subject: Move reading of USIM service table to generic USIM class
......................................................................

Move reading of USIM service table to generic USIM class

Change-Id: I537547f3bd01a547310358f8a8fceddcb4c79f37
---
M pySim-read.py
M pySim/cards.py
2 files changed, 21 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/15/20315/1

diff --git a/pySim-read.py b/pySim-read.py
index a4f15f8..3e19a02 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -256,14 +256,20 @@
 				print("EHPLMN:\n%s" % (res))
 			else:
 				print("EHPLMN: Can't read, response code = %s" % (sw,))
+
 		# EF.UST
-		(res, sw) = card.read_binary(EF_USIM_ADF_map['UST'])
-		if sw == '9000':
-			print("USIM Service Table: %s" % res)
-			# Print those which are available
-			print("%s" % dec_st(res, table="usim"))
-		else:
-			print("USIM Service Table: Can't read, response code = %s" % (sw,))
+		try:
+			if card.file_exists(EF_USIM_ADF_map['UST']):
+				# res[0] - EF content of UST
+				# res[1] - Human readable format of services marked available in UST
+				(res, sw) = card.read_ust()
+				if sw == '9000':
+					print("USIM Service Table: %s" % res[0])
+					print("%s" % res[1])
+				else:
+					print("USIM Service Table: Can't read, response code = %s" % (sw,))
+		except Exception as e:
+			print("USIM Service Table: Can't read file -- " + str(e))
 
 		#EF.ePDGId - Home ePDG Identifier
 		try:
diff --git a/pySim/cards.py b/pySim/cards.py
index c4bf812..ae4aaf2 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -277,6 +277,14 @@
 						EF_USIM_ADF_map['ePDGId'], epdgid_tlv)
 		return sw
 
+	def read_ust(self):
+		(res, sw) = self._scc.read_binary(EF_USIM_ADF_map['UST'])
+		if sw == '9000':
+			# Print those which are available
+			return ([res, dec_st(res, table="usim")], sw)
+		else:
+			return ([None, None], sw)
+
 
 class _MagicSimBase(Card):
 	"""

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I537547f3bd01a547310358f8a8fceddcb4c79f37
Gerrit-Change-Number: 20315
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/20200929/3c9ef51e/attachment.htm>


More information about the gerrit-log mailing list