Computer not entering Standby

Post Reply
Space

Posts: 2841
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

Computer not entering Standby

#1

Post by Space » Tue Aug 19, 2014 6:47 pm

I am hoping I can get some help on this issue that I have been having since day one. I have been living with it, but am now taking some time to find a solution.

I don't use MSE Standby Tool, since I feel that Win7 should handle this without any extra tool, but it it will fix this problem, I may be willing to try it. I have been reluctant to do so up until now because I had everything working as I wanted (except for this one issue) and I didn't want to risk screwing that up.

My problem has to do with "Away mode"...

When my HTPC wakes up to do a recording, it goes in to "unattended wakeup" mode which involves being in "Away mode". After the recording is done, I have DVRMSToolbox set to run comskip. After this is done, 2 minutes later, the PC goes back to sleep.

This is exactly what I want. I prevent the PC from going to sleep during the DVRMSToolbox run by having my own AutoHotkey script detect the process is running and prevent the PC from going to Standby similar to how WMC does it (you can see it when you run powercfg -requests). Just as an FYI, here is part of the command I use to tell the PC to not go to sleep while comskip is running:

DllCall("SetThreadExecutionState","UInt",ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED)

I had tried DVRMSToolbox's "check box" that says to not allow the PC to sleep while it is running, but this did not work for me (the PC never went to sleep), so I had to make my own.

Anyway, that all works, that is not my problem, my problem is when I do this:

Manually wake HTPC with remote, watch recorded shows. While watching shows, a scheduled recording starts in the background. Before this recording is finished, press the "standby" button on the remote. This causes the PC to go in to "Away mode" (TV goes black, but PC still stays on and continues recording). After the recording has finished, the comskip completes. Two minutes later (I have the "system unattended sleep timeout" set to 2 minutes), nothing happens, 60 minutes later (I have the Idle timeout set to 60 minutes), nothing happens. The PC does not go to Standby, even hours after the recording has completed. It seems to ignore both the unattended sleep timeout and the idle timeout and just never goes to Standby mode, it just sits in "Away mode" indefinitely.

While it is in this state, if I press the standby button on the remote, it causes the PC to come out of Away mode in to normal mode (TV screen on), if I then press the button again, it goes in to Standby.

During the time it is in this "Away mode" state, I have had a script run "powercfg -requests" in the background and there is nothing listed there, so this is not preventing the PC from going to Standby. I have the system set to ignore any remote connections, so that should not prevent Standby either (plus if there were remote connections, I should see those in the "powercfg -requests" output, but there is nothing).

I am not sure if there is any setting that can fix this issue, I have looked for a long time and have come up with nothing. I did see mention that when you go in to "Standby mode" manually, that this is not considered "unattended", so the "system unattended sleep timeout" is not in play, but it should still respect the idle timeout.
I am wondering if there is anything I can execute after I manually put the system in to "Away mode" that would get it to go to Standby after all recordings/comskip have completed. I already have an AutoHotkey script that is able to detect when the PC goes in to Away mode, so it would be possible to run anything at that point that might allow the normal idle timeout to start working again.

So my questions are, does anyone know why this may not be working, or any tests I can run to find out what may be preventing the idle timer from expiring? Will MCE Standby tool help me here? I don't really want to have it running all the time, but I know it can make some system changes that may make a difference (although I can't find any info an any additional settings that I don't already know about) without having to have it run all the time. If I do have it running at startup, will it work with the technique I use to not have the PC go to Standby while comskip is running?

Thanks for taking the time to read this, and any help you may be able to provide.

oakley516

Posts: 113
Joined: Sun Mar 16, 2014 9:59 pm
Location: LI, NY

HTPC Specs: Show details

#2

Post by oakley516 » Tue Aug 19, 2014 8:33 pm

Could it be that maybe your script is not clearing the ES_AwayMode_Required when it completes so the system remains in Away Mode?

In that state, it won't idle back to sleep and that seems to be what you are experiencing.

Space

Posts: 2841
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#3

Post by Space » Wed Aug 20, 2014 3:47 am

oakley516 wrote:Could it be that maybe your script is not clearing the ES_AwayMode_Required when it completes so the system remains in Away Mode?

In that state, it won't idle back to sleep and that seems to be what you are experiencing.
I clear it with this:

DllCall("SetThreadExecutionState","UInt",ES_CONTINUOUS)

It works fine when the system wakes up on it's own (unattended mode), records a show and runs comskip. It goes to sleep 2 minutes after I the script runs the above command.

Also, I am able to put the system in to Standby manually, whereas if I was not clearing that state, it would only allow me to go in to Away mode.

And lastly, if I run "powercfg -requests" there is nothing listed as blocking Standby.

I am thinking that there is something else preventing the idle timer from expiring. I am looking for ways to monitor this timer, or the Away mode timer (if that timer is even involved in this scenario.)

The Away mode timer works differently than the idle timer. The idle time just checks for user input and if no input is detected in a certain period, it attempts to put the system in to Standby (or Away mode if any application has requested it).

The Away mode timer seems to be triggered to start it's countdown when there is no longer any apps requesting Away mode. So as soon as my script tells the system that it no longer needs Away mode, the 2 minute time starts and then it goes to Standby (but only when it is in unattended mode). Theoretically, if there was an app that was continually requesting Away mode, and then immediately removing that request, the timer would never expire, but I don't think my script is doing that (it logs every time it requests/releases Away mode) and I don't know how to monitor it to see if anything else is doing so.

I am not sure if there is a way to force it in to unattended mode even though the system woke up due to user request. I would think that pushing the standby button on the remote, which causes the PC to go in to Away mode would also cause it to go in to unattended mode, but apparently that is not the way it works. But even if it does not work that way, it should STLL at least react to the idle timer expiring...

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#4

Post by mdavej » Wed Aug 20, 2014 1:12 pm

Way too complicated. Disable away mode and install MST.

oakley516

Posts: 113
Joined: Sun Mar 16, 2014 9:59 pm
Location: LI, NY

HTPC Specs: Show details

#5

Post by oakley516 » Sun Aug 24, 2014 5:54 pm

mdavej wrote:Way too complicated. Disable away mode and install MST.
I don't think you can disable Away Mode if you will be using the power button on the remote to put the PC to sleep. If you disable the Away Mode, then the PC will actually go to sleep whenever you press the power button, even if a recording is in progress.

The Away Mode prevents that from happening.

Space

Posts: 2841
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#6

Post by Space » Mon Aug 25, 2014 2:20 am

Yes, you are correct, disabling Away mode is a bad idea. When I find some time I am going to do some more testing on this to see if I can figure out exactly when it occurs and if there is anything I can do to resolve it.

Currently what I do is just look to see if there is a recoding in progress, and if there is, I just turn the TV off without pressing the Standby button on the remote. This seems to work, the PC goes to sleep sometime after the recording is completed. I am not sure if it only works if the recording finishes before the 60-minute idle timer expires so that it goes directly to sleep after the recording (no need to go in to Away Mode), or if the idle to Away Mode works as well, so I will have to test that.

If the idle to Away Mode works (and then it automatically goes to Standby after recording is done), then the only scenario that does not work is if I MANUALLY transition the PC from full awake to Away Mode. In this scenario the PC stays in Away Mode forever (or until I manually transition it in to full awake mode and then manually put it in to Standby mode).

Post Reply