1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 12:08:59 +00:00

chore(core): remove unused session_id from codec_v1

[no changelog]
This commit is contained in:
M1nd3r 2024-11-14 15:42:46 +01:00
parent b714e91d60
commit 977ee04e5b
4 changed files with 10 additions and 18 deletions

View File

@ -360,7 +360,7 @@ if __debug__:
global DEBUG_CONTEXT
DEBUG_CONTEXT = ctx = context.Context(iface, 0, WIRE_BUFFER_DEBUG)
DEBUG_CONTEXT = ctx = context.Context(iface, WIRE_BUFFER_DEBUG)
if storage.layout_watcher:
try:
@ -385,9 +385,8 @@ if __debug__:
msg_type = f"{msg.type} - unknown message type"
log.debug(
__name__,
"%s:%x receive: <%s>",
"%d receive: <%s>",
ctx.iface.iface_num(),
ctx.sid,
msg_type,
)

View File

@ -56,7 +56,7 @@ EXPERIMENTAL_ENABLED = False
def setup(iface: WireInterface) -> None:
"""Initialize the wire stack on passed USB interface."""
loop.schedule(handle_session(iface, codec_v1.SESSION_ID))
loop.schedule(handle_session(iface))
def wrap_protobuf_load(
@ -109,9 +109,8 @@ async def _handle_single_message(ctx: context.Context, msg: codec_v1.Message) ->
msg_type = f"{msg.type} - unknown message type"
log.debug(
__name__,
"%s:%x receive: <%s>",
"%d receive: <%s>",
ctx.iface.iface_num(),
ctx.sid,
msg_type,
)
@ -190,8 +189,8 @@ async def _handle_single_message(ctx: context.Context, msg: codec_v1.Message) ->
return msg.type in AVOID_RESTARTING_FOR
async def handle_session(iface: WireInterface, session_id: int) -> None:
ctx = context.Context(iface, session_id, WIRE_BUFFER)
async def handle_session(iface: WireInterface) -> None:
ctx = context.Context(iface, WIRE_BUFFER)
next_msg: codec_v1.Message | None = None
# Take a mark of modules that are imported at this point, so we can

View File

@ -15,8 +15,6 @@ _REP_INIT = ">BBBHL" # marker, magic, magic, wire type, data length
_REP_INIT_DATA = const(9) # offset of data in the initial report
_REP_CONT_DATA = const(1) # offset of data in the continuation report
SESSION_ID = const(0)
class CodecError(Exception):
pass

View File

@ -60,9 +60,8 @@ class Context:
(i.e., wire, debug, single BT connection, etc.)
"""
def __init__(self, iface: WireInterface, sid: int, buffer: bytearray) -> None:
def __init__(self, iface: WireInterface, buffer: bytearray) -> None:
self.iface = iface
self.sid = sid
self.buffer = buffer
def read_from_wire(self) -> Awaitable[codec_v1.Message]:
@ -95,9 +94,8 @@ class Context:
if __debug__:
log.debug(
__name__,
"%s:%x expect: %s",
"%d expect: %s",
self.iface.iface_num(),
self.sid,
expected_type.MESSAGE_NAME if expected_type else expected_types,
)
@ -115,9 +113,8 @@ class Context:
if __debug__:
log.debug(
__name__,
"%s:%x read: %s",
"%d read: %s",
self.iface.iface_num(),
self.sid,
expected_type.MESSAGE_NAME,
)
@ -131,9 +128,8 @@ class Context:
if __debug__:
log.debug(
__name__,
"%s:%x write: %s",
"%d write: %s",
self.iface.iface_num(),
self.sid,
msg.MESSAGE_NAME,
)