1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-05 23:58:46 +00:00

fixup! wip

This commit is contained in:
M1nd3r 2025-04-09 15:19:09 +02:00
parent 9e1702a7f8
commit 29a7a538c5
2 changed files with 10 additions and 21 deletions

View File

@ -228,10 +228,10 @@ class TrezorClient:
def _read(self, session_id: int | None = None) -> t.Any: def _read(self, session_id: int | None = None) -> t.Any:
if isinstance(self.protocol, ProtocolV1Channel): if isinstance(self.protocol, ProtocolV1Channel):
self.protocol.read() return self.protocol.read()
elif isinstance(self.protocol, ProtocolV2Channel): elif isinstance(self.protocol, ProtocolV2Channel):
assert session_id is not None assert session_id is not None
self.protocol.read(session_id=session_id) return self.protocol.read(session_id=session_id)
else: else:
raise Exception("Unknown client protocol") raise Exception("Unknown client protocol")

View File

@ -807,7 +807,6 @@ class DebugUI:
def __init__(self, debuglink: DebugLink) -> None: def __init__(self, debuglink: DebugLink) -> None:
self.debuglink = debuglink self.debuglink = debuglink
self.pins: t.Iterator[str] | None = None
self.clear() self.clear()
def clear(self) -> None: def clear(self) -> None:
@ -1069,20 +1068,16 @@ class TrezorClientDebugLink(TrezorClient):
self.sync_responses() self.sync_responses()
def __getattr__(self, name: str) -> t.Any: # So that we can choose right screenshotting logic (T1 vs TT)
return getattr(self._session, name) # and know the supported debug capabilities
self.debug.model = self.model
def __setattr__(self, name: str, value: t.Any) -> None: self.debug.version = self.version
if hasattr(self._session, name):
setattr(self._session, name, value)
else:
self.__dict__[name] = value
self.reset_debug_features() self.reset_debug_features()
@property @property
def protocol_version(self) -> int: def layout_type(self) -> LayoutType:
return self.client.protocol_version return self.debug.layout_type
def get_new_client(self) -> TrezorClientDebugLink: def get_new_client(self) -> TrezorClientDebugLink:
new_client = TrezorClientDebugLink( new_client = TrezorClientDebugLink(
@ -1284,10 +1279,8 @@ class TrezorClientDebugLink(TrezorClient):
actual_responses = self.actual_responses actual_responses = self.actual_responses
# grab a copy of the inputflow generator to raise an exception through it # grab a copy of the inputflow generator to raise an exception through it
if isinstance(self.client, TrezorClientDebugLink) and isinstance( if isinstance(self.ui, DebugUI):
self.client.ui, DebugUI input_flow = self.ui.input_flow
):
input_flow = self.client.ui.input_flow
else: else:
input_flow = None input_flow = None
@ -1404,10 +1397,6 @@ class TrezorClientDebugLink(TrezorClient):
self.actual_responses.append(resp) self.actual_responses.append(resp)
return resp return resp
def reset_protocol(self):
super().reset_protocol()
self._seedless_session = self.get_seedless_session(new_session=True)
def load_device( def load_device(
session: "Session", session: "Session",