| 1 |
syntax = "proto2"; |
| 2 |
package hw.trezor.messages.debug; |
| 3 |
|
| 4 |
// Sugar for easier handling in Java |
| 5 |
option java_package = "com.satoshilabs.trezor.lib.protobuf"; |
| 6 |
option java_outer_classname = "TrezorMessageDebug"; |
| 7 |
|
| 8 |
import "messages-common.proto"; |
| 9 |
|
| 10 |
/** |
| 11 |
* Request: "Press" the button on the device |
| 12 |
* @start |
| 13 |
* @next DebugLinkLayout |
| 14 |
*/ |
| 15 |
message DebugLinkDecision { |
| 16 |
optional bool yes_no = 1; // true for "Confirm", false for "Cancel" |
| 17 |
optional DebugSwipeDirection swipe = 2; // swipe direction |
| 18 |
optional string input = 3; // keyboard input |
| 19 |
/** |
| 20 |
* Structure representing swipe direction |
| 21 |
*/ |
| 22 |
enum DebugSwipeDirection { |
| 23 |
UP = 0; |
| 24 |
DOWN = 1; |
| 25 |
LEFT = 2; |
| 26 |
RIGHT = 3; |
| 27 |
} |
| 28 |
|
| 29 |
optional uint32 x = 4; // touch X coordinate |
| 30 |
optional uint32 y = 5; // touch Y coordinate |
| 31 |
optional bool wait = 6; // wait for layout change |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Response: Device text layout |
| 36 |
* @end |
| 37 |
*/ |
| 38 |
message DebugLinkLayout { |
| 39 |
repeated string lines = 1; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Request: Re-seed RNG with given value |
| 44 |
* @start |
| 45 |
* @next Success |
| 46 |
*/ |
| 47 |
message DebugLinkReseedRandom { |
| 48 |
optional uint32 value = 1; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Request: Start or stop recording screen changes into given target directory |
| 53 |
* @start |
| 54 |
* @next Success |
| 55 |
*/ |
| 56 |
message DebugLinkRecordScreen { |
| 57 |
optional string target_directory = 1; // empty or missing to stop recording |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Request: Show text on the screen |
| 62 |
* @start |
| 63 |
* @next Success |
| 64 |
*/ |
| 65 |
message DebugLinkShowText { |
| 66 |
optional string header_text = 1; // screen header text |
| 67 |
repeated DebugLinkShowTextItem body_text = 2; // body text segments |
| 68 |
optional string header_icon = 3; // icon name in ui.style |
| 69 |
optional string icon_color = 4; // color name in ui.style |
| 70 |
|
| 71 |
message DebugLinkShowTextItem { |
| 72 |
optional DebugLinkShowTextStyle style = 1; |
| 73 |
optional string content = 2; |
| 74 |
} |
| 75 |
|
| 76 |
enum DebugLinkShowTextStyle { |
| 77 |
NORMAL = 0; |
| 78 |
BOLD = 1; |
| 79 |
MONO = 2; |
| 80 |
MONO_BOLD = 3; |
| 81 |
BR = 4; |
| 82 |
BR_HALF = 5; |
| 83 |
SET_COLOR = 6; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Request: Computer asks for device state |
| 89 |
* @start |
| 90 |
* @next DebugLinkState |
| 91 |
*/ |
| 92 |
message DebugLinkGetState { |
| 93 |
optional bool wait_word_list = 1; // Trezor T only - wait until mnemonic words are shown |
| 94 |
optional bool wait_word_pos = 2; // Trezor T only - wait until reset word position is requested |
| 95 |
optional bool wait_layout = 3; // wait until current layout changes |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Response: Device current state |
| 100 |
* @end |
| 101 |
*/ |
| 102 |
message DebugLinkState { |
| 103 |
optional bytes layout = 1; // raw buffer of display |
| 104 |
optional string pin = 2; // current PIN, blank if PIN is not set/enabled |
| 105 |
optional string matrix = 3; // current PIN matrix |
| 106 |
optional bytes mnemonic_secret = 4; // current mnemonic secret |
| 107 |
optional hw.trezor.messages.common.HDNodeType node = 5; // current BIP-32 node |
| 108 |
optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase? |
| 109 |
optional string reset_word = 7; // word on device display during ResetDevice workflow |
| 110 |
optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow |
| 111 |
optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow |
| 112 |
optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow |
| 113 |
optional uint32 reset_word_pos = 11; // index of mnemonic word the device is expecting during ResetDevice workflow |
| 114 |
optional uint32 mnemonic_type = 12; // current mnemonic type (BIP-39/SLIP-39) |
| 115 |
repeated string layout_lines = 13; // current layout text |
| 116 |
} |
| 117 |
|
| 118 |
/** |
| 119 |
* Request: Ask device to restart |
| 120 |
* @start |
| 121 |
*/ |
| 122 |
message DebugLinkStop { |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Response: Device wants host to log event |
| 127 |
* @ignore |
| 128 |
*/ |
| 129 |
message DebugLinkLog { |
| 130 |
optional uint32 level = 1; |
| 131 |
optional string bucket = 2; |
| 132 |
optional string text = 3; |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Request: Read memory from device |
| 137 |
* @start |
| 138 |
* @next DebugLinkMemory |
| 139 |
*/ |
| 140 |
message DebugLinkMemoryRead { |
| 141 |
optional uint32 address = 1; |
| 142 |
optional uint32 length = 2; |
| 143 |
} |
| 144 |
|
| 145 |
/** |
| 146 |
* Response: Device sends memory back |
| 147 |
* @end |
| 148 |
*/ |
| 149 |
message DebugLinkMemory { |
| 150 |
optional bytes memory = 1; |
| 151 |
} |
| 152 |
|
| 153 |
/** |
| 154 |
* Request: Write memory to device. |
| 155 |
* WARNING: Writing to the wrong location can irreparably break the device. |
| 156 |
* @start |
| 157 |
* @next Success |
| 158 |
* @next Failure |
| 159 |
*/ |
| 160 |
message DebugLinkMemoryWrite { |
| 161 |
optional uint32 address = 1; |
| 162 |
optional bytes memory = 2; |
| 163 |
optional bool flash = 3; |
| 164 |
} |
| 165 |
|
| 166 |
/** |
| 167 |
* Request: Erase block of flash on device |
| 168 |
* WARNING: Writing to the wrong location can irreparably break the device. |
| 169 |
* @start |
| 170 |
* @next Success |
| 171 |
* @next Failure |
| 172 |
*/ |
| 173 |
message DebugLinkFlashErase { |
| 174 |
optional uint32 sector = 1; |
| 175 |
} |
| 176 |
|
| 177 |
|
| 178 |
/** |
| 179 |
* Request: Erase the SD card |
| 180 |
* @start |
| 181 |
* @next Success |
| 182 |
* @next Failure |
| 183 |
*/ |
| 184 |
message DebugLinkEraseSdCard { |
| 185 |
optional bool format = 1; // if true, the card will be formatted to FAT32. |
| 186 |
// if false, it will be all 0xFF bytes. |
| 187 |
} |