Loading...
Pages: [1]   Go Down
Author Topic: leonardo as keyboard does not wake windows 7 from sleep  (Read 332 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello to the forum,
would you please help me solving a stupid problem.

i use a leonardo as a hid keyboard on win 7.
buttons work fine using:

Keyboard.press('y');
      delay(500);
      Keyboard.releaseAll();   

but when the computer goes to sleep, the buttons from my leonardo do not wake up the computer from sleep.

i figured out, that in the win 7 device manager my standard keyboard (also hid) shows up the option: "allow this device to wake the computer", but my leonardo (hid as well) does not.

i checked this out on mac 10.6.8 and - the same problem.
i configured the leonardo as a hid mouse - the same thing.

why could that be?
wolfgang

Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13898
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can reproduce that on my Mac, it (the Leonardo) seems to freeze. Maybe it isn't getting enough power in sleep mode.

Normally the "On" LED is on, and when I press a button to send something (keystrokes) the Tx LED lights up briefly. However when the Mac is asleep the Tx LED lights up and stays lit up (and the Mac doesn't wake up).
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i guess it could not be a sleep power issue.
i am using buttons with leds powered by the usb 5v and a resistor.
the leds keep burning while computer is asleep.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i can reproduce this on win7 as well.
after pressing a button, the tx light stays on.
after bringing back the computer from sleep the tx light goes off or into normal states.
Logged

Austin, TX
Offline Offline
Sr. Member
****
Karma: 12
Posts: 428
carpe diem
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is an excerpt from an Atmel app note about the Remote Wake feature:
http://www.atmel.com/Images/doc7604.pdf

The Arduino USB code may not have this feature and may need to be added.
It doesn't look like it would be difficult to add.

Quote
6.3 How to manage the Remote Wake Up feature
The Remote Wake Up is an optional feature specified by the USB to allow the device to wake
the host up from a stand by mode (refer to the USB specification for further details). This request
is the only request which can be initiated by the device, but it has to be allowed by the host. The
host sends a Set Feature request to enable the Remote Wake Up feature just before sending
the suspend request. If the host did not send the Set Feature (RemoteWakeUpEnable), the
device is not allowed to perform this feature.
A USB device reports its ability to support remote wakeup in its configuration descriptor (refer
below to see how it is done with Atmel library). If a device supports remote wakeup, it must also
be allowed the capability to be enabled and disabled using the standard USB requests.
The configuration descriptor is defined in the usb_descriptors.h file as below:
// HID Mouse CONFIGURATION
#define NB_INTERFACE 1
#define CONF_NB 1
#define CONF_INDEX 0
#define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
#define MAX_POWER 50 // 100 mA
To setup the Remote Wake Up feature, you have to modify the CONF_ATTRIBUTES as below:
#define CONF_ATTRIBUTES (USB_CONFIG_BUSPOWERED|USB_CONFIG_REMOTEWAKEUP)
If the device supports the Remote Wake Up feature, the user has to manage the
Set_Feature(DEVICE_REMOTE_WAKEUP) request using the void usb_set_feature(void).
Once the Set_Feature(DEVICE_REMOTE_WAKEUP) is well managed, you can use any button
(must be used in external interrupt/pin change mode) for example to wake up the host. To do
this, you have to take care of the following details:
• First, the USB controller must have detected the “suspend” state of the line: the remote
• wake-up can only be sent when a SUSPI flag is set.
• The firmware has then the ability to set RMWKUP to send the “upstream resume” stream.
• This will automatically be done by the controller after 5ms of inactivity on the USB line.
• When the controller starts to send the “upstream resume”, the UPRSMI interrupt is triggered
• (if enabled). SUSPI is cleared by hardware.
• RMWKUP is cleared by hardware at the end of the “upstream resume”.
• If the controller detects a good “End Of Resume” signal from the host, an EORSMI interrupt
is triggered (if enabled).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you for the information that it is possible,
as you told and i read this is about the Atmel library,
but in arduino 1.0.3 there is no usb_descriptors.h file - right?
how could that be implemented in arduino and who would be the person for that?
sincerely
w

Logged

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13898
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You could report it here:

https://github.com/arduino/Arduino/issues
Logged


Pages: [1]   Go Up
Print
 
Jump to: