diff --git a/core/src/trezor/wire/thp/channel.py b/core/src/trezor/wire/thp/channel.py index 38fdb6a9c..aad76c222 100644 --- a/core/src/trezor/wire/thp/channel.py +++ b/core/src/trezor/wire/thp/channel.py @@ -24,7 +24,12 @@ from .thp_messages import ( InitHeader, ) from .thp_session import ThpError -from .writer import write_payload_to_wire +from .writer import ( + CONT_DATA_OFFSET, + INIT_DATA_OFFSET, + REPORT_LENGTH, + write_payload_to_wire, +) if TYPE_CHECKING: from trezorio import WireInterface # pyright:ignore[reportMissingImports] @@ -35,12 +40,9 @@ _MOCK_INTERFACE_HID = b"\x00" _PUBKEY_LENGTH = const(32) -INIT_DATA_OFFSET = const(5) -CONT_DATA_OFFSET = const(3) MESSAGE_TYPE_LENGTH = const(2) -REPORT_LENGTH = const(64) MAX_PAYLOAD_LEN = const(60000) diff --git a/core/src/trezor/wire/thp/writer.py b/core/src/trezor/wire/thp/writer.py index 24e5b09bc..7acd425e6 100644 --- a/core/src/trezor/wire/thp/writer.py +++ b/core/src/trezor/wire/thp/writer.py @@ -1,9 +1,13 @@ +from micropython import const # pyright: ignore[reportMissingModuleSource] from typing import TYPE_CHECKING # pyright: ignore[reportShadowedImports] from trezor import io, log, loop, utils -from trezor.wire.thp.channel import CONT_DATA_OFFSET, INIT_DATA_OFFSET, REPORT_LENGTH from trezor.wire.thp.thp_messages import InitHeader +INIT_DATA_OFFSET = const(5) +CONT_DATA_OFFSET = const(3) +REPORT_LENGTH = const(64) + if TYPE_CHECKING: from trezorio import WireInterface # pyright: ignore[reportMissingImports]