path: root/pySim-read.py
diff options
authorHarald Welte <laforge@osmocom.org>2020-06-03 15:19:40 +0200
committerlaforge <laforge@osmocom.org>2020-08-28 08:32:55 +0000
commitca6739458e8eb8f15c981aa7343b66c770b42025 (patch)
treeab2262954e66a35324945a6fd932dacf7e90a9f5 /pySim-read.py
parent3c0bd7a41e8b5d9ecb61e9eab5ea299966096d6d (diff)
Add support for ADF_USIM/EF_EHPLMN
If the EF.EHPLMN exists, it contains the "Equivalent Home PLMN List". The odd part of that list is that it is not just a list of additional PLMN identities, but if the first digits of the IMSI are *not* listed in EF.EHPLMN, then the MCC/MNC of the IMSI prefix is suddently no longer considered the home network, but the subscriber is roaming. See TS 23.122: "If the HPLMN code derived from the IMSI is not present in the EHPLMN list, then it shall be treated as a Visited PLMN for PLMN selection purposes." Change-Id: I22d96ab4a424ec5bc1fb02f5e80165c646a748d3
Diffstat (limited to 'pySim-read.py')
1 files changed, 7 insertions, 0 deletions
diff --git a/pySim-read.py b/pySim-read.py
index 69cab4d..d6674a5 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -241,6 +241,13 @@ if __name__ == '__main__':
# Check whether we have th AID of USIM, if so select it by its AID
# EF.UST - File Id in ADF USIM : 6f38
if '9000' == card.select_adf_by_aid():
+ if card.file_exists(EF_USIM_ADF_map['EHPLMN']):
+ (res, sw) = card.read_ehplmn()
+ if sw == '9000':
+ print("EHPLMN:\n%s" % (res))
+ else:
+ print("EHPLMN: Can't read, response code = %s" % (sw,))
(res, sw) = card.read_binary(EF_USIM_ADF_map['UST'])
if sw == '9000':