aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpySim-read.py12
-rw-r--r--pySim/cards.py7
-rw-r--r--pysim-testdata/Fairwaves-SIM.ok1
-rw-r--r--pysim-testdata/Wavemobile-SIM.ok1
-rw-r--r--pysim-testdata/sysmoUSIM-SJS1.ok1
5 files changed, 13 insertions, 9 deletions
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 @@ if __name__ == '__main__':
#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 @@ class UsimCard(Card):
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 @@ USIM Service Table: 01ea1ffc21360480010000
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 @@ USIM Service Table: 9eff1b3c37fe5900000000
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 @@ USIM Service Table: 9e6b1dfc67f6580000
Service 53 - Extension 8
Service 55 - MMS User Connectivity Parameters
-ePDGId: Can't read file -- SW match failed! Expected 9000 and got 6a82.
Done !