aboutsummaryrefslogtreecommitdiffstats
path: root/pySim/cards.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-08-28 23:19:11 +0200
committerHarald Welte <laforge@gnumonks.org>2019-08-28 23:20:02 +0200
commit23888dab85165f44bfd8ee649dbfc869e881545d (patch)
treeb55ac5cf298f3679874c90c5d91f5d1462537f0d /pySim/cards.py
parent67acdbc817bbfa542d27435bc3ed8d6554c4e1a4 (diff)
make writing SMSP optional
Diffstat (limited to 'pySim/cards.py')
-rw-r--r--pySim/cards.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pySim/cards.py b/pySim/cards.py
index cb42d83..55282aa 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -394,8 +394,9 @@ class GrcardSim(Card):
data, sw = self._scc.update_binary('6f78', lpad(p['acc'], 4))
# EF.SMSP
- r = self._scc.select_file(['3f00', '7f10', '6f42'])
- data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
+ if p.get('smsp'):
+ r = self._scc.select_file(['3f00', '7f10', '6f42'])
+ data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
# Set the Ki using proprietary command
pdu = '80d4020010' + p['ki']
@@ -535,7 +536,8 @@ class SysmoSIMgr2(Card):
r = self._scc.select_file(['3f00', '7f10'])
# write EF.SMSP
- data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
+ if p.get('smsp'):
+ data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
def erase(self):
return
@@ -614,8 +616,9 @@ class SysmoUSIMSJS1(Card):
print("Programming AD failed with code %s"%sw)
# EF.SMSP
- r = self._scc.select_file(['3f00', '7f10'])
- data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 104), force_len=True)
+ if p.get('smsp'):
+ r = self._scc.select_file(['3f00', '7f10'])
+ data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 104), force_len=True)
def erase(self):
return