add FirmwareErase message
This commit is contained in:
parent
f863e1e602
commit
c01830462a
@ -18,7 +18,8 @@ enum MessageType {
|
|||||||
MessageType_Failure = 3;
|
MessageType_Failure = 3;
|
||||||
MessageType_ChangePin = 4;
|
MessageType_ChangePin = 4;
|
||||||
MessageType_WipeDevice = 5;
|
MessageType_WipeDevice = 5;
|
||||||
MessageType_FirmwareUpdate = 6;
|
MessageType_FirmwareErase = 6;
|
||||||
|
MessageType_FirmwareUpload = 7;
|
||||||
MessageType_GetEntropy = 9;
|
MessageType_GetEntropy = 9;
|
||||||
MessageType_Entropy = 10;
|
MessageType_Entropy = 10;
|
||||||
MessageType_GetMasterPublicKey = 11;
|
MessageType_GetMasterPublicKey = 11;
|
||||||
@ -71,7 +72,7 @@ enum FailureType {
|
|||||||
Failure_PinExpected = 5;
|
Failure_PinExpected = 5;
|
||||||
Failure_PinCancelled = 6;
|
Failure_PinCancelled = 6;
|
||||||
Failure_PinInvalid = 7;
|
Failure_PinInvalid = 7;
|
||||||
Failure_FirmwareDataIncompatibility = 99;
|
Failure_FirmwareError = 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specifies which script will be used for given transaction output.
|
// Specifies which script will be used for given transaction output.
|
||||||
@ -349,7 +350,10 @@ message TxOutput {
|
|||||||
// Bootloader messages
|
// Bootloader messages
|
||||||
//
|
//
|
||||||
|
|
||||||
message FirmwareUpdate {
|
message FirmwareErase {
|
||||||
|
}
|
||||||
|
|
||||||
|
message FirmwareUpload {
|
||||||
required bytes payload = 1 [(binary) = true]; // Firmware to flash into device
|
required bytes payload = 1 [(binary) = true]; // Firmware to flash into device
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,11 +264,15 @@ class TrezorClient(object):
|
|||||||
if self.features.bootloader_mode == False:
|
if self.features.bootloader_mode == False:
|
||||||
raise Exception("Device must be in bootloader mode")
|
raise Exception("Device must be in bootloader mode")
|
||||||
|
|
||||||
resp = self.call(proto.FirmwareUpdate(payload=fp.read()))
|
resp = self.call(proto.FirmwareErase())
|
||||||
|
if isinstance(resp, proto.Failure) and resp.code == proto.Failure_FirmwareError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
resp = self.call(proto.FirmwareUpload(payload=fp.read()))
|
||||||
if isinstance(resp, proto.Success):
|
if isinstance(resp, proto.Success):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
elif isinstance(resp, proto.Failure) and resp.code == proto.Failure_FirmwareDataIncompatibility:
|
elif isinstance(resp, proto.Failure) and resp.code == proto.Failure_FirmwareError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
raise Exception("Unexpected result " % resp)
|
raise Exception("Unexpected result " % resp)
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user