2 * Copyright (C) 2009-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "CocoaDPMSSupport.h"
11 #include "ServiceBroker.h"
13 #include <CoreFoundation/CFNumber.h>
14 #include <IOKit/IOKitLib.h>
16 CCocoaDPMSSupport::CCocoaDPMSSupport()
18 m_supportedModes
.push_back(OFF
);
19 m_supportedModes
.push_back(STANDBY
);
22 bool CCocoaDPMSSupport::EnablePowerSaving(PowerSavingMode mode
)
24 // http://lists.apple.com/archives/Cocoa-dev/2007/Nov/msg00267.html
25 // This is an unsupported system call that might kernel panic on PPC boxes
26 // The reported OSX-PPC panic is unverified so we are going to enable this until
27 // we find out which OSX-PPC boxes have problems, then add detect/disable for those boxes.
28 io_registry_entry_t r
= IORegistryEntryFromPath(kIOMasterPortDefault
, "IOService:/IOResources/IODisplayWrangler");
36 return (IORegistryEntrySetCFProperty(r
, CFSTR("IORequestIdle"), kCFBooleanTrue
) == 0);
42 bool CCocoaDPMSSupport::DisablePowerSaving()
44 // http://lists.apple.com/archives/Cocoa-dev/2007/Nov/msg00267.html
45 // This is an unsupported system call that might kernel panic on PPC boxes
46 // The reported OSX-PPC panic is unverified so we are going to enable this until
47 // we find out which OSX-PPC boxes have problems, then add detect/disable for those boxes.
48 io_registry_entry_t r
= IORegistryEntryFromPath(kIOMasterPortDefault
, "IOService:/IOResources/IODisplayWrangler");
53 return (IORegistryEntrySetCFProperty(r
, CFSTR("IORequestIdle"), kCFBooleanFalse
) == 0);