Change in pysim[master]: utils.py: Fix for parsing MNC

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Feb 11 13:46:58 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/22836 )

Change subject: utils.py: Fix for parsing MNC
......................................................................

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
---
M pySim/utils.py
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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_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)

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/22836
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I799469206f87e930d8888367890babcb8ebe23a9
Gerrit-Change-Number: 22836
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210211/e21c7a29/attachment.htm>


More information about the gerrit-log mailing list