diff --git a/core/usbd_core.c b/core/usbd_core.c index d78e8fd8..4d1701cb 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -517,6 +517,11 @@ static bool usbd_std_device_req_handler(struct usb_setup_packet *setup, uint8_t case USB_REQUEST_CLEAR_FEATURE: case USB_REQUEST_SET_FEATURE: if (value == USB_FEATURE_REMOTE_WAKEUP) { + if (setup->bRequest == USB_REQUEST_SET_FEATURE) { + usbd_event_handler(USBD_EVENT_SET_REMOTE_WAKEUP); + } else { + usbd_event_handler(USBD_EVENT_CLR_REMOTE_WAKEUP); + } } else if (value == USB_FEATURE_TEST_MODE) { #ifdef CONFIG_USBDEV_TEST_MODE usbd_core_cfg.test_mode = true; @@ -554,7 +559,6 @@ static bool usbd_std_device_req_handler(struct usb_setup_packet *setup, uint8_t usbd_core_cfg.configured = true; usbd_class_event_notify_handler(USBD_EVENT_CONFIGURED, NULL); usbd_event_handler(USBD_EVENT_CONFIGURED); - usbd_configure_done_callback(); } *len = 0; break; @@ -1294,6 +1298,11 @@ __WEAK void usbd_event_handler(uint8_t event) case USBD_EVENT_SUSPEND: break; case USBD_EVENT_CONFIGURED: + usbd_configure_done_callback(); + break; + case USBD_EVENT_SET_REMOTE_WAKEUP: + break; + case USBD_EVENT_CLR_REMOTE_WAKEUP: break; default: diff --git a/core/usbd_core.h b/core/usbd_core.h index 3273b5e3..3328cffe 100644 --- a/core/usbd_core.h +++ b/core/usbd_core.h @@ -35,8 +35,10 @@ enum usbd_event_type { USBD_EVENT_RESUME, /** USB connection resumed by the HOST */ /* USB DEVICE STATUS */ - USBD_EVENT_CONFIGURED, /** USB configuration done */ - USBD_EVENT_SET_INTERFACE, /** USB interface selected */ + USBD_EVENT_CONFIGURED, /** USB configuration done */ + USBD_EVENT_SET_INTERFACE, /** USB interface selected */ + USBD_EVENT_SET_REMOTE_WAKEUP, /** USB set remote wakeup */ + USBD_EVENT_CLR_REMOTE_WAKEUP, /** USB clear remote wakeup */ USBD_EVENT_UNKNOWN };