summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-06-14 18:29:02 +0700
committerhathach <[email protected]>2020-06-14 18:29:02 +0700
commit95966c22010bf01579f39847624395724298c459 (patch)
tree1796ae4857453c80d319214d7d8a232292a2b76a /src
parenta347de6e50e98b339a1605dc927c0417e79b86a5 (diff)
improve usbd log for control transfer
Diffstat (limited to 'src')
-rw-r--r--src/device/usbd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index eeb5011ec..c337f1be1 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -380,17 +380,21 @@ void tud_task (void)
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");
- TU_LOG2("%s", (event.event_id != DCD_EVENT_XFER_COMPLETE && event.event_id != DCD_EVENT_SETUP_RECEIVED) ? "\r\n" : " ");
+#if CFG_TUSB_DEBUG >= 2
+ 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 )
{
case DCD_EVENT_BUS_RESET:
+ TU_LOG2("\r\n");
usbd_reset(event.rhport);
_usbd_dev.speed = event.bus_reset.speed;
break;
case DCD_EVENT_UNPLUGGED:
+ TU_LOG2("\r\n");
usbd_reset(event.rhport);
// invoke callback
@@ -442,14 +446,17 @@ void tud_task (void)
break;
case DCD_EVENT_SUSPEND:
+ TU_LOG2("\r\n");
if (tud_suspend_cb) tud_suspend_cb(_usbd_dev.remote_wakeup_en);
break;
case DCD_EVENT_RESUME:
+ TU_LOG2("\r\n");
if (tud_resume_cb) tud_resume_cb();
break;
case DCD_EVENT_SOF:
+ TU_LOG2("\r\n");
for ( uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++ )
{
if ( _usbd_driver[i].sof )
@@ -460,6 +467,7 @@ void tud_task (void)
break;
case USBD_EVENT_FUNC_CALL:
+ TU_LOG2("\r\n");
if ( event.func_call.func ) event.func_call.func(event.func_call.param);
break;