mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-15 19:08:07 +00:00
feat(core): log ButtonRequests with names for easier debugging
This commit is contained in:
parent
b2328a4e28
commit
34d97ee942
@ -257,6 +257,8 @@ class Layout(Generic[T]):
|
||||
|
||||
set_current_layout(None)
|
||||
if __debug__:
|
||||
if self.button_request_ack_pending:
|
||||
raise wire.FirmwareError("button request ack pending")
|
||||
self.notify_debuglink(None)
|
||||
|
||||
async def get_result(self) -> T:
|
||||
@ -416,12 +418,16 @@ class Layout(Generic[T]):
|
||||
self.button_request_box,
|
||||
)
|
||||
|
||||
if __debug__:
|
||||
log.info(__name__, "ButtonRequest sent: %s", br_name)
|
||||
await self.context.call(
|
||||
ButtonRequest(
|
||||
code=br_code, pages=self.layout.page_count(), name=br_name
|
||||
),
|
||||
ButtonAck,
|
||||
)
|
||||
if __debug__:
|
||||
log.info(__name__, "ButtonRequest acked: %s", br_name)
|
||||
|
||||
if (
|
||||
self.button_request_ack_pending
|
||||
|
@ -6,6 +6,9 @@ from trezor.enums import ButtonRequestType
|
||||
from trezor.messages import ButtonAck, ButtonRequest
|
||||
from trezor.wire import ActionCancelled, context
|
||||
|
||||
if __debug__:
|
||||
from trezor import log
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Awaitable, Callable, TypeVar
|
||||
|
||||
@ -23,9 +26,13 @@ async def _button_request(
|
||||
pages: int = 0,
|
||||
) -> None:
|
||||
workflow.close_others()
|
||||
if __debug__:
|
||||
log.info(__name__, "ButtonRequest sent: %s", br_name)
|
||||
await context.maybe_call(
|
||||
ButtonRequest(code=code, pages=pages or None, name=br_name), ButtonAck
|
||||
)
|
||||
if __debug__:
|
||||
log.info(__name__, "ButtonRequest acked: %s", br_name)
|
||||
|
||||
|
||||
async def interact(
|
||||
|
Loading…
Reference in New Issue
Block a user