mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
support set/clear feature Device_remote_wakeup
This commit is contained in:
parent
1c2beba85c
commit
3a38cde53d
@ -167,13 +167,21 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event,
|
||||
void usbd_control_set_complete_callback( bool (*fp) (uint8_t, tusb_control_request_t const * ) );
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// APPLICATION API
|
||||
// Application API
|
||||
//--------------------------------------------------------------------+
|
||||
bool tud_mounted(void)
|
||||
{
|
||||
return _usbd_dev.config_num > 0;
|
||||
}
|
||||
|
||||
bool tud_remote_wakeup(void)
|
||||
{
|
||||
// only wake up host if this feature is enabled
|
||||
if (_usbd_dev.remote_wakeup_en ) dcd_remote_wakeup(TUD_OPT_RHPORT);
|
||||
|
||||
return _usbd_dev.remote_wakeup_en;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USBD Task
|
||||
//--------------------------------------------------------------------+
|
||||
@ -357,6 +365,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
|
||||
if ( TUSB_REQ_FEATURE_REMOTE_WAKEUP == p_request->wValue )
|
||||
{
|
||||
// Host enable remote wake up before suspending especially HID device
|
||||
_usbd_dev.remote_wakeup_en = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -364,6 +373,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const
|
||||
if ( TUSB_REQ_FEATURE_REMOTE_WAKEUP == p_request->wValue )
|
||||
{
|
||||
// Host disable remote wake up after resuming
|
||||
_usbd_dev.remote_wakeup_en = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include <common/tusb_common.h>
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
Loading…
x
Reference in New Issue
Block a user