improve usbd log for control transfer

This commit is contained in:
hathach 2020-06-14 18:29:02 +07:00
parent a347de6e50
commit 95966c2201
1 changed files with 10 additions and 2 deletions

View File

@ -380,17 +380,21 @@ void tud_task (void)
if ( !osal_queue_receive(_usbd_q, &event) ) return; if ( !osal_queue_receive(_usbd_q, &event) ) return;
TU_LOG2("USBD %s", event.event_id < DCD_EVENT_COUNT ? _usbd_event_str[event.event_id] : "CORRUPTED"); #if CFG_TUSB_DEBUG >= 2
TU_LOG2("%s", (event.event_id != DCD_EVENT_XFER_COMPLETE && event.event_id != DCD_EVENT_SETUP_RECEIVED) ? "\r\n" : " "); if (event.event_id == DCD_EVENT_SETUP_RECEIVED) TU_LOG2("\r\n"); // extra line for setup
TU_LOG2("USBD %s ", event.event_id < DCD_EVENT_COUNT ? _usbd_event_str[event.event_id] : "CORRUPTED");
#endif
switch ( event.event_id ) switch ( event.event_id )
{ {
case DCD_EVENT_BUS_RESET: case DCD_EVENT_BUS_RESET:
TU_LOG2("\r\n");
usbd_reset(event.rhport); usbd_reset(event.rhport);
_usbd_dev.speed = event.bus_reset.speed; _usbd_dev.speed = event.bus_reset.speed;
break; break;
case DCD_EVENT_UNPLUGGED: case DCD_EVENT_UNPLUGGED:
TU_LOG2("\r\n");
usbd_reset(event.rhport); usbd_reset(event.rhport);
// invoke callback // invoke callback
@ -442,14 +446,17 @@ void tud_task (void)
break; break;
case DCD_EVENT_SUSPEND: case DCD_EVENT_SUSPEND:
TU_LOG2("\r\n");
if (tud_suspend_cb) tud_suspend_cb(_usbd_dev.remote_wakeup_en); if (tud_suspend_cb) tud_suspend_cb(_usbd_dev.remote_wakeup_en);
break; break;
case DCD_EVENT_RESUME: case DCD_EVENT_RESUME:
TU_LOG2("\r\n");
if (tud_resume_cb) tud_resume_cb(); if (tud_resume_cb) tud_resume_cb();
break; break;
case DCD_EVENT_SOF: case DCD_EVENT_SOF:
TU_LOG2("\r\n");
for ( uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++ ) for ( uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++ )
{ {
if ( _usbd_driver[i].sof ) if ( _usbd_driver[i].sof )
@ -460,6 +467,7 @@ void tud_task (void)
break; break;
case USBD_EVENT_FUNC_CALL: case USBD_EVENT_FUNC_CALL:
TU_LOG2("\r\n");
if ( event.func_call.func ) event.func_call.func(event.func_call.param); if ( event.func_call.func ) event.func_call.func(event.func_call.param);
break; break;