From 4779034f9e95714cf8b6f8a692ede344983feaa4 Mon Sep 17 00:00:00 2001 From: Supreeth Herle Date: Wed, 25 Mar 2020 12:51:38 +0100 Subject: sysmoISIM-SJA2: Fill unused bytes of Home ePDGId with 'f' Change-Id: Ia0464f230afcb0f37465d3ed0dfd8f417b53b0c3 --- pySim/cards.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pySim/cards.py b/pySim/cards.py index 7e47916..d60b27a 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -274,7 +274,11 @@ class UsimCard(Card): return (None, sw) def update_epdgid(self, epdgid): - epdgid_tlv = enc_addr_tlv(epdgid) + size = self._scc.binary_size(EF_USIM_ADF_map['ePDGId']) * 2 + if len(epdgid) > 0: + epdgid_tlv = rpad(enc_addr_tlv(epdgid), size) + else: + epdgid_tlv = rpad('ff', size) data, sw = self._scc.update_binary( EF_USIM_ADF_map['ePDGId'], epdgid_tlv) return sw @@ -1284,8 +1288,10 @@ class SysmoISIMSJA2(UsimCard, IsimCard): if self.file_exists(EF_USIM_ADF_map['ePDGId']): if p.get('epdgid'): sw = self.update_epdgid(p['epdgid']) - if sw != '9000': - print("Programming ePDGId failed with code %s"%sw) + else: + sw = self.update_epdgid("") + if sw != '9000': + print("Programming ePDGId failed with code %s"%sw) # update EF.ePDGSelection in ADF.USIM if self.file_exists(EF_USIM_ADF_map['ePDGSelection']): -- cgit v1.2.3