Go Down

Topic: leonardo as keyboard does not wake windows 7 from sleep (Read 7619 times) previous topic - next topic


Mike, thank you for the explanation.
As I understand, Keyboard.systemControl() is not for S3 suspend, but rather for S1. Am I right?
If your code incorporated to Arduino, should we update Documentation as well?

Mike T

I'm not that confident with the power levels S1 to S5. Microsoft describes their interpretation here:

I haven't found reasonable information which of these system power modes maps to which device mode D0 to D4 for the USB ports. This might even change between operating systems versions or different operating systems.

Actually it doesn't matter, the only relevant points which matter are:
  • is the USB bus suspended
  • has the operating system enabled the USB wakep feature before suspending the USB bus

Both is handled in wakeupHost():
 && (_usbSuspendState & (1<<SUSPI))
 && (_usbCurrentStatus & FEATURE_REMOTE_WAKEUP_ENABLED))

From a usability perspective, it would be good to provide an extra function on top of the systemControl() and wakeupHost() function or replace the wakeUp function:

Code: [Select]
bool Wakeup() {
  if(USBDevice.wakeupHost()) {
    return true;
  } else {
    return (Keyboard.systemControl(SYSTEM_CONTROL_WAKEUP) == 1);

In my tests I've never used SYSTEM_CONTROL_WAKEUP.



Thank you Michael.
Hope this stuff will find it's land in Arduino)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131