fixup! feat(core): expose flash area API to Python

pull/3565/head
matejcik 3 months ago
parent fa4321f112
commit 98c9893b3e

@ -135,13 +135,13 @@ message DebugLinkLog {
* Location in the flash memory.enum * Location in the flash memory.enum
* @embed * @embed
*/ */
message FlashMemoryLocation { message DebugFlashMemoryLocation {
/// Selector of the area /// Selector of the area
required FlashArea area = 1; required DebugFlashArea area = 1;
/// Offset from area start /// Offset from area start
required uint32 offset = 2; required uint32 offset = 2;
enum FlashArea { enum DebugFlashArea {
Boardloader = 0; Boardloader = 0;
Bootloader = 1; Bootloader = 1;
StorageA = 2; StorageA = 2;
@ -170,7 +170,7 @@ message DebugLinkMemoryRead {
*/ */
message DebugLinkFlashRead { message DebugLinkFlashRead {
/// Flash memory location /// Flash memory location
required FlashMemoryLocation location = 1; required DebugFlashMemoryLocation location = 1;
/// Length of the memory to read. If unspecified, the whole area is read. /// Length of the memory to read. If unspecified, the whole area is read.
optional uint32 length = 2; optional uint32 length = 2;
/// If true, only the hash of the memory contents will be returned. /// If true, only the hash of the memory contents will be returned.
@ -211,7 +211,7 @@ message DebugLinkMemoryWrite {
*/ */
message DebugLinkFlashWrite { message DebugLinkFlashWrite {
/// Flash memory location /// Flash memory location
required FlashMemoryLocation location = 1; required DebugFlashMemoryLocation location = 1;
/// Contents of the memory to flash. /// Contents of the memory to flash.
required bytes memory = 2; required bytes memory = 2;
} }
@ -238,7 +238,7 @@ message DebugLinkFlashEraseLegacy {
*/ */
message DebugLinkFlashErase { message DebugLinkFlashErase {
/// Flash memory location /// Flash memory location
required FlashMemoryLocation location = 1; required DebugFlashMemoryLocation location = 1;
/// Erase whole area or just the sector at the given offset. /// Erase whole area or just the sector at the given offset.
/// If the offset is not a start of a sector, error is returned. /// If the offset is not a start of a sector, error is returned.
optional bool whole_area = 2 [default = false]; optional bool whole_area = 2 [default = false];

@ -53,8 +53,8 @@ class FlashArea:
Computes a Blake2s hash of a segment of the flash area. Computes a Blake2s hash of a segment of the flash area.
Offset and length must be aligned to 1024 bytes. Offset and length must be aligned to 1024 bytes.
An optional challenge can be used as the Blake2s key. An optional challenge can be used as the Blake2s key.
The progress callback will be invoked every 16 kB with the current The progress callback will be invoked every 16 kB with the number of
position. bytes processed so far.
""" """
if __debug__: if __debug__:
def read(self, offset: int, data: bytearray) -> None: def read(self, offset: int, data: bytearray) -> None:

@ -101,6 +101,8 @@ trezor.enums.Capability
import trezor.enums.Capability import trezor.enums.Capability
trezor.enums.DebugButton trezor.enums.DebugButton
import trezor.enums.DebugButton import trezor.enums.DebugButton
trezor.enums.DebugFlashArea
import trezor.enums.DebugFlashArea
trezor.enums.DebugPhysicalButton trezor.enums.DebugPhysicalButton
import trezor.enums.DebugPhysicalButton import trezor.enums.DebugPhysicalButton
trezor.enums.DebugSwipeDirection trezor.enums.DebugSwipeDirection
@ -109,8 +111,6 @@ trezor.enums.DecredStakingSpendType
import trezor.enums.DecredStakingSpendType import trezor.enums.DecredStakingSpendType
trezor.enums.FailureType trezor.enums.FailureType
import trezor.enums.FailureType import trezor.enums.FailureType
trezor.enums.FlashArea
import trezor.enums.FlashArea
trezor.enums.HomescreenFormat trezor.enums.HomescreenFormat
import trezor.enums.HomescreenFormat import trezor.enums.HomescreenFormat
trezor.enums.InputScriptType trezor.enums.InputScriptType

@ -10,7 +10,7 @@ if __debug__:
from storage import debug as storage from storage import debug as storage
from storage.debug import debug_events from storage.debug import debug_events
from trezor import io, log, loop, utils, wire from trezor import io, log, loop, utils, wire
from trezor.enums import FlashArea, MessageType from trezor.enums import DebugFlashArea, MessageType
from trezor.messages import DebugLinkLayout, DebugLinkMemory, Success from trezor.messages import DebugLinkLayout, DebugLinkMemory, Success
from trezor.ui import display from trezor.ui import display
from trezor.wire import context from trezor.wire import context
@ -263,18 +263,18 @@ if __debug__:
sdcard.power_off() sdcard.power_off()
return Success() return Success()
def get_flash_area(area: FlashArea) -> io.FlashArea: def get_flash_area(area: DebugFlashArea) -> io.FlashArea:
if area == FlashArea.Boardloader: if area == DebugFlashArea.Boardloader:
return io.flash_area.BOARDLOADER return io.flash_area.BOARDLOADER
if area == FlashArea.Bootloader: if area == DebugFlashArea.Bootloader:
return io.flash_area.BOOTLOADER return io.flash_area.BOOTLOADER
if area == FlashArea.Firmware: if area == DebugFlashArea.Firmware:
return io.flash_area.FIRMWARE return io.flash_area.FIRMWARE
if area == FlashArea.StorageA: if area == DebugFlashArea.StorageA:
return io.flash_area.STORAGE_A return io.flash_area.STORAGE_A
if area == FlashArea.StorageB: if area == DebugFlashArea.StorageB:
return io.flash_area.STORAGE_B return io.flash_area.STORAGE_B
if area == FlashArea.Translations: if area == DebugFlashArea.Translations:
return io.flash_area.TRANSLATIONS return io.flash_area.TRANSLATIONS
raise ValueError raise ValueError

@ -485,7 +485,7 @@ if TYPE_CHECKING:
MIDDLE_BTN = 1 MIDDLE_BTN = 1
RIGHT_BTN = 2 RIGHT_BTN = 2
class FlashArea(IntEnum): class DebugFlashArea(IntEnum):
Boardloader = 0 Boardloader = 0
Bootloader = 1 Bootloader = 1
StorageA = 2 StorageA = 2

@ -36,13 +36,13 @@ if TYPE_CHECKING:
from trezor.enums import CardanoTxSigningMode # noqa: F401 from trezor.enums import CardanoTxSigningMode # noqa: F401
from trezor.enums import CardanoTxWitnessType # noqa: F401 from trezor.enums import CardanoTxWitnessType # noqa: F401
from trezor.enums import DebugButton # noqa: F401 from trezor.enums import DebugButton # noqa: F401
from trezor.enums import DebugFlashArea # noqa: F401
from trezor.enums import DebugPhysicalButton # noqa: F401 from trezor.enums import DebugPhysicalButton # noqa: F401
from trezor.enums import DebugSwipeDirection # noqa: F401 from trezor.enums import DebugSwipeDirection # noqa: F401
from trezor.enums import DecredStakingSpendType # noqa: F401 from trezor.enums import DecredStakingSpendType # noqa: F401
from trezor.enums import EthereumDataType # noqa: F401 from trezor.enums import EthereumDataType # noqa: F401
from trezor.enums import EthereumDefinitionType # noqa: F401 from trezor.enums import EthereumDefinitionType # noqa: F401
from trezor.enums import FailureType # noqa: F401 from trezor.enums import FailureType # noqa: F401
from trezor.enums import FlashArea # noqa: F401
from trezor.enums import HomescreenFormat # noqa: F401 from trezor.enums import HomescreenFormat # noqa: F401
from trezor.enums import InputScriptType # noqa: F401 from trezor.enums import InputScriptType # noqa: F401
from trezor.enums import MessageType # noqa: F401 from trezor.enums import MessageType # noqa: F401
@ -2892,31 +2892,31 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkLog"]: def is_type_of(cls, msg: Any) -> TypeGuard["DebugLinkLog"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class FlashMemoryLocation(protobuf.MessageType): class DebugFlashMemoryLocation(protobuf.MessageType):
area: "FlashArea" area: "DebugFlashArea"
offset: "int" offset: "int"
def __init__( def __init__(
self, self,
*, *,
area: "FlashArea", area: "DebugFlashArea",
offset: "int", offset: "int",
) -> None: ) -> None:
pass pass
@classmethod @classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["FlashMemoryLocation"]: def is_type_of(cls, msg: Any) -> TypeGuard["DebugFlashMemoryLocation"]:
return isinstance(msg, cls) return isinstance(msg, cls)
class DebugLinkFlashRead(protobuf.MessageType): class DebugLinkFlashRead(protobuf.MessageType):
location: "FlashMemoryLocation" location: "DebugFlashMemoryLocation"
length: "int | None" length: "int | None"
hashed: "bool" hashed: "bool"
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
length: "int | None" = None, length: "int | None" = None,
hashed: "bool | None" = None, hashed: "bool | None" = None,
) -> None: ) -> None:
@ -2943,13 +2943,13 @@ if TYPE_CHECKING:
return isinstance(msg, cls) return isinstance(msg, cls)
class DebugLinkFlashWrite(protobuf.MessageType): class DebugLinkFlashWrite(protobuf.MessageType):
location: "FlashMemoryLocation" location: "DebugFlashMemoryLocation"
memory: "bytes" memory: "bytes"
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
memory: "bytes", memory: "bytes",
) -> None: ) -> None:
pass pass
@ -2959,13 +2959,13 @@ if TYPE_CHECKING:
return isinstance(msg, cls) return isinstance(msg, cls)
class DebugLinkFlashErase(protobuf.MessageType): class DebugLinkFlashErase(protobuf.MessageType):
location: "FlashMemoryLocation" location: "DebugFlashMemoryLocation"
whole_area: "bool" whole_area: "bool"
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
whole_area: "bool | None" = None, whole_area: "bool | None" = None,
) -> None: ) -> None:
pass pass

@ -716,31 +716,31 @@ class DebugLink:
@expect(messages.DebugLinkMemory, field="memory", ret_type=bytes) @expect(messages.DebugLinkMemory, field="memory", ret_type=bytes)
def flash_read( def flash_read(
self, area: messages.FlashArea, offset: int = 0, length: int | None = None self, area: messages.DebugFlashArea, offset: int = 0, length: int | None = None
) -> protobuf.MessageType: ) -> protobuf.MessageType:
location = messages.FlashMemoryLocation(area=area, offset=offset) location = messages.DebugFlashMemoryLocation(area=area, offset=offset)
return self._call(messages.DebugLinkFlashRead(location=location, length=length)) return self._call(messages.DebugLinkFlashRead(location=location, length=length))
@expect(messages.DebugLinkMemory, field="hash", ret_type=bytes) @expect(messages.DebugLinkMemory, field="hash", ret_type=bytes)
def flash_hash( def flash_hash(
self, area: messages.FlashArea, offset: int = 0, length: int | None = None self, area: messages.DebugFlashArea, offset: int = 0, length: int | None = None
) -> protobuf.MessageType: ) -> protobuf.MessageType:
location = messages.FlashMemoryLocation(area=area, offset=offset) location = messages.DebugFlashMemoryLocation(area=area, offset=offset)
return self._call( return self._call(
messages.DebugLinkFlashRead(location=location, length=length, hashed=True) messages.DebugLinkFlashRead(location=location, length=length, hashed=True)
) )
def flash_erase(self, area: messages.FlashArea, offset: int) -> None: def flash_erase(self, area: messages.DebugFlashArea, offset: int) -> None:
location = messages.FlashMemoryLocation(area=area, offset=offset) location = messages.DebugFlashMemoryLocation(area=area, offset=offset)
self._call(messages.DebugLinkFlashErase(location=location, whole_area=False)) self._call(messages.DebugLinkFlashErase(location=location, whole_area=False))
def flash_erase_area(self, area: messages.FlashArea) -> None: def flash_erase_area(self, area: messages.DebugFlashArea) -> None:
location = messages.FlashMemoryLocation(area=area, offset=0) location = messages.DebugFlashMemoryLocation(area=area, offset=0)
self._call(messages.DebugLinkFlashErase(location=location, whole_area=True)) self._call(messages.DebugLinkFlashErase(location=location, whole_area=True))
def storage_hash(self) -> bytes: def storage_hash(self) -> bytes:
storage_hash_a = self.flash_hash(messages.FlashArea.StorageA) storage_hash_a = self.flash_hash(messages.DebugFlashArea.StorageA)
storage_hash_b = self.flash_hash(messages.FlashArea.StorageB) storage_hash_b = self.flash_hash(messages.DebugFlashArea.StorageB)
return storage_hash_a + storage_hash_b return storage_hash_a + storage_hash_b
@expect(messages.Success) @expect(messages.Success)

@ -524,7 +524,7 @@ class DebugPhysicalButton(IntEnum):
RIGHT_BTN = 2 RIGHT_BTN = 2
class FlashArea(IntEnum): class DebugFlashArea(IntEnum):
Boardloader = 0 Boardloader = 0
Bootloader = 1 Bootloader = 1
StorageA = 2 StorageA = 2
@ -4078,17 +4078,17 @@ class DebugLinkLog(protobuf.MessageType):
self.text = text self.text = text
class FlashMemoryLocation(protobuf.MessageType): class DebugFlashMemoryLocation(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None MESSAGE_WIRE_TYPE = None
FIELDS = { FIELDS = {
1: protobuf.Field("area", "FlashArea", repeated=False, required=True), 1: protobuf.Field("area", "DebugFlashArea", repeated=False, required=True),
2: protobuf.Field("offset", "uint32", repeated=False, required=True), 2: protobuf.Field("offset", "uint32", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
area: "FlashArea", area: "DebugFlashArea",
offset: "int", offset: "int",
) -> None: ) -> None:
self.area = area self.area = area
@ -4115,7 +4115,7 @@ class DebugLinkMemoryRead(protobuf.MessageType):
class DebugLinkFlashRead(protobuf.MessageType): class DebugLinkFlashRead(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9008 MESSAGE_WIRE_TYPE = 9008
FIELDS = { FIELDS = {
1: protobuf.Field("location", "FlashMemoryLocation", repeated=False, required=True), 1: protobuf.Field("location", "DebugFlashMemoryLocation", repeated=False, required=True),
2: protobuf.Field("length", "uint32", repeated=False, required=False, default=None), 2: protobuf.Field("length", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("hashed", "bool", repeated=False, required=False, default=False), 3: protobuf.Field("hashed", "bool", repeated=False, required=False, default=False),
} }
@ -4123,7 +4123,7 @@ class DebugLinkFlashRead(protobuf.MessageType):
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
length: Optional["int"] = None, length: Optional["int"] = None,
hashed: Optional["bool"] = False, hashed: Optional["bool"] = False,
) -> None: ) -> None:
@ -4172,14 +4172,14 @@ class DebugLinkMemoryWrite(protobuf.MessageType):
class DebugLinkFlashWrite(protobuf.MessageType): class DebugLinkFlashWrite(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9009 MESSAGE_WIRE_TYPE = 9009
FIELDS = { FIELDS = {
1: protobuf.Field("location", "FlashMemoryLocation", repeated=False, required=True), 1: protobuf.Field("location", "DebugFlashMemoryLocation", repeated=False, required=True),
2: protobuf.Field("memory", "bytes", repeated=False, required=True), 2: protobuf.Field("memory", "bytes", repeated=False, required=True),
} }
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
memory: "bytes", memory: "bytes",
) -> None: ) -> None:
self.location = location self.location = location
@ -4203,14 +4203,14 @@ class DebugLinkFlashEraseLegacy(protobuf.MessageType):
class DebugLinkFlashErase(protobuf.MessageType): class DebugLinkFlashErase(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 9010 MESSAGE_WIRE_TYPE = 9010
FIELDS = { FIELDS = {
1: protobuf.Field("location", "FlashMemoryLocation", repeated=False, required=True), 1: protobuf.Field("location", "DebugFlashMemoryLocation", repeated=False, required=True),
2: protobuf.Field("whole_area", "bool", repeated=False, required=False, default=False), 2: protobuf.Field("whole_area", "bool", repeated=False, required=False, default=False),
} }
def __init__( def __init__(
self, self,
*, *,
location: "FlashMemoryLocation", location: "DebugFlashMemoryLocation",
whole_area: Optional["bool"] = False, whole_area: Optional["bool"] = False,
) -> None: ) -> None:
self.location = location self.location = location

@ -2360,36 +2360,36 @@ impl ::protobuf::reflect::ProtobufValue for DebugLinkLog {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
// @@protoc_insertion_point(message:hw.trezor.messages.debug.FlashMemoryLocation) // @@protoc_insertion_point(message:hw.trezor.messages.debug.DebugFlashMemoryLocation)
#[derive(PartialEq,Clone,Default,Debug)] #[derive(PartialEq,Clone,Default,Debug)]
pub struct FlashMemoryLocation { pub struct DebugFlashMemoryLocation {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.debug.FlashMemoryLocation.area) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugFlashMemoryLocation.area)
pub area: ::std::option::Option<::protobuf::EnumOrUnknown<flash_memory_location::FlashArea>>, pub area: ::std::option::Option<::protobuf::EnumOrUnknown<debug_flash_memory_location::DebugFlashArea>>,
// @@protoc_insertion_point(field:hw.trezor.messages.debug.FlashMemoryLocation.offset) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugFlashMemoryLocation.offset)
pub offset: ::std::option::Option<u32>, pub offset: ::std::option::Option<u32>,
// special fields // special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.debug.FlashMemoryLocation.special_fields) // @@protoc_insertion_point(special_field:hw.trezor.messages.debug.DebugFlashMemoryLocation.special_fields)
pub special_fields: ::protobuf::SpecialFields, pub special_fields: ::protobuf::SpecialFields,
} }
impl<'a> ::std::default::Default for &'a FlashMemoryLocation { impl<'a> ::std::default::Default for &'a DebugFlashMemoryLocation {
fn default() -> &'a FlashMemoryLocation { fn default() -> &'a DebugFlashMemoryLocation {
<FlashMemoryLocation as ::protobuf::Message>::default_instance() <DebugFlashMemoryLocation as ::protobuf::Message>::default_instance()
} }
} }
impl FlashMemoryLocation { impl DebugFlashMemoryLocation {
pub fn new() -> FlashMemoryLocation { pub fn new() -> DebugFlashMemoryLocation {
::std::default::Default::default() ::std::default::Default::default()
} }
// required .hw.trezor.messages.debug.FlashMemoryLocation.FlashArea area = 1; // required .hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea area = 1;
pub fn area(&self) -> flash_memory_location::FlashArea { pub fn area(&self) -> debug_flash_memory_location::DebugFlashArea {
match self.area { match self.area {
Some(e) => e.enum_value_or(flash_memory_location::FlashArea::Boardloader), Some(e) => e.enum_value_or(debug_flash_memory_location::DebugFlashArea::Boardloader),
None => flash_memory_location::FlashArea::Boardloader, None => debug_flash_memory_location::DebugFlashArea::Boardloader,
} }
} }
@ -2402,7 +2402,7 @@ impl FlashMemoryLocation {
} }
// Param is passed by value, moved // Param is passed by value, moved
pub fn set_area(&mut self, v: flash_memory_location::FlashArea) { pub fn set_area(&mut self, v: debug_flash_memory_location::DebugFlashArea) {
self.area = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); self.area = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v));
} }
@ -2430,24 +2430,24 @@ impl FlashMemoryLocation {
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"area", "area",
|m: &FlashMemoryLocation| { &m.area }, |m: &DebugFlashMemoryLocation| { &m.area },
|m: &mut FlashMemoryLocation| { &mut m.area }, |m: &mut DebugFlashMemoryLocation| { &mut m.area },
)); ));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"offset", "offset",
|m: &FlashMemoryLocation| { &m.offset }, |m: &DebugFlashMemoryLocation| { &m.offset },
|m: &mut FlashMemoryLocation| { &mut m.offset }, |m: &mut DebugFlashMemoryLocation| { &mut m.offset },
)); ));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<FlashMemoryLocation>( ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<DebugFlashMemoryLocation>(
"FlashMemoryLocation", "DebugFlashMemoryLocation",
fields, fields,
oneofs, oneofs,
) )
} }
} }
impl ::protobuf::Message for FlashMemoryLocation { impl ::protobuf::Message for DebugFlashMemoryLocation {
const NAME: &'static str = "FlashMemoryLocation"; const NAME: &'static str = "DebugFlashMemoryLocation";
fn is_initialized(&self) -> bool { fn is_initialized(&self) -> bool {
if self.area.is_none() { if self.area.is_none() {
@ -2510,8 +2510,8 @@ impl ::protobuf::Message for FlashMemoryLocation {
&mut self.special_fields &mut self.special_fields
} }
fn new() -> FlashMemoryLocation { fn new() -> DebugFlashMemoryLocation {
FlashMemoryLocation::new() DebugFlashMemoryLocation::new()
} }
fn clear(&mut self) { fn clear(&mut self) {
@ -2520,8 +2520,8 @@ impl ::protobuf::Message for FlashMemoryLocation {
self.special_fields.clear(); self.special_fields.clear();
} }
fn default_instance() -> &'static FlashMemoryLocation { fn default_instance() -> &'static DebugFlashMemoryLocation {
static instance: FlashMemoryLocation = FlashMemoryLocation { static instance: DebugFlashMemoryLocation = DebugFlashMemoryLocation {
area: ::std::option::Option::None, area: ::std::option::Option::None,
offset: ::std::option::Option::None, offset: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(), special_fields: ::protobuf::SpecialFields::new(),
@ -2530,92 +2530,87 @@ impl ::protobuf::Message for FlashMemoryLocation {
} }
} }
impl ::protobuf::MessageFull for FlashMemoryLocation { impl ::protobuf::MessageFull for DebugFlashMemoryLocation {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor { fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("FlashMemoryLocation").unwrap()).clone() descriptor.get(|| file_descriptor().message_by_package_relative_name("DebugFlashMemoryLocation").unwrap()).clone()
} }
} }
impl ::std::fmt::Display for FlashMemoryLocation { impl ::std::fmt::Display for DebugFlashMemoryLocation {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f) ::protobuf::text_format::fmt(self, f)
} }
} }
impl ::protobuf::reflect::ProtobufValue for FlashMemoryLocation { impl ::protobuf::reflect::ProtobufValue for DebugFlashMemoryLocation {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>; type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
} }
/// Nested message and enums of message `FlashMemoryLocation` /// Nested message and enums of message `DebugFlashMemoryLocation`
pub mod flash_memory_location { pub mod debug_flash_memory_location {
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea) // @@protoc_insertion_point(enum:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea)
pub enum FlashArea { pub enum DebugFlashArea {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.Boardloader) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.Boardloader)
Boardloader = 0, Boardloader = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.Bootloader) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.Bootloader)
Bootloader = 1, Bootloader = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.StorageA) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.StorageA)
StorageA = 2, StorageA = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.StorageB) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.StorageB)
StorageB = 3, StorageB = 3,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.Firmware) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.Firmware)
Firmware = 4, Firmware = 4,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.Secret) // @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.DebugFlashMemoryLocation.DebugFlashArea.Translations)
Secret = 5, Translations = 5,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.debug.FlashMemoryLocation.FlashArea.Translations)
Translations = 6,
} }
impl ::protobuf::Enum for FlashArea { impl ::protobuf::Enum for DebugFlashArea {
const NAME: &'static str = "FlashArea"; const NAME: &'static str = "DebugFlashArea";
fn value(&self) -> i32 { fn value(&self) -> i32 {
*self as i32 *self as i32
} }
fn from_i32(value: i32) -> ::std::option::Option<FlashArea> { fn from_i32(value: i32) -> ::std::option::Option<DebugFlashArea> {
match value { match value {
0 => ::std::option::Option::Some(FlashArea::Boardloader), 0 => ::std::option::Option::Some(DebugFlashArea::Boardloader),
1 => ::std::option::Option::Some(FlashArea::Bootloader), 1 => ::std::option::Option::Some(DebugFlashArea::Bootloader),
2 => ::std::option::Option::Some(FlashArea::StorageA), 2 => ::std::option::Option::Some(DebugFlashArea::StorageA),
3 => ::std::option::Option::Some(FlashArea::StorageB), 3 => ::std::option::Option::Some(DebugFlashArea::StorageB),
4 => ::std::option::Option::Some(FlashArea::Firmware), 4 => ::std::option::Option::Some(DebugFlashArea::Firmware),
5 => ::std::option::Option::Some(FlashArea::Secret), 5 => ::std::option::Option::Some(DebugFlashArea::Translations),
6 => ::std::option::Option::Some(FlashArea::Translations),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
fn from_str(str: &str) -> ::std::option::Option<FlashArea> { fn from_str(str: &str) -> ::std::option::Option<DebugFlashArea> {
match str { match str {
"Boardloader" => ::std::option::Option::Some(FlashArea::Boardloader), "Boardloader" => ::std::option::Option::Some(DebugFlashArea::Boardloader),
"Bootloader" => ::std::option::Option::Some(FlashArea::Bootloader), "Bootloader" => ::std::option::Option::Some(DebugFlashArea::Bootloader),
"StorageA" => ::std::option::Option::Some(FlashArea::StorageA), "StorageA" => ::std::option::Option::Some(DebugFlashArea::StorageA),
"StorageB" => ::std::option::Option::Some(FlashArea::StorageB), "StorageB" => ::std::option::Option::Some(DebugFlashArea::StorageB),
"Firmware" => ::std::option::Option::Some(FlashArea::Firmware), "Firmware" => ::std::option::Option::Some(DebugFlashArea::Firmware),
"Secret" => ::std::option::Option::Some(FlashArea::Secret), "Translations" => ::std::option::Option::Some(DebugFlashArea::Translations),
"Translations" => ::std::option::Option::Some(FlashArea::Translations),
_ => ::std::option::Option::None _ => ::std::option::Option::None
} }
} }
const VALUES: &'static [FlashArea] = &[ const VALUES: &'static [DebugFlashArea] = &[
FlashArea::Boardloader, DebugFlashArea::Boardloader,
FlashArea::Bootloader, DebugFlashArea::Bootloader,
FlashArea::StorageA, DebugFlashArea::StorageA,
FlashArea::StorageB, DebugFlashArea::StorageB,
FlashArea::Firmware, DebugFlashArea::Firmware,
FlashArea::Secret, DebugFlashArea::Translations,
FlashArea::Translations,
]; ];
} }
impl ::protobuf::EnumFull for FlashArea { impl ::protobuf::EnumFull for DebugFlashArea {
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("FlashMemoryLocation.FlashArea").unwrap()).clone() descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("DebugFlashMemoryLocation.DebugFlashArea").unwrap()).clone()
} }
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
@ -2624,15 +2619,15 @@ pub mod flash_memory_location {
} }
} }
impl ::std::default::Default for FlashArea { impl ::std::default::Default for DebugFlashArea {
fn default() -> Self { fn default() -> Self {
FlashArea::Boardloader DebugFlashArea::Boardloader
} }
} }
impl FlashArea { impl DebugFlashArea {
pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<FlashArea>("FlashMemoryLocation.FlashArea") ::protobuf::reflect::GeneratedEnumDescriptorData::new::<DebugFlashArea>("DebugFlashMemoryLocation.DebugFlashArea")
} }
} }
} }
@ -2820,7 +2815,7 @@ impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryRead {
pub struct DebugLinkFlashRead { pub struct DebugLinkFlashRead {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.location) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.location)
pub location: ::protobuf::MessageField<FlashMemoryLocation>, pub location: ::protobuf::MessageField<DebugFlashMemoryLocation>,
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.length) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.length)
pub length: ::std::option::Option<u32>, pub length: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.hashed) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashRead.hashed)
@ -2882,7 +2877,7 @@ impl DebugLinkFlashRead {
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(3); let mut fields = ::std::vec::Vec::with_capacity(3);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, FlashMemoryLocation>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, DebugFlashMemoryLocation>(
"location", "location",
|m: &DebugLinkFlashRead| { &m.location }, |m: &DebugLinkFlashRead| { &m.location },
|m: &mut DebugLinkFlashRead| { &mut m.location }, |m: &mut DebugLinkFlashRead| { &mut m.location },
@ -3469,7 +3464,7 @@ impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryWrite {
pub struct DebugLinkFlashWrite { pub struct DebugLinkFlashWrite {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashWrite.location) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashWrite.location)
pub location: ::protobuf::MessageField<FlashMemoryLocation>, pub location: ::protobuf::MessageField<DebugFlashMemoryLocation>,
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashWrite.memory) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashWrite.memory)
pub memory: ::std::option::Option<::std::vec::Vec<u8>>, pub memory: ::std::option::Option<::std::vec::Vec<u8>>,
// special fields // special fields
@ -3527,7 +3522,7 @@ impl DebugLinkFlashWrite {
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2); let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, FlashMemoryLocation>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, DebugFlashMemoryLocation>(
"location", "location",
|m: &DebugLinkFlashWrite| { &m.location }, |m: &DebugLinkFlashWrite| { &m.location },
|m: &mut DebugLinkFlashWrite| { &mut m.location }, |m: &mut DebugLinkFlashWrite| { &mut m.location },
@ -3798,7 +3793,7 @@ impl ::protobuf::reflect::ProtobufValue for DebugLinkFlashEraseLegacy {
pub struct DebugLinkFlashErase { pub struct DebugLinkFlashErase {
// message fields // message fields
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.location) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.location)
pub location: ::protobuf::MessageField<FlashMemoryLocation>, pub location: ::protobuf::MessageField<DebugFlashMemoryLocation>,
// @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.whole_area) // @@protoc_insertion_point(field:hw.trezor.messages.debug.DebugLinkFlashErase.whole_area)
pub whole_area: ::std::option::Option<bool>, pub whole_area: ::std::option::Option<bool>,
// special fields // special fields
@ -3839,7 +3834,7 @@ impl DebugLinkFlashErase {
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(2); let mut fields = ::std::vec::Vec::with_capacity(2);
let mut oneofs = ::std::vec::Vec::with_capacity(0); let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, FlashMemoryLocation>( fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, DebugFlashMemoryLocation>(
"location", "location",
|m: &DebugLinkFlashErase| { &m.location }, |m: &DebugLinkFlashErase| { &m.location },
|m: &mut DebugLinkFlashErase| { &mut m.location }, |m: &mut DebugLinkFlashErase| { &mut m.location },
@ -4384,33 +4379,33 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\n\x06tokens\x18\r\x20\x03(\tR\x06tokens\"\x0f\n\rDebugLinkStop\"P\n\x0c\ \n\x06tokens\x18\r\x20\x03(\tR\x06tokens\"\x0f\n\rDebugLinkStop\"P\n\x0c\
DebugLinkLog\x12\x14\n\x05level\x18\x01\x20\x01(\rR\x05level\x12\x16\n\ DebugLinkLog\x12\x14\n\x05level\x18\x01\x20\x01(\rR\x05level\x12\x16\n\
\x06bucket\x18\x02\x20\x01(\tR\x06bucket\x12\x12\n\x04text\x18\x03\x20\ \x06bucket\x18\x02\x20\x01(\tR\x06bucket\x12\x12\n\x04text\x18\x03\x20\
\x01(\tR\x04text\"\xf0\x01\n\x13FlashMemoryLocation\x12K\n\x04area\x18\ \x01(\tR\x04text\"\xf8\x01\n\x18DebugFlashMemoryLocation\x12U\n\x04area\
\x01\x20\x02(\x0e27.hw.trezor.messages.debug.FlashMemoryLocation.FlashAr\ \x18\x01\x20\x02(\x0e2A.hw.trezor.messages.debug.DebugFlashMemoryLocatio\
eaR\x04area\x12\x16\n\x06offset\x18\x02\x20\x02(\rR\x06offset\"t\n\tFlas\ n.DebugFlashAreaR\x04area\x12\x16\n\x06offset\x18\x02\x20\x02(\rR\x06off\
hArea\x12\x0f\n\x0bBoardloader\x10\0\x12\x0e\n\nBootloader\x10\x01\x12\ set\"m\n\x0eDebugFlashArea\x12\x0f\n\x0bBoardloader\x10\0\x12\x0e\n\nBoo\
\x0c\n\x08StorageA\x10\x02\x12\x0c\n\x08StorageB\x10\x03\x12\x0c\n\x08Fi\ tloader\x10\x01\x12\x0c\n\x08StorageA\x10\x02\x12\x0c\n\x08StorageB\x10\
rmware\x10\x04\x12\n\n\x06Secret\x10\x05\x12\x10\n\x0cTranslations\x10\ \x03\x12\x0c\n\x08Firmware\x10\x04\x12\x10\n\x0cTranslations\x10\x05\"K\
\x06\"K\n\x13DebugLinkMemoryRead\x12\x18\n\x07address\x18\x01\x20\x01(\r\ \n\x13DebugLinkMemoryRead\x12\x18\n\x07address\x18\x01\x20\x01(\rR\x07ad\
R\x07address\x12\x16\n\x06length\x18\x02\x20\x01(\rR\x06length:\x02\x18\ dress\x12\x16\n\x06length\x18\x02\x20\x01(\rR\x06length:\x02\x18\x01\"\
\x01\"\x96\x01\n\x12DebugLinkFlashRead\x12I\n\x08location\x18\x01\x20\ \x9b\x01\n\x12DebugLinkFlashRead\x12N\n\x08location\x18\x01\x20\x02(\x0b\
\x02(\x0b2-.hw.trezor.messages.debug.FlashMemoryLocationR\x08location\ 22.hw.trezor.messages.debug.DebugFlashMemoryLocationR\x08location\x12\
\x12\x16\n\x06length\x18\x02\x20\x01(\rR\x06length\x12\x1d\n\x06hashed\ \x16\n\x06length\x18\x02\x20\x01(\rR\x06length\x12\x1d\n\x06hashed\x18\
\x18\x03\x20\x01(\x08:\x05falseR\x06hashed\"=\n\x0fDebugLinkMemory\x12\ \x03\x20\x01(\x08:\x05falseR\x06hashed\"=\n\x0fDebugLinkMemory\x12\x16\n\
\x16\n\x06memory\x18\x01\x20\x01(\x0cR\x06memory\x12\x12\n\x04hash\x18\ \x06memory\x18\x01\x20\x01(\x0cR\x06memory\x12\x12\n\x04hash\x18\x02\x20\
\x02\x20\x01(\x0cR\x04hash\"b\n\x14DebugLinkMemoryWrite\x12\x18\n\x07add\ \x01(\x0cR\x04hash\"b\n\x14DebugLinkMemoryWrite\x12\x18\n\x07address\x18\
ress\x18\x01\x20\x01(\rR\x07address\x12\x16\n\x06memory\x18\x02\x20\x01(\ \x01\x20\x01(\rR\x07address\x12\x16\n\x06memory\x18\x02\x20\x01(\x0cR\
\x0cR\x06memory\x12\x14\n\x05flash\x18\x03\x20\x01(\x08R\x05flash:\x02\ \x06memory\x12\x14\n\x05flash\x18\x03\x20\x01(\x08R\x05flash:\x02\x18\
\x18\x01\"x\n\x13DebugLinkFlashWrite\x12I\n\x08location\x18\x01\x20\x02(\ \x01\"}\n\x13DebugLinkFlashWrite\x12N\n\x08location\x18\x01\x20\x02(\x0b\
\x0b2-.hw.trezor.messages.debug.FlashMemoryLocationR\x08location\x12\x16\ 22.hw.trezor.messages.debug.DebugFlashMemoryLocationR\x08location\x12\
\n\x06memory\x18\x02\x20\x02(\x0cR\x06memory\"7\n\x19DebugLinkFlashErase\ \x16\n\x06memory\x18\x02\x20\x02(\x0cR\x06memory\"7\n\x19DebugLinkFlashE\
Legacy\x12\x16\n\x06sector\x18\x01\x20\x01(\rR\x06sector:\x02\x18\x01\"\ raseLegacy\x12\x16\n\x06sector\x18\x01\x20\x01(\rR\x06sector:\x02\x18\
\x86\x01\n\x13DebugLinkFlashErase\x12I\n\x08location\x18\x01\x20\x02(\ \x01\"\x8b\x01\n\x13DebugLinkFlashErase\x12N\n\x08location\x18\x01\x20\
\x0b2-.hw.trezor.messages.debug.FlashMemoryLocationR\x08location\x12$\n\ \x02(\x0b22.hw.trezor.messages.debug.DebugFlashMemoryLocationR\x08locati\
\nwhole_area\x18\x02\x20\x01(\x08:\x05falseR\twholeArea\".\n\x14DebugLin\ on\x12$\n\nwhole_area\x18\x02\x20\x01(\x08:\x05falseR\twholeArea\".\n\
kEraseSdCard\x12\x16\n\x06format\x18\x01\x20\x01(\x08R\x06format\",\n\ \x14DebugLinkEraseSdCard\x12\x16\n\x06format\x18\x01\x20\x01(\x08R\x06fo\
\x14DebugLinkWatchLayout\x12\x14\n\x05watch\x18\x01\x20\x01(\x08R\x05wat\ rmat\",\n\x14DebugLinkWatchLayout\x12\x14\n\x05watch\x18\x01\x20\x01(\
ch\"\x1b\n\x19DebugLinkResetDebugEventsB=\n#com.satoshilabs.trezor.lib.p\ \x08R\x05watch\"\x1b\n\x19DebugLinkResetDebugEventsB=\n#com.satoshilabs.\
rotobufB\x12TrezorMessageDebug\x80\xa6\x1d\x01\ trezor.lib.protobufB\x12TrezorMessageDebug\x80\xa6\x1d\x01\
"; ";
/// `FileDescriptorProto` object which was a source for this generated file /// `FileDescriptorProto` object which was a source for this generated file
@ -4440,7 +4435,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(DebugLinkState::generated_message_descriptor_data()); messages.push(DebugLinkState::generated_message_descriptor_data());
messages.push(DebugLinkStop::generated_message_descriptor_data()); messages.push(DebugLinkStop::generated_message_descriptor_data());
messages.push(DebugLinkLog::generated_message_descriptor_data()); messages.push(DebugLinkLog::generated_message_descriptor_data());
messages.push(FlashMemoryLocation::generated_message_descriptor_data()); messages.push(DebugFlashMemoryLocation::generated_message_descriptor_data());
messages.push(DebugLinkMemoryRead::generated_message_descriptor_data()); messages.push(DebugLinkMemoryRead::generated_message_descriptor_data());
messages.push(DebugLinkFlashRead::generated_message_descriptor_data()); messages.push(DebugLinkFlashRead::generated_message_descriptor_data());
messages.push(DebugLinkMemory::generated_message_descriptor_data()); messages.push(DebugLinkMemory::generated_message_descriptor_data());
@ -4455,7 +4450,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
enums.push(debug_link_decision::DebugSwipeDirection::generated_enum_descriptor_data()); enums.push(debug_link_decision::DebugSwipeDirection::generated_enum_descriptor_data());
enums.push(debug_link_decision::DebugButton::generated_enum_descriptor_data()); enums.push(debug_link_decision::DebugButton::generated_enum_descriptor_data());
enums.push(debug_link_decision::DebugPhysicalButton::generated_enum_descriptor_data()); enums.push(debug_link_decision::DebugPhysicalButton::generated_enum_descriptor_data());
enums.push(flash_memory_location::FlashArea::generated_enum_descriptor_data()); enums.push(debug_flash_memory_location::DebugFlashArea::generated_enum_descriptor_data());
::protobuf::reflect::GeneratedFileDescriptor::new_generated( ::protobuf::reflect::GeneratedFileDescriptor::new_generated(
file_descriptor_proto(), file_descriptor_proto(),
deps, deps,

Loading…
Cancel
Save