mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-04-01 04:31:41 +03:00
modem_atcmd: raise ProtocolError instead of ReaderError on CME ERROR
Also accept ProtocolError in addition to SwMatchError in filesystem.py when probing for applications Change-Id: I82b50408328f8eaaee5c9e311c4620d20f930642
This commit is contained in:
@@ -1352,7 +1352,7 @@ class RuntimeState:
|
|||||||
if sw == "9000":
|
if sw == "9000":
|
||||||
print(" %s: %s" % (f.name, f.aid))
|
print(" %s: %s" % (f.name, f.aid))
|
||||||
apps_taken.append(f)
|
apps_taken.append(f)
|
||||||
except SwMatchError:
|
except (SwMatchError, ProtocolError):
|
||||||
pass
|
pass
|
||||||
return apps_taken
|
return apps_taken
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,9 @@ class ModemATCommandLink(LinkBase):
|
|||||||
log.debug('Sending command: %s', cmd)
|
log.debug('Sending command: %s', cmd)
|
||||||
|
|
||||||
# Send AT+CSIM command to the modem
|
# Send AT+CSIM command to the modem
|
||||||
# TODO: also handle +CME ERROR: <err>
|
|
||||||
rsp = self.send_at_cmd(cmd)
|
rsp = self.send_at_cmd(cmd)
|
||||||
|
if rsp[-1].startswith(b'+CME ERROR:'):
|
||||||
|
raise ProtocolError('AT+CSIM failed with: %s' % str(rsp))
|
||||||
if len(rsp) != 2 or rsp[-1] != b'OK':
|
if len(rsp) != 2 or rsp[-1] != b'OK':
|
||||||
raise ReaderError('APDU transfer failed: %s' % str(rsp))
|
raise ReaderError('APDU transfer failed: %s' % str(rsp))
|
||||||
rsp = rsp[0] # Get rid of b'OK'
|
rsp = rsp[0] # Get rid of b'OK'
|
||||||
|
|||||||
Reference in New Issue
Block a user