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
|
from trezor import loop
|
||||||
import usb
|
import usb
|
||||||
from .fido2 import handle_reports
|
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
|
seq += 1
|
||||||
|
|
||||||
|
|
||||||
async def handle_reports(iface: HID) -> None:
|
async def handle_reports(iface: HID, mutex) -> None:
|
||||||
dialog_mgr = DialogManager(iface)
|
dialog_mgr = DialogManager(iface)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -546,6 +546,10 @@ async def handle_reports(iface: HID) -> None:
|
|||||||
req = await _read_cmd(iface)
|
req = await _read_cmd(iface)
|
||||||
if req is None:
|
if req is None:
|
||||||
continue
|
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):
|
if not dialog_mgr.allow_cid(req.cid):
|
||||||
resp: Cmd | None = cmd_error(req.cid, _ERR_CHANNEL_BUSY)
|
resp: Cmd | None = cmd_error(req.cid, _ERR_CHANNEL_BUSY)
|
||||||
else:
|
else:
|
||||||
|
@ -7,10 +7,12 @@ import usb
|
|||||||
|
|
||||||
apps.base.boot()
|
apps.base.boot()
|
||||||
|
|
||||||
|
mutex = Mutex()
|
||||||
|
|
||||||
if not utils.BITCOIN_ONLY and usb.ENABLE_IFACE_WEBAUTHN:
|
if not utils.BITCOIN_ONLY and usb.ENABLE_IFACE_WEBAUTHN:
|
||||||
import apps.webauthn
|
import apps.webauthn
|
||||||
|
|
||||||
apps.webauthn.boot()
|
apps.webauthn.boot(mutex)
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
import apps.debug
|
import apps.debug
|
||||||
@ -22,8 +24,6 @@ apps.base.set_homescreen()
|
|||||||
workflow.start_default()
|
workflow.start_default()
|
||||||
|
|
||||||
|
|
||||||
mutex = Mutex()
|
|
||||||
|
|
||||||
mutex.add(usb.iface_wire.iface_num())
|
mutex.add(usb.iface_wire.iface_num())
|
||||||
mutex.add(usb.iface_debug.iface_num())
|
mutex.add(usb.iface_debug.iface_num())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user