1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

core/fido2: check for HID timeout in send_cmd() (#791)

This commit is contained in:
Andrew Kozlik 2020-01-11 14:33:24 +01:00 committed by Pavol Rusnak
parent 7c41b40dff
commit 289d8276eb

View File

@ -477,7 +477,10 @@ async def send_cmd(cmd: Cmd, iface: io.HID) -> None:
if copied < _FRAME_CONT_SIZE:
frm.data[copied:] = bytearray(_FRAME_CONT_SIZE - copied)
while True:
await write
ret = await loop.race(write, loop.sleep(_CTAP_HID_TIMEOUT_MS * 1000))
if ret is not None:
raise TimeoutError
if iface.write(buf) > 0:
break
seq += 1