diff options
author | Stephan Raue <stephan@openelec.tv> | 2013-08-02 01:32:03 +0200 |
---|---|---|
committer | Stephan Raue <stephan@openelec.tv> | 2013-08-02 13:49:27 +0200 |
commit | 3c27e947a2c52c7b124b1bcf32f554b82b60f690 (patch) | |
tree | 986de3cc87c51383bdb7d6014a0e628b4fe24374 | |
parent | 3e7005ca78d17e3ad9c0630d336f28abefb234ca (diff) |
Disable Hibernate and Suspend related power options for Raspberry & Co. without (working) Upower/HAL/CK/Systemd support. Usually this devices dont support Suspend & Hibernate.
-rw-r--r-- | xbmc/powermanagement/PowerManager.cpp | 21 | ||||
-rw-r--r-- | xbmc/powermanagement/linux/FallbackPowerSyscall.h | 39 |
2 files changed, 53 insertions, 7 deletions
diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp index d658a97d2b..993477e8ca 100644 --- a/xbmc/powermanagement/PowerManager.cpp +++ b/xbmc/powermanagement/PowerManager.cpp @@ -40,14 +40,17 @@ #include "osx/CocoaPowerSyscall.h" #elif defined(TARGET_ANDROID) #include "android/AndroidPowerSyscall.h" -#elif defined(TARGET_POSIX) && defined(HAS_DBUS) +#elif defined(TARGET_POSIX) +#include "linux/FallbackPowerSyscall.h" +#if defined(HAS_DBUS) #include "linux/ConsoleUPowerSyscall.h" #include "linux/ConsoleDeviceKitPowerSyscall.h" #include "linux/LogindUPowerSyscall.h" #include "linux/UPowerSyscall.h" -#ifdef HAS_HAL +#if defined(HAS_HAL) #include "linux/HALPowerSyscall.h" -#endif +#endif // HAS_HAL +#endif // HAS_DBUS #elif defined(TARGET_WINDOWS) #include "powermanagement/windows/Win32PowerSyscall.h" extern HWND g_hWnd; @@ -73,7 +76,8 @@ void CPowerManager::Initialize() m_instance = new CCocoaPowerSyscall(); #elif defined(TARGET_ANDROID) m_instance = new CAndroidPowerSyscall(); -#elif defined(TARGET_POSIX) && defined(HAS_DBUS) +#elif defined(TARGET_POSIX) +#if defined(HAS_DBUS) if (CConsoleUPowerSyscall::HasConsoleKitAndUPower()) m_instance = new CConsoleUPowerSyscall(); else if (CConsoleDeviceKitPowerSyscall::HasDeviceConsoleKit()) @@ -82,10 +86,13 @@ void CPowerManager::Initialize() m_instance = new CLogindUPowerSyscall(); else if (CUPowerSyscall::HasUPower()) m_instance = new CUPowerSyscall(); -#ifdef HAS_HAL - else +#if defined(HAS_HAL) + else if(1) m_instance = new CHALPowerSyscall(); -#endif +#endif // HAS_HAL + else +#endif // HAS_DBUS + m_instance = new CFallbackPowerSyscall(); #elif defined(TARGET_WINDOWS) m_instance = new CWin32PowerSyscall(); #endif diff --git a/xbmc/powermanagement/linux/FallbackPowerSyscall.h b/xbmc/powermanagement/linux/FallbackPowerSyscall.h new file mode 100644 index 0000000000..a6ed27b150 --- /dev/null +++ b/xbmc/powermanagement/linux/FallbackPowerSyscall.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ +#pragma once +#include "powermanagement/IPowerSyscall.h" +#include "system.h" +#if defined(TARGET_POSIX) + +class CFallbackPowerSyscall : public CPowerSyscallWithoutEvents +{ +public: + virtual bool Powerdown() {return true; } + virtual bool Suspend() {return false; } + virtual bool Hibernate() {return false; } + virtual bool Reboot() {return true; } + + virtual bool CanPowerdown() {return true; } + virtual bool CanSuspend() {return false; } + virtual bool CanHibernate() {return false; } + virtual bool CanReboot() {return true; } + virtual int BatteryLevel() {return 0; } +}; +#endif |