RasPlex / OpenPHT

OpenPHT is a community driven fork of Plex Home Theater
Other
596 stars 110 forks source link

Power manager doesn't allow Windows Away-Mode #124

Open tomillr opened 8 years ago

tomillr commented 8 years ago

OpenPHT doesn't seem to properly support the Windows Away-Mode, which has been a part of Windows since XP. This basically breaks the CEC functionality in Windows:

When Windows tries to wake system for background tasks (for example scheduled Windows Update or a tv recording), OpenPHT doesn't recognize the away-mode call and overrides it.

Instead of the system remaining "silent", OpenPHT incorrectly sends a CEC command and wakes up connected TV and AVR.


OpenPHT needs to register to receive away-mode status:

RegisterPowerSettingNotification(m_hWnd, &GUID_SYSTEM_AWAYMODE, DEVICE_NOTIFY_WINDOW_HANDLE);

The powermanager then needs to check for the Away-Mode call like this:

case PBT_POWERSETTINGCHANGE:
{
POWERBROADCAST_SETTING* s = (POWERBROADCAST_SETTING*)nEventData;
if( s != NULL && IsEqualGUID( s->PowerSetting, GUID_SYSTEM_AWAYMODE ) )
// The computer is entering "away" mode.

Further technical documentation is available in the attached documents or over on MSDN: MSDN documentation

AvailabilityRequests.pdf awaymode.pdf

OpenPHT: v1.62, default skin, Intel NUC, Windows 8.1 x64, Pulse Eight HDMI-CEC adapter PMS: 1.0.3, Windows 8.1 x64