- August 23, 2016
- 4
- 0
- Home Country
- Hong Kong
MediaPortal Version: 1.14.0
Description
Dear Dev,
I have a machine with TVServer installed and use the PowerScheduler to shutdown the machine.
The standby time does not get reset after a system busy event is detected. It stays unchanged.
Had a quick look into the source code and it seems possible fix is to modify the CheckForStandby() function such that the _lastUserTime gets updated to current time when system not idle is detected. I may well be wrong or there is better way to do this.
I am happy to test the fix if you can send me the plugin files.
else
{
if (_idle)
{
Log.Info("PS: System changed from idle state to busy state");
_idle = false;
SendPowerSchedulerEvent(PowerSchedulerEventType.SystemBusy);
}
++ _lastUserTime = DateTime.Now <--Set _lastUserTime to current time
Log.Debug("PS: System is busy and should not go to standby");
}
Regards,
Edward
Steps to Reproduce:
Here's an extract of the log file and step to reproduce:
====PowerScheduler Initialize (For information only)====
[2016-08-23 07:59:23,063] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerScheduler service to GlobalServiceProvider
[2016-08-23 07:59:23,079] [Log ] [TVService] [INFO ] - PS: Starting PowerScheduler server plugin...
[2016-08-23 07:59:23,079] [Log ] [TVService] [DEBUG] - PS: LoadSettings()
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: PowerScheduler forces system to go to standby when idle: True
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Shutdown mode: Shutdown
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby after: 60 minutes
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Pre-wakeup time: 60 seconds
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Pre-no-standby time: 300 seconds
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby allowed until 24 o' clock
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby allowed until 24 o' clock on weekend
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Wakeup system for varios events: True
[2016-08-23 07:59:23,110] [Log ] [TVService] [DEBUG] - PS: Run command on power state change:
[2016-08-23 07:59:23,110] [Log ] [TVService] [INFO ] - PS: PowerSchedulerFactory
[2016-08-23 07:59:23,110] [Log ] [TVService] [DEBUG] - PS: Registered standby/wakeup handlers to PowerScheduler server plugin
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerEventHandler service to GlobalServiceProvider
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerControl remoting service
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: StandbyWakeupThread started
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - ProcessActiveHandler: Preventing standby for processes:
====First time powerscheduler check for events and detected I logon using terminal service====
[2016-08-23 07:59:24,140] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 07:59:24,155] [Log ] [PS StandbyWakeup] [DEBUG] - NetworkMonitorHandler: Network monitor started
[2016-08-23 07:59:24,545] [Log ] [PS StandbyWakeup] [DEBUG] - NetworkMonitorHandler: Idle limit in KB/s: 10
[2016-08-23 07:59:24,561] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 07:59:24,576] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 07:59:24,592] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Inspecting ActivePorts: StandbyPrevented
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyPrevented)
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is busy and should not go to standby
====I logged out and powerscheduler now detected system is idle and set the sleep timeout to 8:59:23====
[2016-08-23 08:00:58,161] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:00:58,161] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyAllowed)
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from busy state to idle state
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is idle and may go to standby
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Active standby is enabled - go to standby after idle timeout at 8:59:23
====I login again via terminal service====
[2016-08-23 08:01:28,394] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:01:28,394] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Inspecting ActivePorts: StandbyPrevented
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyPrevented)
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from idle state to busy state
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is busy and should not go to standby
====I logout but the idle timeout remained at 8:59:23. It should be 60 minutes from the time I logout based on my setting====
[2016-08-23 08:01:58,642] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:01:58,642] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyAllowed)
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from busy state to idle state
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is idle and may go to standby
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Active standby is enabled - go to standby after idle timeout at 8:59:23
Description
Dear Dev,
I have a machine with TVServer installed and use the PowerScheduler to shutdown the machine.
The standby time does not get reset after a system busy event is detected. It stays unchanged.
Had a quick look into the source code and it seems possible fix is to modify the CheckForStandby() function such that the _lastUserTime gets updated to current time when system not idle is detected. I may well be wrong or there is better way to do this.
I am happy to test the fix if you can send me the plugin files.
else
{
if (_idle)
{
Log.Info("PS: System changed from idle state to busy state");
_idle = false;
SendPowerSchedulerEvent(PowerSchedulerEventType.SystemBusy);
}
++ _lastUserTime = DateTime.Now <--Set _lastUserTime to current time
Log.Debug("PS: System is busy and should not go to standby");
}
Regards,
Edward
Steps to Reproduce:
Here's an extract of the log file and step to reproduce:
====PowerScheduler Initialize (For information only)====
[2016-08-23 07:59:23,063] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerScheduler service to GlobalServiceProvider
[2016-08-23 07:59:23,079] [Log ] [TVService] [INFO ] - PS: Starting PowerScheduler server plugin...
[2016-08-23 07:59:23,079] [Log ] [TVService] [DEBUG] - PS: LoadSettings()
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: PowerScheduler forces system to go to standby when idle: True
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Shutdown mode: Shutdown
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby after: 60 minutes
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Pre-wakeup time: 60 seconds
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Pre-no-standby time: 300 seconds
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby allowed until 24 o' clock
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Standby allowed until 24 o' clock on weekend
[2016-08-23 07:59:23,094] [Log ] [TVService] [DEBUG] - PS: Wakeup system for varios events: True
[2016-08-23 07:59:23,110] [Log ] [TVService] [DEBUG] - PS: Run command on power state change:
[2016-08-23 07:59:23,110] [Log ] [TVService] [INFO ] - PS: PowerSchedulerFactory
[2016-08-23 07:59:23,110] [Log ] [TVService] [DEBUG] - PS: Registered standby/wakeup handlers to PowerScheduler server plugin
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerEventHandler service to GlobalServiceProvider
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: Registered PowerScheduler as IPowerControl remoting service
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - PS: StandbyWakeupThread started
[2016-08-23 07:59:23,126] [Log ] [TVService] [DEBUG] - ProcessActiveHandler: Preventing standby for processes:
====First time powerscheduler check for events and detected I logon using terminal service====
[2016-08-23 07:59:24,140] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 07:59:24,155] [Log ] [PS StandbyWakeup] [DEBUG] - NetworkMonitorHandler: Network monitor started
[2016-08-23 07:59:24,545] [Log ] [PS StandbyWakeup] [DEBUG] - NetworkMonitorHandler: Idle limit in KB/s: 10
[2016-08-23 07:59:24,561] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 07:59:24,576] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 07:59:24,592] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Inspecting ActivePorts: StandbyPrevented
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyPrevented)
[2016-08-23 07:59:24,654] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is busy and should not go to standby
====I logged out and powerscheduler now detected system is idle and set the sleep timeout to 8:59:23====
[2016-08-23 08:00:58,161] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:00:58,161] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:00:58,192] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyAllowed)
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from busy state to idle state
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is idle and may go to standby
[2016-08-23 08:00:58,270] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Active standby is enabled - go to standby after idle timeout at 8:59:23
====I login again via terminal service====
[2016-08-23 08:01:28,394] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:01:28,394] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:01:28,425] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Inspecting ActivePorts: StandbyPrevented
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyPrevented)
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from idle state to busy state
[2016-08-23 08:01:28,503] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is busy and should not go to standby
====I logout but the idle timeout remained at 8:59:23. It should be 60 minutes from the time I logout based on my setting====
[2016-08-23 08:01:58,642] [Log ] [PS StandbyWakeup] [DEBUG] - PS: StandbyWakeupThread triggered by check interval
[2016-08-23 08:01:58,642] [Log ] [PS StandbyWakeup] [DEBUG] - PS: LoadSettings()
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetWakeupTimer()
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: No pending events found in the future which should wakeup the system
[2016-08-23 08:01:58,674] [Log ] [PS StandbyWakeup] [DEBUG] - PS: CheckForStandby()
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: SetStandbyMode(StandbyAllowed)
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [INFO ] - PS: System changed from busy state to idle state
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: System is idle and may go to standby
[2016-08-23 08:01:58,767] [Log ] [PS StandbyWakeup] [DEBUG] - PS: Active standby is enabled - go to standby after idle timeout at 8:59:23