[Approved] AwayMode as Option in PowerScheduler (1 Viewer)

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Re: AW: AwayMode as Option in PowerScheduler

    @tourettes:
    i know this one. but if i press the powerbutton on my remote, mp / tvserver checks if standby is allowed.

    if windows handles standby, you're right. but if the system is a "real" htpc, than mp handles standby and standby is not allowed if tvserver is working?!

    Unless you aren't disabling the MCE remote's or PC cases sleep buttons the tv service cannot block the user initiated suspend requests from those sources. OS will just notify that we are going to sleep - on Windows XP it is possible to block those requests.

    Some people might prefer to use the sleep button on their remotes instead of having to use MP menus or timer based suspend. I myself have blocked the sleep button on OS level settings and not allow user initiated sleeps at all - only the PS plugin + idle in homescreen. It would be much nicer to allow the MCE remote's sleep button as well.
     

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Re: AW: AwayMode as Option in PowerScheduler

    @tourettes:
    but this is the problem... some hw/driver don't support awaymode correctly... for me, it's the muted sound and that "hybrid"standbymode won't trigger.
    as i've seen so far, my patch won't let tvserver go to standby, if recording/timeshift/other actions are running...?!

    In theory adding an extra option to choose whether to allow away mode seems ok if people are having issues (although I would like to know how many people are having issues). Touretts is right in that away mode should only be used where needed but is this is problematic than it might help people by bypassing it and having the machine simply awake or asleep

    so when a recording takes place and MP wants to sleep, you machine goes quite happily into away mode? but once everything has finished and the machine should sleep properly this is not working??

    Or is it that if you turn the machine on whilst it is in away mode you get issues with muted sound?
     

    OnkelChris

    Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    AW: Re: AW: AwayMode as Option in PowerScheduler

    so when a recording takes place and MP wants to sleep, you machine goes quite happily into away mode? but once everything has finished and the machine should sleep properly this is not working??

    yep. if tvserver is busy and i request standby (windows is totally out of this, only MP is dealing standby, because it is a "real" htpc in the living room) and awaymode is allowed, than it turns screen black and mutes sound. after record is finished, it just stays in this mode. when pressing any button on remote, it comes back alive and shows the screen, but master sound is muted (i know, that there is a patch for master volume in win7, but if you configure your remote to deal with the volume of your TV or Receiver...)


    Or is it that if you turn the machine on whilst it is in away mode you get issues with muted sound?

    this behaviour occurs always, if awaymode was triggered...
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    I have this problem from time to time.

    What happens is I stop LiveTV and press the Power button on my remote (Hauupage) which is set in MP Config to put my PC into Standby. Most of the time it works, but occassionally I just get a blank screen and the PC stays on. There's no recordings scheduled and "Prevent standby when grabbing EPG" is unticked in TV Server config. I can't seem to wake the PC after it's gone into this mode, and have to do a hard reset/power-cycle and it does seem to reboot with the Master Volume muted.

    I don't actually allow PowerScheduler++ to put my PC into Standby, as then it tends to do so when I'm in the middle of a game! I'm still trying to get my PC configured properly so that Win7's power handling shuts down when MP is idle and I'm not doing anything else, as I asked about in this thread https://forum.team-mediaportal.com/...-53/correct-power-settings-gaming-htpc-98155/

    With MP closed and "No Standby while MP client is not running" unticked and "Prevent power off while processes are running" ticked, something is still blocking Win7 from going into standby. The tv.log shows the following:

    Code:
    2011-07-26 22:21:44.214016 [Powerscheduler Timer(20)]: PowerScheduler: LoadSettings
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: SetWakeupTimer
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting GenericWakeupHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ScheduledRecordingsHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting XmlTvImportWakeupHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: No pending events found in the future which should wakeup the system
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: CheckForStandby
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting GenericStandbyHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting RemoteClientStandbyHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ActiveStreamsHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ControllerActiveHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ProcessActiveHandler (SetupTv): prevents standby and power off
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting NetworkMonitorHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ActiveSharesHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: PreventStandby()
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: System is busy and should not go to standby

    That doesn't really tell me what is preventing standby.
     

    Mr Hipp

    Retired Team Member
  • Premium Supporter
  • April 2, 2006
    1,261
    188
    56
    Malmö
    Home Country
    Sweden Sweden
    I have this problem from time to time.

    What happens is I stop LiveTV and press the Power button on my remote (Hauupage) which is set in MP Config to put my PC into Standby. Most of the time it works, but occassionally I just get a blank screen and the PC stays on. There's no recordings scheduled and "Prevent standby when grabbing EPG" is unticked in TV Server config. I can't seem to wake the PC after it's gone into this mode, and have to do a hard reset/power-cycle and it does seem to reboot with the Master Volume muted.

    I don't actually allow PowerScheduler++ to put my PC into Standby, as then it tends to do so when I'm in the middle of a game! I'm still trying to get my PC configured properly so that Win7's power handling shuts down when MP is idle and I'm not doing anything else, as I asked about in this thread https://forum.team-mediaportal.com/...-53/correct-power-settings-gaming-htpc-98155/

    With MP closed and "No Standby while MP client is not running" unticked and "Prevent power off while processes are running" ticked, something is still blocking Win7 from going into standby. The tv.log shows the following:

    Code:
    2011-07-26 22:21:44.214016 [Powerscheduler Timer(20)]: PowerScheduler: LoadSettings
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: SetWakeupTimer
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting GenericWakeupHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ScheduledRecordingsHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting XmlTvImportWakeupHandler: 
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: No pending events found in the future which should wakeup the system
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: CheckForStandby
    2011-07-26 22:21:44.244016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting GenericStandbyHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting RemoteClientStandbyHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ActiveStreamsHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ControllerActiveHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ProcessActiveHandler (SetupTv): prevents standby and power off
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting NetworkMonitorHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: Inspecting ActiveSharesHandler: 
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: PreventStandby()
    2011-07-26 22:21:44.254016 [Powerscheduler Timer(20)]: PowerScheduler: System is busy and should not go to standby

    That doesn't really tell me what is preventing standby.


    The root cause it that SetupTv is running in the background (ProcessActiveHandler (SetupTv): prevents standby and power off) this prevents standby and enters away mode instead. The real problem is that Setup tv does not exit properly (just hangs in background).
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Ah, thanks for deciphering the log for me. I'll look for this next time it happens.

    I can't quite remember but I've got a feeling that it wasn't going to Away mode either when left idle, which is actually preferable for me seeing as I've been unable to wake it from that mode. I haven't had an issue with it going to Away mode when manually putting it in Standby with the Power button for some time now either, which is good.

    Ultimately it might be good to have a CPU monitor in PowerScheduler, which would allow me to let that handle Standby whilst still allowing me to play games, but without having to remember to put MP on the Home page.
     

    michael_t

    Portal Pro
    November 30, 2008
    1,258
    813
    Home Country
    Germany Germany
    AW: AwayMode as Option in PowerScheduler

    Well, I think we should put some things together, to have a common basis for further discussion:
    In Vista and Windows 7 there is no way for a software (not even MP TvServer) to prevent or deny a S3 (sleep) or S4 (hibernate) request issued by a user action (e.g. power off button, remote power off, ...) or by another program. A program needing the system up and running (e.g. while playing music) can only tell the Windows operating system that the system is not idle and therefore should not go to S3/S4 after the system idle timeout.

    To keep a Vista/Win7 system running even if the user (or another program) explicitly requests sleep mode, a program (exactly: a thread) has to enable away mode. Then the system will not go to sleep mode on a request for sleep but keep running (S1) with display and audio disabled. This is called away mode and is no power-saving state. Therefore away mode needs no driver or BIOS support, it is plain S1 with audio and display switched off.
    I explicitely wrote "sleep mode" and not S3/S4, because all explicit requests for hibernate (e.g. a remote power off mapped to hibernate) will not enter away mode (even if enabled) but still hibernate the system. So you should not use hibernate with away mode; the hybrid sleep mode will work perfectly.

    So what does PowerScheduler (the built-in one)?
    On Vista/Win7 systems PowerScheduler can not prevent explicit standby requests without enabling away mode. And therefore since MP 1.2 alpha (or even earlier?) PowerScheduler enables away mode while it is recording (or timeshifting or having network activity or ...). If you do not want this behaviour, you must not enable away mode, as it was before MP 1.2 alpha. Then you can suspend/hibernate your system in all situations (even while a recording is going on) with your remote control.
    As far as I understood, this is the idea of OnkelChris's patch. It provides a switch to choose if you want the post 1.2. alpha (away mode) or the pre 1.2 alpha (no away mode) behaviour of PowerScheduler.

    Michael

    PS: What is the difference to PowerScheduler++:
    PowerScheduler++ does not enable away mode for all situations, but differentiates among these (e.g. it enables away mode for recording, but not for local timeshifting) and allows individual settings for other situations (EPG grabbing, processes running, network activity, ...). And PowerScheduler++ leaves away mode automatically when it is no more needed, so the system can go to sleep.
     

    OnkelChris

    Retired Team Member
  • Premium Supporter
  • October 17, 2007
    764
    59
    Home Country
    Germany Germany
    AW: AwayMode as Option in PowerScheduler

    michael_t:
    no... you didn't get it right...

    my patch does prevent standby is a recording is active! it just gives the user the option to choose if away mode should be used. of course, MP needs the full control about "power management"! if remote is configured inside windows to go to standby/hibernate, this one will loose. if remote is configured with MP, than everything is fine with my patch...
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Re: AW: AwayMode as Option in PowerScheduler

    of course, MP needs the full control about "power management"! if remote is configured inside windows to go to standby/hibernate, this one will loose. if remote is configured with MP, than everything is fine with my patch...

    And that is the wrong assumption. Our user base uses MP on many different machines and if there is a way in windows 7 (ignore vista ;) ) to save a recording in requesting the system to go to away mode when a systemwide explicit request for sleep is made, that is the proper thing. I prefer windows to handle the sleepyness of the htpc.

    But more on track: Your patch does the following:
    If setting is on:
    - If MP receives a shutdown/sleep/whatever request from the user and a recording is active you will go to away mode instead of shutdown/sleep/whatever.
    If the setting is off:
    - If MP receives a shutdown/sleep/whatever request from the user and a recording is active you will do nothing at all.

    Your patch (should) does not affect the handling of systeminitiated sleep/shutdown requests.

    Correct?
     

    michael_t

    Portal Pro
    November 30, 2008
    1,258
    813
    Home Country
    Germany Germany
    AW: AwayMode as Option in PowerScheduler

    @michael_t:
    no... you didn't get it right...

    my patch does prevent standby is a recording is active! it just gives the user the option to choose if away mode should be used.
    Just what I said: you give the user the option to choose if away mode should be used (behaviour since MP 1.2. alpha) or not (behaviour before MP 1.2. alpha). I think that this is a good idea and I would support adding it to PowerScheduler to give the user more flexibility in configuration.
    BTW: PowerScheduler uses away mode not only if a recording is active (which makes much sense), but for all other situations preventing standby (timeshifting - which makes no sense for local timeshifting, network traffic, EPG grabbing, processes running etc.).
    if remote is configured inside windows to go to standby/hibernate, this one will loose. if remote is configured with MP, than everything is fine with my patch...
    I think you are wrong here. If the away mode option is deselected, your patch can only prevent a system idle timeout. It calls SetThreadExecutionState(ES_SYSTEM_REQUIRED|ES_CONTINUOUS) which basically has the same effect as calling SetThreadExecutionState(ES_SYSTEM_REQUIRED) in older versions of MP.
    But: Neither code can prevent a request for suspend by a user action (e.g. power button, remote control as Windows HID) or by another program including the MP client. If your remote control's power button is mapped to ACTION_SUSPEND in the MP config tool, then the MP client calls SetSuspendState(PowerState.Suspend) every time you press the remote power button. As far as I could see in the code, there is no check for active recordings before doing so. Since this request to suspend cannot be prevented or blocked by PowerScheduler, it should make no difference if the remote's power button is handled by Windows or by MP. Did you make other experiences?

    Michael
     

    Users who are viewing this thread

    Top Bottom