1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

core/usb: Ensure that USB interface is not busy before writing.

This commit is contained in:
Andrew Kozlik 2019-08-08 15:22:34 +02:00
parent 6ad3294f31
commit 2142b37f86

View File

@ -184,6 +184,10 @@ int usb_hid_write(uint8_t iface_num, const uint8_t *buf, uint32_t len) {
}
usb_hid_state_t *state = &iface->hid;
if (state->ep_in_is_idle == 0) {
return 0; // Last transmission is not over yet
}
state->ep_in_is_idle = 0;
USBD_LL_Transmit(&usb_dev_handle, state->ep_in, UNCONST(buf), (uint16_t)len);