File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -411,7 +411,14 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr)
411
411
if ( _dev0 .enumerating )
412
412
{
413
413
TU_LOG_USBH ("[%u:] USBH Defer Attach until current enumeration complete\r\n" , event .rhport );
414
+
415
+ bool is_empty = osal_queue_empty (_usbh_q );
414
416
osal_queue_send (_usbh_q , & event , in_isr );
417
+
418
+ if (is_empty ) {
419
+ // Exit if this is the only event in the queue, otherwise we may loop forever
420
+ return ;
421
+ }
415
422
}else
416
423
{
417
424
TU_LOG_USBH ("[%u:] USBH DEVICE ATTACH\r\n" , event .rhport );
@@ -1461,7 +1468,10 @@ static bool enum_new_device(hcd_event_t* event)
1461
1468
hcd_port_reset_end ( _dev0 .rhport );
1462
1469
1463
1470
// device unplugged while delaying
1464
- if ( !hcd_port_connect_status (_dev0 .rhport ) ) return true;
1471
+ if ( !hcd_port_connect_status (_dev0 .rhport ) ) {
1472
+ enum_full_complete ();
1473
+ return true;
1474
+ }
1465
1475
1466
1476
_dev0 .speed = hcd_port_speed_get (_dev0 .rhport );
1467
1477
TU_LOG_USBH ("%s Speed\r\n" , tu_str_speed [_dev0 .speed ]);
You can’t perform that action at this time.
0 commit comments