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/.
dexter gerrit-no-reply at lists.osmocom.orgdexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/15496 Change subject: cards: use string representation for MNC/MCC ...................................................................... cards: use string representation for MNC/MCC At the moment MNC and MCC are represented as integer numbers inside the parameter array while all other parameters are represented as strings. Lets use strings for MNC/MCC as well to simplify the parameter handling. We will also not loose the length information in case of leading zeros. Change-Id: Ia2333921a4863f0f26ee923ca796e62ec5e2d59a --- M pySim-prog.py M pySim/cards.py 2 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/96/15496/1 diff --git a/pySim-prog.py b/pySim-prog.py index a462489..57a24d4 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -432,7 +432,7 @@ if 'smsp' in params: s.append(" > SMSP : %(smsp)s") s.append(" > ICCID : %(iccid)s") - s.append(" > MCC/MNC : %(mcc)d/%(mnc)d") + s.append(" > MCC/MNC : %(mcc)s/%(mnc)s") s.append(" > IMSI : %(imsi)s") s.append(" > Ki : %(ki)s") s.append(" > OPC : %(opc)s") @@ -479,8 +479,8 @@ def read_params_csv(opts, imsi=None, iccid=None): row = _read_params_csv(opts, iccid=iccid, imsi=imsi) if row is not None: - row['mcc'] = int(row.get('mcc', row['imsi'][0:3])) - row['mnc'] = int(row.get('mnc', row['imsi'][3:5])) + row['mcc'] = row.get('mcc', row['imsi'][0:3]) + row['mnc'] = row.get('mnc', row['imsi'][3:5]) pin_adm = None # We need to escape the pin_adm we get from the csv if 'pin_adm' in row: diff --git a/pySim/cards.py b/pySim/cards.py index cda337a..ec001ab 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -90,7 +90,7 @@ # get size and write EF.OPLMNwAcT data = self._scc.read_binary(EF['OPLMNwAcT'], length=None, offset=0) size = len(data[0])/2 - hplmn = enc_plmn(mcc, mnc) + hplmn = enc_plmn(int(mcc), int(mnc)) content = hplmn + access_tech data, sw = self._scc.update_binary(EF['OPLMNwAcT'], content + 'ffffff0000' * (size/5-1)) return sw @@ -102,7 +102,7 @@ # get size and write EF.PLMNwAcT data = self._scc.read_binary(EF['PLMNwAcT'], length=None, offset=0) size = len(data[0])/2 - hplmn = enc_plmn(mcc, mnc) + hplmn = enc_plmn(int(mcc), int(mnc)) content = hplmn + access_tech data, sw = self._scc.update_binary(EF['PLMNwAcT'], content + 'ffffff0000' * (size/5-1)) return sw @@ -110,7 +110,7 @@ def update_plmnsel(self, mcc, mnc): data = self._scc.read_binary(EF['PLMNsel'], length=None, offset=0) size = len(data[0])/2 - hplmn = enc_plmn(mcc, mnc) + hplmn = enc_plmn(int(mcc), int(mnc)) data, sw = self._scc.update_binary(EF['PLMNsel'], hplmn + 'ff' * (size-3)) return sw @@ -200,7 +200,7 @@ self._scc.select_file(['3f00', '7f4d']) # Home PLMN in PLMN_Sel format - hplmn = enc_plmn(p['mcc'], p['mnc']) + hplmn = enc_plmn(int(p['mcc']), int(p['mnc'])) # Operator name ( 3f00/7f4d/8f0c ) self._scc.update_record(self._files['name'][0], 2, @@ -244,7 +244,7 @@ r = self._scc.select_file(['3f00', '7f20', '6f30']) tl = int(r[-1][4:8], 16) - hplmn = enc_plmn(p['mcc'], p['mnc']) + hplmn = enc_plmn(int(p['mcc']), int(p['mnc'])) self._scc.update_binary('6f30', hplmn + 'ff' * (tl-3)) def erase(self): @@ -330,7 +330,7 @@ r = self._scc.select_file(['3f00', '7f20', '6f30']) tl = int(r[-1][4:8], 16) - hplmn = enc_plmn(p['mcc'], p['mnc']) + hplmn = enc_plmn(int(p['mcc']), int(p['mnc'])) self._scc.update_binary('6f30', hplmn + 'ff' * (tl-3)) # Get total number of entries and entry size @@ -405,7 +405,7 @@ # EF.HPLMN r = self._scc.select_file(['3f00', '7f20', '6f30']) size = int(r[-1][4:8], 16) - hplmn = enc_plmn(p['mcc'], p['mnc']) + hplmn = enc_plmn(int(p['mcc']), int(p['mnc'])) self._scc.update_binary('6f30', hplmn + 'ff' * (size-3)) # EF.SPN (Service Provider Name) @@ -523,7 +523,7 @@ # get size and write EF.HPLMN r = self._scc.select_file(['6f30']) size = int(r[-1][4:8], 16) - hplmn = enc_plmn(p['mcc'], p['mnc']) + hplmn = enc_plmn(int(p['mcc']), int(p['mnc'])) self._scc.update_binary('6f30', hplmn + 'ff' * (size-3)) # set COMP128 version 0 in proprietary file -- To view, visit https://gerrit.osmocom.org/c/pysim/+/15496 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ia2333921a4863f0f26ee923ca796e62ec5e2d59a Gerrit-Change-Number: 15496 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190912/a33a5318/attachment.htm>