2018-07-04 14:44:26 +00:00
|
|
|
syntax = "proto2";
|
2018-07-29 14:17:00 +00:00
|
|
|
package hw.trezor.messages.debug;
|
2018-07-04 14:44:26 +00:00
|
|
|
|
|
|
|
// Sugar for easier handling in Java
|
|
|
|
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
|
|
|
option java_outer_classname = "TrezorMessageDebug";
|
|
|
|
|
2021-09-27 22:42:28 +00:00
|
|
|
option (include_in_bitcoin_only) = true;
|
|
|
|
|
|
|
|
import "messages.proto";
|
2018-07-16 13:00:18 +00:00
|
|
|
import "messages-common.proto";
|
2021-05-31 13:09:15 +00:00
|
|
|
import "messages-management.proto";
|
2018-07-04 14:44:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: "Press" the button on the device
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2019-09-27 13:34:15 +00:00
|
|
|
* @next DebugLinkLayout
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkDecision {
|
2021-12-13 11:42:53 +00:00
|
|
|
optional DebugButton button = 1; // button press
|
2019-10-04 15:27:41 +00:00
|
|
|
optional DebugSwipeDirection swipe = 2; // swipe direction
|
2018-07-04 14:44:26 +00:00
|
|
|
optional string input = 3; // keyboard input
|
2019-10-04 15:27:41 +00:00
|
|
|
/**
|
|
|
|
* Structure representing swipe direction
|
|
|
|
*/
|
|
|
|
enum DebugSwipeDirection {
|
|
|
|
UP = 0;
|
|
|
|
DOWN = 1;
|
|
|
|
LEFT = 2;
|
|
|
|
RIGHT = 3;
|
|
|
|
}
|
2021-12-13 11:42:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Structure representing button presses
|
|
|
|
*/
|
|
|
|
enum DebugButton {
|
|
|
|
NO = 0;
|
|
|
|
YES = 1;
|
|
|
|
INFO = 2;
|
|
|
|
}
|
2019-09-27 13:34:15 +00:00
|
|
|
|
2023-05-12 09:19:35 +00:00
|
|
|
/**
|
|
|
|
* Structure representing model R button presses
|
|
|
|
*/
|
|
|
|
// TODO: probably delete the middle_btn as it is not a physical one
|
|
|
|
enum DebugPhysicalButton {
|
|
|
|
LEFT_BTN = 0;
|
|
|
|
MIDDLE_BTN = 1;
|
|
|
|
RIGHT_BTN = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
optional uint32 x = 4; // touch X coordinate
|
|
|
|
optional uint32 y = 5; // touch Y coordinate
|
|
|
|
optional bool wait = 6; // wait for layout change
|
|
|
|
optional uint32 hold_ms = 7; // touch hold duration
|
|
|
|
optional DebugPhysicalButton physical_button = 8; // physical button press
|
2019-09-27 13:34:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-05-04 12:25:43 +00:00
|
|
|
* Response: Device text layout as a list of tokens as returned by Rust
|
2019-09-27 13:34:15 +00:00
|
|
|
* @end
|
|
|
|
*/
|
|
|
|
message DebugLinkLayout {
|
2023-05-04 12:25:43 +00:00
|
|
|
repeated string tokens = 1;
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
2019-12-09 16:01:04 +00:00
|
|
|
/**
|
|
|
|
* Request: Re-seed RNG with given value
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message DebugLinkReseedRandom {
|
|
|
|
optional uint32 value = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Start or stop recording screen changes into given target directory
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message DebugLinkRecordScreen {
|
2023-03-30 10:46:19 +00:00
|
|
|
optional string target_directory = 1; // empty or missing to stop recording
|
|
|
|
optional uint32 refresh_index = 2 [default=0]; // which index to give the screenshots (after emulator restarts)
|
2019-12-09 16:01:04 +00:00
|
|
|
}
|
|
|
|
|
2018-07-04 14:44:26 +00:00
|
|
|
/**
|
|
|
|
* Request: Computer asks for device state
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-07-04 14:44:26 +00:00
|
|
|
* @next DebugLinkState
|
|
|
|
*/
|
|
|
|
message DebugLinkGetState {
|
2019-07-30 15:57:59 +00:00
|
|
|
optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown
|
|
|
|
optional bool wait_word_pos = 2; // Trezor T only - wait until reset word position is requested
|
2019-10-16 15:38:48 +00:00
|
|
|
optional bool wait_layout = 3; // wait until current layout changes
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device current state
|
2018-07-16 14:51:03 +00:00
|
|
|
* @end
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkState {
|
2018-07-29 14:17:00 +00:00
|
|
|
optional bytes layout = 1; // raw buffer of display
|
|
|
|
optional string pin = 2; // current PIN, blank if PIN is not set/enabled
|
|
|
|
optional string matrix = 3; // current PIN matrix
|
2019-03-07 13:53:08 +00:00
|
|
|
optional bytes mnemonic_secret = 4; // current mnemonic secret
|
2021-05-31 13:09:15 +00:00
|
|
|
optional common.HDNodeType node = 5; // current BIP-32 node
|
2018-07-29 14:17:00 +00:00
|
|
|
optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase?
|
|
|
|
optional string reset_word = 7; // word on device display during ResetDevice workflow
|
|
|
|
optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow
|
|
|
|
optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow
|
|
|
|
optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow
|
|
|
|
optional uint32 reset_word_pos = 11; // index of mnemonic word the device is expecting during ResetDevice workflow
|
2021-05-31 13:09:15 +00:00
|
|
|
optional management.BackupType mnemonic_type = 12; // current mnemonic type (BIP-39/SLIP-39)
|
2023-05-04 12:25:43 +00:00
|
|
|
repeated string tokens = 13; // current layout represented as a list of string tokens
|
2018-07-04 14:44:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Ask device to restart
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkStop {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device wants host to log event
|
2018-07-16 16:19:46 +00:00
|
|
|
* @ignore
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkLog {
|
|
|
|
optional uint32 level = 1;
|
|
|
|
optional string bucket = 2;
|
|
|
|
optional string text = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Read memory from device
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
2018-07-04 14:44:26 +00:00
|
|
|
* @next DebugLinkMemory
|
|
|
|
*/
|
|
|
|
message DebugLinkMemoryRead {
|
|
|
|
optional uint32 address = 1;
|
|
|
|
optional uint32 length = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Response: Device sends memory back
|
2018-07-16 14:51:03 +00:00
|
|
|
* @end
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkMemory {
|
|
|
|
optional bytes memory = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Write memory to device.
|
|
|
|
* WARNING: Writing to the wrong location can irreparably break the device.
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkMemoryWrite {
|
|
|
|
optional uint32 address = 1;
|
|
|
|
optional bytes memory = 2;
|
|
|
|
optional bool flash = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Erase block of flash on device
|
|
|
|
* WARNING: Writing to the wrong location can irreparably break the device.
|
2018-07-16 14:51:03 +00:00
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
2018-07-04 14:44:26 +00:00
|
|
|
*/
|
|
|
|
message DebugLinkFlashErase {
|
|
|
|
optional uint32 sector = 1;
|
|
|
|
}
|
2020-02-17 16:18:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Erase the SD card
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
* @next Failure
|
|
|
|
*/
|
|
|
|
message DebugLinkEraseSdCard {
|
|
|
|
optional bool format = 1; // if true, the card will be formatted to FAT32.
|
|
|
|
// if false, it will be all 0xFF bytes.
|
|
|
|
}
|
2020-05-22 13:38:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Start or stop tracking layout changes
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message DebugLinkWatchLayout {
|
|
|
|
optional bool watch = 1; // if true, start watching layout.
|
|
|
|
// if false, stop.
|
|
|
|
}
|
2023-05-04 12:25:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request: Remove all the previous debug event state
|
|
|
|
* @start
|
|
|
|
* @next Success
|
|
|
|
*/
|
|
|
|
message DebugLinkResetDebugEvents {
|
|
|
|
}
|