Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rbp] Disable Hibernate and Suspend related power options for Raspberry ... #2403

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions xbmc/powermanagement/PowerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@
#include "osx/CocoaPowerSyscall.h"
#elif defined(TARGET_ANDROID)
#include "android/AndroidPowerSyscall.h"
#elif defined(_LINUX) && defined(HAS_DBUS)
#elif defined(TARGET_LINUX)
#include "linux/FallbackPowerSyscall.h"
#if defined(HAS_DBUS)
#include "linux/ConsoleUPowerSyscall.h"
#include "linux/ConsoleDeviceKitPowerSyscall.h"
#include "linux/SystemdUPowerSyscall.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(_WIN32)
#include "powermanagement/windows/Win32PowerSyscall.h"
extern HWND g_hWnd;
Expand All @@ -70,7 +73,8 @@ void CPowerManager::Initialize()
m_instance = new CCocoaPowerSyscall();
#elif defined(TARGET_ANDROID)
m_instance = new CAndroidPowerSyscall();
#elif defined(_LINUX) && defined(HAS_DBUS)
#elif defined(TARGET_LINUX)
#if defined(HAS_DBUS)
if (CConsoleUPowerSyscall::HasConsoleKitAndUPower())
m_instance = new CConsoleUPowerSyscall();
else if (CConsoleDeviceKitPowerSyscall::HasDeviceConsoleKit())
Expand All @@ -79,10 +83,13 @@ void CPowerManager::Initialize()
m_instance = new CSystemdUPowerSyscall();
else if (CUPowerSyscall::HasUPower())
m_instance = new CUPowerSyscall();
#ifdef HAS_HAL
#if defined(HAS_HAL)
else
m_instance = new CHALPowerSyscall();
#endif
#endif // HAS_HAL
#endif // HAS_DBUS
if (m_instance == NULL)
m_instance = new CFallbackPowerSyscall();
#elif defined(_WIN32)
m_instance = new CWin32PowerSyscall();
#endif
Expand Down
4 changes: 2 additions & 2 deletions xbmc/powermanagement/PowerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class CNullPowerSyscall : public IPowerSyscall
virtual bool Reboot() { return false; }

virtual bool CanPowerdown() { return true; }
virtual bool CanSuspend() { return true; }
virtual bool CanHibernate() { return true; }
virtual bool CanSuspend() { return false; }
virtual bool CanHibernate() { return false; }
virtual bool CanReboot() { return true; }

virtual int BatteryLevel() { return 0; }
Expand Down
39 changes: 39 additions & 0 deletions xbmc/powermanagement/linux/FallbackPowerSyscall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2005-2013 Team XBMC
* http://www.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_LINUX)

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