utils: Remove format_xplmn leading zeros in MNC

Change-Id: I803edafbd892c2b32b884d0b39fed61967a3d68b
This commit is contained in:
Matan Perelman 2023-06-01 17:39:04 +03:00 committed by laforge
parent 777ee9e54d
commit 60951b0c17
3 changed files with 9 additions and 10 deletions

View File

@ -594,8 +594,8 @@ def dec_xplmn(threehexbytes: Hexstr) -> dict:
plmn_chars = 6
# first three bytes (six ascii hex chars)
plmn_str = threehexbytes[:plmn_chars]
res['mcc'] = dec_mcc_from_plmn(plmn_str)
res['mnc'] = dec_mnc_from_plmn(plmn_str)
res['mcc'] = dec_mcc_from_plmn_str(plmn_str)
res['mnc'] = dec_mnc_from_plmn_str(plmn_str)
return res
@ -603,11 +603,10 @@ def format_xplmn(hexstr: Hexstr) -> str:
s = ""
for rec_data in hexstr_to_Nbytearr(hexstr, 3):
rec_info = dec_xplmn(rec_data)
if rec_info['mcc'] == 0xFFF and rec_info['mnc'] == 0xFFF:
if not rec_info['mcc'] and not rec_info['mnc']:
rec_str = "unused"
else:
rec_str = "MCC: %03d MNC: %03d" % (
rec_info['mcc'], rec_info['mnc'])
rec_str = "MCC: %s MNC: %s" % (rec_info['mcc'], rec_info['mnc'])
s += "\t%s # %s\n" % (rec_data, rec_str)
return s

View File

@ -103,7 +103,7 @@ SIM Service Table: ff33ffff3f003f0f300cf0c3f00000
Service 59 - MMS User Connectivity Parameters
EHPLMN:
00f110 # MCC: 001 MNC: 001
00f110 # MCC: 001 MNC: 01
ffffff # unused
ffffff # unused
ffffff # unused

View File

@ -105,10 +105,10 @@ SIM Service Table: ff3fffff3f003f1ff00c00c0f00000
Service 59 - MMS User Connectivity Parameters
FPLMN:
62f201 # MCC: 262 MNC: 010
62f202 # MCC: 262 MNC: 020
62f203 # MCC: 262 MNC: 030
62f207 # MCC: 262 MNC: 070
62f201 # MCC: 262 MNC: 10
62f202 # MCC: 262 MNC: 20
62f203 # MCC: 262 MNC: 30
62f207 # MCC: 262 MNC: 70
USIM Service Table: 9e6b1dfc67f6580000
Service 2 - Fixed Dialling Numbers (FDN)