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/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Oct 3 08:08:08 UTC 2020


laforge has submitted this change. ( 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
M pysim-testdata/Fairwaves-SIM.ok
M pysim-testdata/Wavemobile-SIM.ok
M pysim-testdata/sysmoUSIM-SJS1.ok
5 files changed, 13 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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 f2a3d2a..f2f79e4 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(
diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok
index 6dd839c..e6fcfe3 100644
--- a/pysim-testdata/Fairwaves-SIM.ok
+++ b/pysim-testdata/Fairwaves-SIM.ok
@@ -116,6 +116,5 @@
 	Service 64 - VGCS security
 	Service 65 - VBS security
 
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
 Done !
 
diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok
index 010a228..6cb4e2b 100644
--- a/pysim-testdata/Wavemobile-SIM.ok
+++ b/pysim-testdata/Wavemobile-SIM.ok
@@ -132,6 +132,5 @@
 	Service 53 - Extension 8
 	Service 55 - MMS User Connectivity Parameters
 
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
 Done !
 
diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok
index da1a1f6..95f6967 100644
--- a/pysim-testdata/sysmoUSIM-SJS1.ok
+++ b/pysim-testdata/sysmoUSIM-SJS1.ok
@@ -140,6 +140,5 @@
 	Service 53 - Extension 8
 	Service 55 - MMS User Connectivity Parameters
 
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
 Done !
 

-- 
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: 4
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201003/2bdc2e76/attachment.htm>


More information about the gerrit-log mailing list