From c01830462a8e5692da74c862f966596ab2c000c8 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 22 Oct 2013 11:29:33 +0200 Subject: [PATCH] add FirmwareErase message --- protobuf/trezor.proto | 10 ++- trezorlib/client.py | 8 +- trezorlib/trezor_pb2.py | 161 ++++++++++++++++++++++++---------------- 3 files changed, 110 insertions(+), 69 deletions(-) diff --git a/protobuf/trezor.proto b/protobuf/trezor.proto index 4243c2c..089a53a 100644 --- a/protobuf/trezor.proto +++ b/protobuf/trezor.proto @@ -18,7 +18,8 @@ enum MessageType { MessageType_Failure = 3; MessageType_ChangePin = 4; MessageType_WipeDevice = 5; - MessageType_FirmwareUpdate = 6; + MessageType_FirmwareErase = 6; + MessageType_FirmwareUpload = 7; MessageType_GetEntropy = 9; MessageType_Entropy = 10; MessageType_GetMasterPublicKey = 11; @@ -71,7 +72,7 @@ enum FailureType { Failure_PinExpected = 5; Failure_PinCancelled = 6; Failure_PinInvalid = 7; - Failure_FirmwareDataIncompatibility = 99; + Failure_FirmwareError = 99; } // Specifies which script will be used for given transaction output. @@ -349,7 +350,10 @@ message TxOutput { // Bootloader messages // -message FirmwareUpdate { +message FirmwareErase { +} + +message FirmwareUpload { required bytes payload = 1 [(binary) = true]; // Firmware to flash into device } diff --git a/trezorlib/client.py b/trezorlib/client.py index 2d45a94..b959373 100644 --- a/trezorlib/client.py +++ b/trezorlib/client.py @@ -264,11 +264,15 @@ class TrezorClient(object): if self.features.bootloader_mode == False: 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): 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 raise Exception("Unexpected result " % resp) diff --git a/trezorlib/trezor_pb2.py b/trezorlib/trezor_pb2.py index 4bbd820..8655b6d 100644 --- a/trezorlib/trezor_pb2.py +++ b/trezorlib/trezor_pb2.py @@ -15,7 +15,7 @@ import google.protobuf.descriptor_pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='trezor.proto', package='', - serialized_pb='\n\x0ctrezor.proto\x1a google/protobuf/descriptor.proto\"\x87\x01\n\x08XprvType\x12\x0f\n\x07version\x18\x01 \x02(\r\x12\r\n\x05\x64\x65pth\x18\x02 \x02(\r\x12\x13\n\x0b\x66ingerprint\x18\x03 \x02(\r\x12\x11\n\tchild_num\x18\x04 \x02(\r\x12\x18\n\nchain_code\x18\x05 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x19\n\x0bprivate_key\x18\x06 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"\x86\x01\n\x08XpubType\x12\x0f\n\x07version\x18\x01 \x02(\r\x12\r\n\x05\x64\x65pth\x18\x02 \x02(\r\x12\x13\n\x0b\x66ingerprint\x18\x03 \x02(\r\x12\x11\n\tchild_num\x18\x04 \x02(\r\x12\x18\n\nchain_code\x18\x05 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x18\n\npublic_key\x18\x06 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"]\n\x08\x43oinType\x12\x11\n\tcoin_name\x18\x01 \x01(\x0c\x12\x15\n\rcoin_shortcut\x18\x02 \x01(\x0c\x12\x14\n\x0c\x61\x64\x64ress_type\x18\x03 \x01(\r\x12\x11\n\tmaxfee_kb\x18\x04 \x01(\x04\"H\n\x0cSettingsType\x12\x10\n\x08language\x18\x01 \x01(\x0c\x12\x17\n\x04\x63oin\x18\x02 \x01(\x0b\x32\t.CoinType\x12\r\n\x05label\x18\x03 \x01(\x0c\"\x0c\n\nInitialize\"\xe3\x01\n\x08\x46\x65\x61tures\x12\x0e\n\x06vendor\x18\x01 \x01(\x0c\x12\x15\n\rmajor_version\x18\x02 \x01(\r\x12\x15\n\rminor_version\x18\x03 \x01(\r\x12\x16\n\x0e\x62ugfix_version\x18\x04 \x01(\r\x12\x17\n\x0f\x62ootloader_mode\x18\x05 \x01(\x08\x12\x1f\n\x08settings\x18\x06 \x01(\x0b\x32\r.SettingsType\x12\x17\n\tdevice_id\x18\x07 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x16\n\x08mpk_hash\x18\x08 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x16\n\x0epin_protection\x18\t \x01(\x08\"G\n\rApplySettings\x12\x10\n\x08language\x18\x01 \x01(\x0c\x12\x15\n\rcoin_shortcut\x18\x02 \x01(\x0c\x12\r\n\x05label\x18\x03 \x01(\x0c\"\x1b\n\tChangePin\x12\x0e\n\x06remove\x18\x01 \x01(\x08\"\x17\n\x04Ping\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"\x1a\n\x07Success\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"6\n\x07\x46\x61ilure\x12\x1a\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0c.FailureType\x12\x0f\n\x07message\x18\x02 \x01(\x0c\"\x0f\n\rButtonRequest\"\x0b\n\tButtonAck\"\x0e\n\x0c\x42uttonCancel\"#\n\x10PinMatrixRequest\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"\x1b\n\x0cPinMatrixAck\x12\x0b\n\x03pin\x18\x01 \x02(\x0c\"\x11\n\x0fPinMatrixCancel\"\x1a\n\nGetEntropy\x12\x0c\n\x04size\x18\x01 \x02(\r\" \n\x07\x45ntropy\x12\x15\n\x07\x65ntropy\x18\x01 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"\x14\n\x12GetMasterPublicKey\")\n\x0fMasterPublicKey\x12\x16\n\x03mpk\x18\x01 \x02(\x0b\x32\t.XpubType\"\x1f\n\nGetAddress\x12\x11\n\taddress_n\x18\x01 \x03(\r\"\x1a\n\x07\x41\x64\x64ress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x02(\x0c\"\x0c\n\nWipeDevice\"@\n\nLoadDevice\x12\x0c\n\x04seed\x18\x01 \x01(\x0c\x12\x17\n\x04xprv\x18\x02 \x01(\x0b\x32\t.XprvType\x12\x0b\n\x03pin\x18\x03 \x01(\x0c\"%\n\x0bResetDevice\x12\x16\n\x0e\x64isplay_random\x18\x01 \x01(\x08\"\x10\n\x0e\x45ntropyRequest\"#\n\nEntropyAck\x12\x15\n\x07\x65ntropy\x18\x01 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"5\n\x06SignTx\x12\x15\n\routputs_count\x18\x03 \x02(\r\x12\x14\n\x0cinputs_count\x18\x05 \x02(\r\"D\n\x0cSimpleSignTx\x12\x18\n\x06inputs\x18\x01 \x03(\x0b\x32\x08.TxInput\x12\x1a\n\x07outputs\x18\x02 \x03(\x0b\x32\t.TxOutput\"\x92\x01\n\tTxRequest\x12\x15\n\rrequest_index\x18\x01 \x01(\x05\x12\"\n\x0crequest_type\x18\x02 \x01(\x0e\x32\x0c.RequestType\x12\x14\n\x0csigned_index\x18\x03 \x01(\x05\x12\x17\n\tsignature\x18\x04 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x1b\n\rserialized_tx\x18\x05 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"\x82\x01\n\x07TxInput\x12\r\n\x05index\x18\x01 \x02(\r\x12\x11\n\taddress_n\x18\x02 \x03(\r\x12\x0e\n\x06\x61mount\x18\x03 \x02(\x04\x12\x17\n\tprev_hash\x18\x04 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x12\n\nprev_index\x18\x05 \x02(\r\x12\x18\n\nscript_sig\x18\x06 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"\x8a\x01\n\x08TxOutput\x12\r\n\x05index\x18\x01 \x02(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x02(\x0c\x12\x11\n\taddress_n\x18\x03 \x03(\r\x12\x0e\n\x06\x61mount\x18\x04 \x02(\x04\x12 \n\x0bscript_type\x18\x05 \x02(\x0e\x32\x0b.ScriptType\x12\x19\n\x0bscript_args\x18\x06 \x03(\x0c\x42\x04\x88\xb5\x18\x01\"\'\n\x0e\x46irmwareUpdate\x12\x15\n\x07payload\x18\x01 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"#\n\x11\x44\x65\x62ugLinkDecision\x12\x0e\n\x06yes_no\x18\x01 \x02(\x08\"N\n\x11\x44\x65\x62ugLinkGetState\x12\x0e\n\x06layout\x18\x01 \x01(\x08\x12\x0b\n\x03pin\x18\x02 \x01(\x08\x12\x0e\n\x06matrix\x18\x03 \x01(\x08\x12\x0c\n\x04seed\x18\x04 \x01(\x08\"Q\n\x0e\x44\x65\x62ugLinkState\x12\x14\n\x06layout\x18\x01 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x0b\n\x03pin\x18\x02 \x01(\x0c\x12\x0e\n\x06matrix\x18\x03 \x01(\x0c\x12\x0c\n\x04seed\x18\x04 \x01(\x0c\"\x0f\n\rDebugLinkStop*\xd3\x08\n\x0bMessageType\x12\x1a\n\x16MessageType_Initialize\x10\x00\x12\x14\n\x10MessageType_Ping\x10\x01\x12\x17\n\x13MessageType_Success\x10\x02\x12\x17\n\x13MessageType_Failure\x10\x03\x12\x19\n\x15MessageType_ChangePin\x10\x04\x12\x1a\n\x16MessageType_WipeDevice\x10\x05\x12\x1e\n\x1aMessageType_FirmwareUpdate\x10\x06\x12\x1a\n\x16MessageType_GetEntropy\x10\t\x12\x17\n\x13MessageType_Entropy\x10\n\x12\"\n\x1eMessageType_GetMasterPublicKey\x10\x0b\x12\x1f\n\x1bMessageType_MasterPublicKey\x10\x0c\x12\x1a\n\x16MessageType_LoadDevice\x10\r\x12\x1b\n\x17MessageType_ResetDevice\x10\x0e\x12\x16\n\x12MessageType_SignTx\x10\x0f\x12\x1c\n\x18MessageType_SimpleSignTx\x10\x10\x12\x18\n\x14MessageType_Features\x10\x11\x12 \n\x1cMessageType_PinMatrixRequest\x10\x12\x12\x1c\n\x18MessageType_PinMatrixAck\x10\x13\x12\x1f\n\x1bMessageType_PinMatrixCancel\x10\x14\x12\x19\n\x15MessageType_TxRequest\x10\x15\x12\x17\n\x13MessageType_TxInput\x10\x17\x12\x18\n\x14MessageType_TxOutput\x10\x18\x12\x1d\n\x19MessageType_ApplySettings\x10\x19\x12\x1d\n\x19MessageType_ButtonRequest\x10\x1a\x12\x19\n\x15MessageType_ButtonAck\x10\x1b\x12\x1c\n\x18MessageType_ButtonCancel\x10\x1c\x12\x1a\n\x16MessageType_GetAddress\x10\x1d\x12\x17\n\x13MessageType_Address\x10\x1e\x12\x1c\n\x18MessageType_SettingsType\x10\x1f\x12\x18\n\x14MessageType_XprvType\x10 \x12\x18\n\x14MessageType_CoinType\x10!\x12\x18\n\x14MessageType_XpubType\x10\"\x12\x1e\n\x1aMessageType_EntropyRequest\x10#\x12\x1a\n\x16MessageType_EntropyAck\x10$\x12!\n\x1dMessageType_DebugLinkDecision\x10\x64\x12!\n\x1dMessageType_DebugLinkGetState\x10\x65\x12\x1e\n\x1aMessageType_DebugLinkState\x10\x66\x12\x1d\n\x19MessageType_DebugLinkStop\x10g*\xf2\x01\n\x0b\x46\x61ilureType\x12\x1d\n\x19\x46\x61ilure_UnexpectedMessage\x10\x01\x12\x1a\n\x16\x46\x61ilure_ButtonExpected\x10\x02\x12\x17\n\x13\x46\x61ilure_SyntaxError\x10\x03\x12\x1b\n\x17\x46\x61ilure_ActionCancelled\x10\x04\x12\x17\n\x13\x46\x61ilure_PinExpected\x10\x05\x12\x18\n\x14\x46\x61ilure_PinCancelled\x10\x06\x12\x16\n\x12\x46\x61ilure_PinInvalid\x10\x07\x12\'\n#Failure_FirmwareDataIncompatibility\x10\x63*3\n\nScriptType\x12\x10\n\x0cPAYTOADDRESS\x10\x00\x12\x13\n\x0fPAYTOSCRIPTHASH\x10\x01*(\n\x0bRequestType\x12\x0b\n\x07TXINPUT\x10\x00\x12\x0c\n\x08TXOUTPUT\x10\x01:/\n\x06\x62inary\x12\x1d.google.protobuf.FieldOptions\x18\xd1\x86\x03 \x01(\x08') + serialized_pb='\n\x0ctrezor.proto\x1a google/protobuf/descriptor.proto\"\x87\x01\n\x08XprvType\x12\x0f\n\x07version\x18\x01 \x02(\r\x12\r\n\x05\x64\x65pth\x18\x02 \x02(\r\x12\x13\n\x0b\x66ingerprint\x18\x03 \x02(\r\x12\x11\n\tchild_num\x18\x04 \x02(\r\x12\x18\n\nchain_code\x18\x05 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x19\n\x0bprivate_key\x18\x06 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"\x86\x01\n\x08XpubType\x12\x0f\n\x07version\x18\x01 \x02(\r\x12\r\n\x05\x64\x65pth\x18\x02 \x02(\r\x12\x13\n\x0b\x66ingerprint\x18\x03 \x02(\r\x12\x11\n\tchild_num\x18\x04 \x02(\r\x12\x18\n\nchain_code\x18\x05 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x18\n\npublic_key\x18\x06 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"]\n\x08\x43oinType\x12\x11\n\tcoin_name\x18\x01 \x01(\x0c\x12\x15\n\rcoin_shortcut\x18\x02 \x01(\x0c\x12\x14\n\x0c\x61\x64\x64ress_type\x18\x03 \x01(\r\x12\x11\n\tmaxfee_kb\x18\x04 \x01(\x04\"H\n\x0cSettingsType\x12\x10\n\x08language\x18\x01 \x01(\x0c\x12\x17\n\x04\x63oin\x18\x02 \x01(\x0b\x32\t.CoinType\x12\r\n\x05label\x18\x03 \x01(\x0c\"\x0c\n\nInitialize\"\xe3\x01\n\x08\x46\x65\x61tures\x12\x0e\n\x06vendor\x18\x01 \x01(\x0c\x12\x15\n\rmajor_version\x18\x02 \x01(\r\x12\x15\n\rminor_version\x18\x03 \x01(\r\x12\x16\n\x0e\x62ugfix_version\x18\x04 \x01(\r\x12\x17\n\x0f\x62ootloader_mode\x18\x05 \x01(\x08\x12\x1f\n\x08settings\x18\x06 \x01(\x0b\x32\r.SettingsType\x12\x17\n\tdevice_id\x18\x07 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x16\n\x08mpk_hash\x18\x08 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x16\n\x0epin_protection\x18\t \x01(\x08\"G\n\rApplySettings\x12\x10\n\x08language\x18\x01 \x01(\x0c\x12\x15\n\rcoin_shortcut\x18\x02 \x01(\x0c\x12\r\n\x05label\x18\x03 \x01(\x0c\"\x1b\n\tChangePin\x12\x0e\n\x06remove\x18\x01 \x01(\x08\"\x17\n\x04Ping\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"\x1a\n\x07Success\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"6\n\x07\x46\x61ilure\x12\x1a\n\x04\x63ode\x18\x01 \x01(\x0e\x32\x0c.FailureType\x12\x0f\n\x07message\x18\x02 \x01(\x0c\"\x0f\n\rButtonRequest\"\x0b\n\tButtonAck\"\x0e\n\x0c\x42uttonCancel\"#\n\x10PinMatrixRequest\x12\x0f\n\x07message\x18\x01 \x01(\x0c\"\x1b\n\x0cPinMatrixAck\x12\x0b\n\x03pin\x18\x01 \x02(\x0c\"\x11\n\x0fPinMatrixCancel\"\x1a\n\nGetEntropy\x12\x0c\n\x04size\x18\x01 \x02(\r\" \n\x07\x45ntropy\x12\x15\n\x07\x65ntropy\x18\x01 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"\x14\n\x12GetMasterPublicKey\")\n\x0fMasterPublicKey\x12\x16\n\x03mpk\x18\x01 \x02(\x0b\x32\t.XpubType\"\x1f\n\nGetAddress\x12\x11\n\taddress_n\x18\x01 \x03(\r\"\x1a\n\x07\x41\x64\x64ress\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x02(\x0c\"\x0c\n\nWipeDevice\"@\n\nLoadDevice\x12\x0c\n\x04seed\x18\x01 \x01(\x0c\x12\x17\n\x04xprv\x18\x02 \x01(\x0b\x32\t.XprvType\x12\x0b\n\x03pin\x18\x03 \x01(\x0c\"%\n\x0bResetDevice\x12\x16\n\x0e\x64isplay_random\x18\x01 \x01(\x08\"\x10\n\x0e\x45ntropyRequest\"#\n\nEntropyAck\x12\x15\n\x07\x65ntropy\x18\x01 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"5\n\x06SignTx\x12\x15\n\routputs_count\x18\x03 \x02(\r\x12\x14\n\x0cinputs_count\x18\x05 \x02(\r\"D\n\x0cSimpleSignTx\x12\x18\n\x06inputs\x18\x01 \x03(\x0b\x32\x08.TxInput\x12\x1a\n\x07outputs\x18\x02 \x03(\x0b\x32\t.TxOutput\"\x92\x01\n\tTxRequest\x12\x15\n\rrequest_index\x18\x01 \x01(\x05\x12\"\n\x0crequest_type\x18\x02 \x01(\x0e\x32\x0c.RequestType\x12\x14\n\x0csigned_index\x18\x03 \x01(\x05\x12\x17\n\tsignature\x18\x04 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x1b\n\rserialized_tx\x18\x05 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"\x82\x01\n\x07TxInput\x12\r\n\x05index\x18\x01 \x02(\r\x12\x11\n\taddress_n\x18\x02 \x03(\r\x12\x0e\n\x06\x61mount\x18\x03 \x02(\x04\x12\x17\n\tprev_hash\x18\x04 \x02(\x0c\x42\x04\x88\xb5\x18\x01\x12\x12\n\nprev_index\x18\x05 \x02(\r\x12\x18\n\nscript_sig\x18\x06 \x01(\x0c\x42\x04\x88\xb5\x18\x01\"\x8a\x01\n\x08TxOutput\x12\r\n\x05index\x18\x01 \x02(\r\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x02(\x0c\x12\x11\n\taddress_n\x18\x03 \x03(\r\x12\x0e\n\x06\x61mount\x18\x04 \x02(\x04\x12 \n\x0bscript_type\x18\x05 \x02(\x0e\x32\x0b.ScriptType\x12\x19\n\x0bscript_args\x18\x06 \x03(\x0c\x42\x04\x88\xb5\x18\x01\"\x0f\n\rFirmwareErase\"\'\n\x0e\x46irmwareUpload\x12\x15\n\x07payload\x18\x01 \x02(\x0c\x42\x04\x88\xb5\x18\x01\"#\n\x11\x44\x65\x62ugLinkDecision\x12\x0e\n\x06yes_no\x18\x01 \x02(\x08\"N\n\x11\x44\x65\x62ugLinkGetState\x12\x0e\n\x06layout\x18\x01 \x01(\x08\x12\x0b\n\x03pin\x18\x02 \x01(\x08\x12\x0e\n\x06matrix\x18\x03 \x01(\x08\x12\x0c\n\x04seed\x18\x04 \x01(\x08\"Q\n\x0e\x44\x65\x62ugLinkState\x12\x14\n\x06layout\x18\x01 \x01(\x0c\x42\x04\x88\xb5\x18\x01\x12\x0b\n\x03pin\x18\x02 \x01(\x0c\x12\x0e\n\x06matrix\x18\x03 \x01(\x0c\x12\x0c\n\x04seed\x18\x04 \x01(\x0c\"\x0f\n\rDebugLinkStop*\xf2\x08\n\x0bMessageType\x12\x1a\n\x16MessageType_Initialize\x10\x00\x12\x14\n\x10MessageType_Ping\x10\x01\x12\x17\n\x13MessageType_Success\x10\x02\x12\x17\n\x13MessageType_Failure\x10\x03\x12\x19\n\x15MessageType_ChangePin\x10\x04\x12\x1a\n\x16MessageType_WipeDevice\x10\x05\x12\x1d\n\x19MessageType_FirmwareErase\x10\x06\x12\x1e\n\x1aMessageType_FirmwareUpload\x10\x07\x12\x1a\n\x16MessageType_GetEntropy\x10\t\x12\x17\n\x13MessageType_Entropy\x10\n\x12\"\n\x1eMessageType_GetMasterPublicKey\x10\x0b\x12\x1f\n\x1bMessageType_MasterPublicKey\x10\x0c\x12\x1a\n\x16MessageType_LoadDevice\x10\r\x12\x1b\n\x17MessageType_ResetDevice\x10\x0e\x12\x16\n\x12MessageType_SignTx\x10\x0f\x12\x1c\n\x18MessageType_SimpleSignTx\x10\x10\x12\x18\n\x14MessageType_Features\x10\x11\x12 \n\x1cMessageType_PinMatrixRequest\x10\x12\x12\x1c\n\x18MessageType_PinMatrixAck\x10\x13\x12\x1f\n\x1bMessageType_PinMatrixCancel\x10\x14\x12\x19\n\x15MessageType_TxRequest\x10\x15\x12\x17\n\x13MessageType_TxInput\x10\x17\x12\x18\n\x14MessageType_TxOutput\x10\x18\x12\x1d\n\x19MessageType_ApplySettings\x10\x19\x12\x1d\n\x19MessageType_ButtonRequest\x10\x1a\x12\x19\n\x15MessageType_ButtonAck\x10\x1b\x12\x1c\n\x18MessageType_ButtonCancel\x10\x1c\x12\x1a\n\x16MessageType_GetAddress\x10\x1d\x12\x17\n\x13MessageType_Address\x10\x1e\x12\x1c\n\x18MessageType_SettingsType\x10\x1f\x12\x18\n\x14MessageType_XprvType\x10 \x12\x18\n\x14MessageType_CoinType\x10!\x12\x18\n\x14MessageType_XpubType\x10\"\x12\x1e\n\x1aMessageType_EntropyRequest\x10#\x12\x1a\n\x16MessageType_EntropyAck\x10$\x12!\n\x1dMessageType_DebugLinkDecision\x10\x64\x12!\n\x1dMessageType_DebugLinkGetState\x10\x65\x12\x1e\n\x1aMessageType_DebugLinkState\x10\x66\x12\x1d\n\x19MessageType_DebugLinkStop\x10g*\xe4\x01\n\x0b\x46\x61ilureType\x12\x1d\n\x19\x46\x61ilure_UnexpectedMessage\x10\x01\x12\x1a\n\x16\x46\x61ilure_ButtonExpected\x10\x02\x12\x17\n\x13\x46\x61ilure_SyntaxError\x10\x03\x12\x1b\n\x17\x46\x61ilure_ActionCancelled\x10\x04\x12\x17\n\x13\x46\x61ilure_PinExpected\x10\x05\x12\x18\n\x14\x46\x61ilure_PinCancelled\x10\x06\x12\x16\n\x12\x46\x61ilure_PinInvalid\x10\x07\x12\x19\n\x15\x46\x61ilure_FirmwareError\x10\x63*3\n\nScriptType\x12\x10\n\x0cPAYTOADDRESS\x10\x00\x12\x13\n\x0fPAYTOSCRIPTHASH\x10\x01*(\n\x0bRequestType\x12\x0b\n\x07TXINPUT\x10\x00\x12\x0c\n\x08TXOUTPUT\x10\x01:/\n\x06\x62inary\x12\x1d.google.protobuf.FieldOptions\x18\xd1\x86\x03 \x01(\x08') _MESSAGETYPE = _descriptor.EnumDescriptor( name='MessageType', @@ -48,138 +48,142 @@ _MESSAGETYPE = _descriptor.EnumDescriptor( options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_FirmwareUpdate', index=6, number=6, + name='MessageType_FirmwareErase', index=6, number=6, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_GetEntropy', index=7, number=9, + name='MessageType_FirmwareUpload', index=7, number=7, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_Entropy', index=8, number=10, + name='MessageType_GetEntropy', index=8, number=9, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_GetMasterPublicKey', index=9, number=11, + name='MessageType_Entropy', index=9, number=10, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_MasterPublicKey', index=10, number=12, + name='MessageType_GetMasterPublicKey', index=10, number=11, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_LoadDevice', index=11, number=13, + name='MessageType_MasterPublicKey', index=11, number=12, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_ResetDevice', index=12, number=14, + name='MessageType_LoadDevice', index=12, number=13, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_SignTx', index=13, number=15, + name='MessageType_ResetDevice', index=13, number=14, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_SimpleSignTx', index=14, number=16, + name='MessageType_SignTx', index=14, number=15, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_Features', index=15, number=17, + name='MessageType_SimpleSignTx', index=15, number=16, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_PinMatrixRequest', index=16, number=18, + name='MessageType_Features', index=16, number=17, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_PinMatrixAck', index=17, number=19, + name='MessageType_PinMatrixRequest', index=17, number=18, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_PinMatrixCancel', index=18, number=20, + name='MessageType_PinMatrixAck', index=18, number=19, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_TxRequest', index=19, number=21, + name='MessageType_PinMatrixCancel', index=19, number=20, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_TxInput', index=20, number=23, + name='MessageType_TxRequest', index=20, number=21, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_TxOutput', index=21, number=24, + name='MessageType_TxInput', index=21, number=23, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_ApplySettings', index=22, number=25, + name='MessageType_TxOutput', index=22, number=24, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_ButtonRequest', index=23, number=26, + name='MessageType_ApplySettings', index=23, number=25, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_ButtonAck', index=24, number=27, + name='MessageType_ButtonRequest', index=24, number=26, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_ButtonCancel', index=25, number=28, + name='MessageType_ButtonAck', index=25, number=27, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_GetAddress', index=26, number=29, + name='MessageType_ButtonCancel', index=26, number=28, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_Address', index=27, number=30, + name='MessageType_GetAddress', index=27, number=29, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_SettingsType', index=28, number=31, + name='MessageType_Address', index=28, number=30, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_XprvType', index=29, number=32, + name='MessageType_SettingsType', index=29, number=31, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_CoinType', index=30, number=33, + name='MessageType_XprvType', index=30, number=32, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_XpubType', index=31, number=34, + name='MessageType_CoinType', index=31, number=33, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_EntropyRequest', index=32, number=35, + name='MessageType_XpubType', index=32, number=34, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_EntropyAck', index=33, number=36, + name='MessageType_EntropyRequest', index=33, number=35, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkDecision', index=34, number=100, + name='MessageType_EntropyAck', index=34, number=36, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkGetState', index=35, number=101, + name='MessageType_DebugLinkDecision', index=35, number=100, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkState', index=36, number=102, + name='MessageType_DebugLinkGetState', index=36, number=101, options=None, type=None), _descriptor.EnumValueDescriptor( - name='MessageType_DebugLinkStop', index=37, number=103, + name='MessageType_DebugLinkState', index=37, number=102, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MessageType_DebugLinkStop', index=38, number=103, options=None, type=None), ], containing_type=None, options=None, - serialized_start=2249, - serialized_end=3356, + serialized_start=2266, + serialized_end=3404, ) MessageType = enum_type_wrapper.EnumTypeWrapper(_MESSAGETYPE) @@ -218,14 +222,14 @@ _FAILURETYPE = _descriptor.EnumDescriptor( options=None, type=None), _descriptor.EnumValueDescriptor( - name='Failure_FirmwareDataIncompatibility', index=7, number=99, + name='Failure_FirmwareError', index=7, number=99, options=None, type=None), ], containing_type=None, options=None, - serialized_start=3359, - serialized_end=3601, + serialized_start=3407, + serialized_end=3635, ) FailureType = enum_type_wrapper.EnumTypeWrapper(_FAILURETYPE) @@ -246,8 +250,8 @@ _SCRIPTTYPE = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=3603, - serialized_end=3654, + serialized_start=3637, + serialized_end=3688, ) ScriptType = enum_type_wrapper.EnumTypeWrapper(_SCRIPTTYPE) @@ -268,8 +272,8 @@ _REQUESTTYPE = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=3656, - serialized_end=3696, + serialized_start=3690, + serialized_end=3730, ) RequestType = enum_type_wrapper.EnumTypeWrapper(_REQUESTTYPE) @@ -279,7 +283,8 @@ MessageType_Success = 2 MessageType_Failure = 3 MessageType_ChangePin = 4 MessageType_WipeDevice = 5 -MessageType_FirmwareUpdate = 6 +MessageType_FirmwareErase = 6 +MessageType_FirmwareUpload = 7 MessageType_GetEntropy = 9 MessageType_Entropy = 10 MessageType_GetMasterPublicKey = 11 @@ -318,7 +323,7 @@ Failure_ActionCancelled = 4 Failure_PinExpected = 5 Failure_PinCancelled = 6 Failure_PinInvalid = 7 -Failure_FirmwareDataIncompatibility = 99 +Failure_FirmwareError = 99 PAYTOADDRESS = 0 PAYTOSCRIPTHASH = 1 TXINPUT = 0 @@ -1510,15 +1515,36 @@ _TXOUTPUT = _descriptor.Descriptor( ) -_FIRMWAREUPDATE = _descriptor.Descriptor( - name='FirmwareUpdate', - full_name='FirmwareUpdate', +_FIRMWAREERASE = _descriptor.Descriptor( + name='FirmwareErase', + full_name='FirmwareErase', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=1990, + serialized_end=2005, +) + + +_FIRMWAREUPLOAD = _descriptor.Descriptor( + name='FirmwareUpload', + full_name='FirmwareUpload', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='payload', full_name='FirmwareUpdate.payload', index=0, + name='payload', full_name='FirmwareUpload.payload', index=0, number=1, type=12, cpp_type=9, label=2, has_default_value=False, default_value="", message_type=None, enum_type=None, containing_type=None, @@ -1533,8 +1559,8 @@ _FIRMWAREUPDATE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=1990, - serialized_end=2029, + serialized_start=2007, + serialized_end=2046, ) @@ -1561,8 +1587,8 @@ _DEBUGLINKDECISION = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2031, - serialized_end=2066, + serialized_start=2048, + serialized_end=2083, ) @@ -1610,8 +1636,8 @@ _DEBUGLINKGETSTATE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2068, - serialized_end=2146, + serialized_start=2085, + serialized_end=2163, ) @@ -1659,8 +1685,8 @@ _DEBUGLINKSTATE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2148, - serialized_end=2229, + serialized_start=2165, + serialized_end=2246, ) @@ -1680,8 +1706,8 @@ _DEBUGLINKSTOP = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=2231, - serialized_end=2246, + serialized_start=2248, + serialized_end=2263, ) _SETTINGSTYPE.fields_by_name['coin'].message_type = _COINTYPE @@ -1726,7 +1752,8 @@ DESCRIPTOR.message_types_by_name['SimpleSignTx'] = _SIMPLESIGNTX DESCRIPTOR.message_types_by_name['TxRequest'] = _TXREQUEST DESCRIPTOR.message_types_by_name['TxInput'] = _TXINPUT DESCRIPTOR.message_types_by_name['TxOutput'] = _TXOUTPUT -DESCRIPTOR.message_types_by_name['FirmwareUpdate'] = _FIRMWAREUPDATE +DESCRIPTOR.message_types_by_name['FirmwareErase'] = _FIRMWAREERASE +DESCRIPTOR.message_types_by_name['FirmwareUpload'] = _FIRMWAREUPLOAD DESCRIPTOR.message_types_by_name['DebugLinkDecision'] = _DEBUGLINKDECISION DESCRIPTOR.message_types_by_name['DebugLinkGetState'] = _DEBUGLINKGETSTATE DESCRIPTOR.message_types_by_name['DebugLinkState'] = _DEBUGLINKSTATE @@ -1930,11 +1957,17 @@ class TxOutput(_message.Message): # @@protoc_insertion_point(class_scope:TxOutput) -class FirmwareUpdate(_message.Message): +class FirmwareErase(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType - DESCRIPTOR = _FIRMWAREUPDATE + DESCRIPTOR = _FIRMWAREERASE - # @@protoc_insertion_point(class_scope:FirmwareUpdate) + # @@protoc_insertion_point(class_scope:FirmwareErase) + +class FirmwareUpload(_message.Message): + __metaclass__ = _reflection.GeneratedProtocolMessageType + DESCRIPTOR = _FIRMWAREUPLOAD + + # @@protoc_insertion_point(class_scope:FirmwareUpload) class DebugLinkDecision(_message.Message): __metaclass__ = _reflection.GeneratedProtocolMessageType @@ -1988,8 +2021,8 @@ _TXINPUT.fields_by_name['script_sig'].has_options = True _TXINPUT.fields_by_name['script_sig']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\210\265\030\001') _TXOUTPUT.fields_by_name['script_args'].has_options = True _TXOUTPUT.fields_by_name['script_args']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\210\265\030\001') -_FIRMWAREUPDATE.fields_by_name['payload'].has_options = True -_FIRMWAREUPDATE.fields_by_name['payload']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\210\265\030\001') +_FIRMWAREUPLOAD.fields_by_name['payload'].has_options = True +_FIRMWAREUPLOAD.fields_by_name['payload']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\210\265\030\001') _DEBUGLINKSTATE.fields_by_name['layout'].has_options = True _DEBUGLINKSTATE.fields_by_name['layout']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), '\210\265\030\001') # @@protoc_insertion_point(module_scope)