Merge pull request #2050 from jepler/issue2048

usb_hid: Allow USB work to progress while waiting for tud_hid_ready
This commit is contained in:
Scott Shawcroft 2019-08-12 15:16:21 -07:00 committed by GitHub
commit 9a6e603ced
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,11 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t*
// Wait until interface is ready, timeout = 2 seconds
uint64_t end_ticks = ticks_ms + 2000;
while ( (ticks_ms < end_ticks) && !tud_hid_ready() ) { }
while ( (ticks_ms < end_ticks) && !tud_hid_ready() ) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP;
#endif
}
if ( !tud_hid_ready() ) {
mp_raise_msg(&mp_type_OSError, translate("USB Busy"));