Change in pysim[master]: Move reading of ePDG Id 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/+/20314 )


Change subject: Move reading of ePDG Id to generic USIM class
......................................................................

Move reading of ePDG Id to generic USIM class

Change-Id: I716acb994430db3d4e56fea072f8dc2cebeaba84
---
M pySim-read.py
M pySim/cards.py
2 files changed, 13 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/14/20314/1

diff --git a/pySim-read.py b/pySim-read.py
index 2ca0557..a4f15f8 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -267,12 +267,12 @@
 
 		#EF.ePDGId - Home ePDG Identifier
 		try:
-			(res, sw) = card.read_binary(EF_USIM_ADF_map['ePDGId'])
-			if sw == '9000':
-				content = dec_epdgid(res)
-				print("ePDGId:\n%s" % (len(content) and content or '\tNot available\n',))
-			else:
-				print("ePDGId: Can't read, response code = %s" % (sw,))
+			if card.file_exists(EF_USIM_ADF_map['ePDGId']):
+				(res, sw) = card.read_epdgid()
+				if sw == '9000':
+					print("ePDGId:\n%s" % (len(res) and res or '\tNot available\n',))
+				else:
+					print("ePDGId: Can't read, response code = %s" % (sw,))
 		except Exception as e:
 			print("ePDGId: Can't read file -- " + str(e))
 
diff --git a/pySim/cards.py b/pySim/cards.py
index d596e22..c4bf812 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -264,6 +264,13 @@
 		data, sw = self._scc.update_binary(EF_USIM_ADF_map['EHPLMN'], ehplmn)
 		return sw
 
+	def read_epdgid(self):
+		(res, sw) = self._scc.read_binary(EF_USIM_ADF_map['ePDGId'])
+		if sw == '9000':
+			return (dec_epdgid(res), sw)
+		else:
+			return (None, sw)
+
 	def update_epdgid(self, epdgid):
 		epdgid_tlv = enc_epdgid(epdgid)
 		data, sw = self._scc.update_binary(

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I716acb994430db3d4e56fea072f8dc2cebeaba84
Gerrit-Change-Number: 20314
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/1b390597/attachment.htm>


More information about the gerrit-log mailing list