mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-20 13:38:11 +00:00
fixup! feat(core): prevent interruption of workflows from other communication interfaces
This commit is contained in:
parent
a3e8f191a6
commit
a65ab6bad0
@ -1,6 +1,6 @@
|
||||
def boot() -> None:
|
||||
def boot(mutex) -> None:
|
||||
from trezor import loop
|
||||
import usb
|
||||
from .fido2 import handle_reports
|
||||
|
||||
loop.schedule(handle_reports(usb.iface_webauthn))
|
||||
loop.schedule(handle_reports(usb.iface_webauthn, mutex))
|
||||
|
@ -538,7 +538,7 @@ def send_cmd_sync(cmd: Cmd, iface: HID) -> None:
|
||||
seq += 1
|
||||
|
||||
|
||||
async def handle_reports(iface: HID) -> None:
|
||||
async def handle_reports(iface: HID, mutex) -> None:
|
||||
dialog_mgr = DialogManager(iface)
|
||||
|
||||
while True:
|
||||
@ -546,6 +546,10 @@ async def handle_reports(iface: HID) -> None:
|
||||
req = await _read_cmd(iface)
|
||||
if req is None:
|
||||
continue
|
||||
if mutex is not None and mutex.get_busy(iface.iface_num()):
|
||||
resp: Cmd | None = cmd_error(req.cid, _ERR_CHANNEL_BUSY)
|
||||
else:
|
||||
mutex.set_busy(iface.iface_num())
|
||||
if not dialog_mgr.allow_cid(req.cid):
|
||||
resp: Cmd | None = cmd_error(req.cid, _ERR_CHANNEL_BUSY)
|
||||
else:
|
||||
|
@ -7,10 +7,12 @@ import usb
|
||||
|
||||
apps.base.boot()
|
||||
|
||||
mutex = Mutex()
|
||||
|
||||
if not utils.BITCOIN_ONLY and usb.ENABLE_IFACE_WEBAUTHN:
|
||||
import apps.webauthn
|
||||
|
||||
apps.webauthn.boot()
|
||||
apps.webauthn.boot(mutex)
|
||||
|
||||
if __debug__:
|
||||
import apps.debug
|
||||
@ -22,8 +24,6 @@ apps.base.set_homescreen()
|
||||
workflow.start_default()
|
||||
|
||||
|
||||
mutex = Mutex()
|
||||
|
||||
mutex.add(usb.iface_wire.iface_num())
|
||||
mutex.add(usb.iface_debug.iface_num())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user