Skip to content

Commit

Permalink
[power] Add back in powerdown and reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Mar 26, 2016
1 parent 8dec54f commit 522a68e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
34 changes: 34 additions & 0 deletions xbmc/powermanagement/linux/RaspberryPIPowerSyscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

#if defined(TARGET_RASPBERRY_PI)

#include "system.h"
#include "RaspberryPIPowerSyscall.h"
#if defined(HAS_DBUS)
#include "LogindUPowerSyscall.h"
#endif
#include "RBP.h"

bool CRaspberryPIPowerSyscall::VirtualSleep()
Expand All @@ -35,4 +39,34 @@ bool CRaspberryPIPowerSyscall::VirtualWake()
return true;
}

bool CRaspberryPIPowerSyscall::Powerdown()
{
int s = false;
#if defined(HAS_DBUS)
if (CLogindUPowerSyscall::HasLogind())
{
IPowerSyscall *m_instance = new CLogindUPowerSyscall;
if (m_instance->CanPowerdown())
s = m_instance->Powerdown();
delete m_instance;
}
#endif
return s;
}

bool CRaspberryPIPowerSyscall::Reboot()
{
int s = false;
#if defined(HAS_DBUS)
if (CLogindUPowerSyscall::HasLogind())
{
IPowerSyscall *m_instance = new CLogindUPowerSyscall;
if (m_instance->CanReboot())
s = m_instance->Reboot();
delete m_instance;
}
#endif
return s;
}

#endif
6 changes: 3 additions & 3 deletions xbmc/powermanagement/linux/RaspberryPIPowerSyscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class CRaspberryPIPowerSyscall : public CPowerSyscallVirtualSleep
CRaspberryPIPowerSyscall() : CPowerSyscallVirtualSleep() {}
virtual ~CRaspberryPIPowerSyscall() {}

virtual bool Powerdown() { return false; }
virtual bool Powerdown();
virtual bool Hibernate() { return false; }
virtual bool Reboot() { return false; }
virtual bool Reboot();

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

Expand Down

0 comments on commit 522a68e

Please sign in to comment.