stc15: add error reporting for locked MCUs

It is possible to lock devices with a password against flashing. This
feature is not currently supported by stcgal, so at least output a
sensible message.
This commit is contained in:
Grigori Goronzy 2016-05-13 02:54:43 +02:00
parent cb739e6f94
commit eedf9169a7

View File

@ -1876,6 +1876,8 @@ class Stc15Protocol(Stc15AProtocol):
packet += bytes([0x00, 0x00, 0x5a, 0xa5])
self.write_packet(packet)
response = self.read_packet()
if response[0] == 0x0f:
raise StcProtocolException("MCU is locked")
if response[0] != 0x05:
raise StcProtocolException("incorrect magic in handshake packet")