mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-19 03:48:34 +03:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user