From 5bf42600d4adfbadaf4f27e19dad46661da457f1 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 11 Jul 2018 23:23:40 +0200 Subject: [PATCH] cards: add update method for EF:PLMNsel to Card class The Card class offers update methods for various EF, but for PLMNsel there is no update method available yet. Lets add one. Change-Id: I832f7bef70c92dc101b94ad871b6cafaa626e134 Related: SYS#4245 --- pySim/cards.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pySim/cards.py b/pySim/cards.py index 0c9c2b88..3577d8d3 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -83,6 +83,12 @@ class Card(object): data, sw = self._scc.update_binary(EF['HPLMNwAcT'], content + 'ffffff0000' * (size/5-1)) return sw + 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) + self._scc.update_binary(EF['PLMNsel'], hplmn + 'ff' * (size-3)) + def update_smsp(self, smsp): data, sw = self._scc.update_record(EF['SMSP'], 1, rpad(smsp, 84)) return sw