diff options
author | herlesupreeth <herlesupreeth@gmail.com> | 2021-02-11 06:59:29 +0100 |
---|---|---|
committer | herlesupreeth <herlesupreeth@gmail.com> | 2021-02-11 07:02:50 +0100 |
commit | bdf3d3597b5d8e4260f80a00ada78e9ad612b00b (patch) | |
tree | 2e74d9f0e3e625c9127bc92ba7edcb1167eca4d3 | |
parent | cebf8b198bb1a9019653e1fcc0be4b58403188f9 (diff) |
utils.py: Fix for parsing MNC
This commit fixes the incorrect parsing of MNC from PLMN.
Previously its was parsing PLMN string 130062 as MCC 310 MNC 260,
whereas it should be MCC 310 MNC 026.
(The SIM was programmed with MCC 310 and MNC 026)
Change-Id: I799469206f87e930d8888367890babcb8ebe23a9
-rw-r--r-- | pySim/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pySim/utils.py b/pySim/utils.py index 3838eff..c150184 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -137,9 +137,9 @@ def dec_mcc_from_plmn(plmn): def dec_mnc_from_plmn(plmn): ia = h2i(plmn) - digit1 = ia[2] & 0x0F # 3rd byte, LSB - digit2 = (ia[2] & 0xF0) >> 4 # 3rd byte, MSB - digit3 = (ia[1] & 0xF0) >> 4 # 2nd byte, MSB + digit1 = (ia[1] & 0xF0) >>4 # 2nd byte, MSB + digit2 = ia[2] & 0x0F # 3rd byte, LSB + digit3 = (ia[2] & 0xF0) >> 4 # 3nd byte, MSB if digit3 == 0xF and digit2 == 0xF and digit1 == 0xF: return 0xFFF # 4095 return derive_mnc(digit1, digit2, digit3) |