mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-27 15:58:34 +03:00
cards: FairwavesSIM: force SIM APDUs during programming
The FairwavesSIM programming fails when the card is accessed with USIM APDUs. To keep it working temporarly switch to SIM APDUs during programming. Change-Id: I8f02625d2b620ecdf4b2afc27a8750119b707152
This commit is contained in:
@@ -1123,8 +1123,25 @@ class FairwavesSIM(UsimCard):
|
|||||||
data, sw = self._scc.update_binary(self._EF['OP/OPC'], content)
|
data, sw = self._scc.update_binary(self._EF['OP/OPC'], content)
|
||||||
return sw
|
return sw
|
||||||
|
|
||||||
|
|
||||||
def program(self, p):
|
def program(self, p):
|
||||||
|
# For some reason the card programming only works when the card
|
||||||
|
# is handled as a classic SIM, even though it is an USIM, so we
|
||||||
|
# reconfigure the class byte and the select control field on
|
||||||
|
# the fly. When the programming is done the original values are
|
||||||
|
# restored.
|
||||||
|
cla_byte_orig = self._scc.cla_byte
|
||||||
|
sel_ctrl_orig = self._scc.sel_ctrl
|
||||||
|
self._scc.cla_byte = "a0"
|
||||||
|
self._scc.sel_ctrl = "0000"
|
||||||
|
|
||||||
|
try:
|
||||||
|
self._program(p)
|
||||||
|
finally:
|
||||||
|
# restore original cla byte and sel ctrl
|
||||||
|
self._scc.cla_byte = cla_byte_orig
|
||||||
|
self._scc.sel_ctrl = sel_ctrl_orig
|
||||||
|
|
||||||
|
def _program(self, p):
|
||||||
# authenticate as ADM1
|
# authenticate as ADM1
|
||||||
if not p['pin_adm']:
|
if not p['pin_adm']:
|
||||||
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
raise ValueError("Please provide a PIN-ADM as there is no default one")
|
||||||
|
|||||||
Reference in New Issue
Block a user