I have a computer (Dell Optiplex 170L, Windows XP) on which I'm testing out wake-on-lan functions. I have a script which wakes it up with the linux wakeonlan program successfully and then performs a ping. However, a little over 100 seconds after wakeup, it falls asleep again, interrupting or preventing what I wanted to wake it up for.
| |||
|
feedback
|
|
I have noticed the same behaviour with a Windows7 laptop. Seems if a laptop is woken up using WoL, then Windows treats it differently. If there is no input to the machine within 2 minutes then Windows puts it back to sleep. The solution is to tell Windows immediately after waking the machine that it shouldnt transition the machine to a low power state. SetThreadExecutionState is the function that you need to call to prevent windows from transitioning it to low power mode. Depending on the flags you call it with, the effect varies. You basically have to call
when Windows starts and then call
once your work is done. ES_SYSTEM_REQUIRED implies to Windows that the system needs to be awake. ES_CONTINUOUS says that the state the machine has been set to, ie always stay awake, needs to remain till it has been otherwise changed by calling the same function with a diff parameter. Once your work is done, you make the second call. This is called with only the ES_CONTINUOUS. By not specifying ES_SYSTEM_REQUIRED, you are resetting the state to the default, ie allow Windows to manage the power state. And because of ES_CONTINUOUS, it will remain in this state till otherwise changed. Btw, making the first call will only prevent Windows from managing power. If you have any other software that manages power, it will still transition the machine. I know, this answer comes after many months of the original question, but am posting hoping that it helps the next guy who comes along. | |||||
feedback
|
|
I found this site which has software called StayAwake that prevents this behavior of falling asleep based on inactivity after WOL. Unfortunately, it prevents the computer from falling asleep altogether, overriding power options. However, I was able to schedule a task that explicitly tells the computer to sleep on the hour throughout the day, and Wake-On-Lan will still wake it up just the same, at least theoretically. I still have some problems with WOL as you'll see in the questions I asked, but it may be hardware related. | |||
|
feedback
|