summaryrefslogtreecommitdiff
path: root/package/xbmc/patches/001-simplepm.patch
blob: 41ded94fa9b7078800c01bc5cf9be8294326ad74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
diff -Nur xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/LinuxPowerSyscall.cpp xbmc-12.3-Frodo/xbmc/powermanagement/linux/LinuxPowerSyscall.cpp
--- xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/LinuxPowerSyscall.cpp	1970-01-01 01:00:00.000000000 +0100
+++ xbmc-12.3-Frodo/xbmc/powermanagement/linux/LinuxPowerSyscall.cpp	2014-01-10 16:23:32.238217592 +0100
@@ -0,0 +1,55 @@
+/*
+ *      Copyright (C) 2014 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/>.
+ *
+ */
+ 
+#if defined (_LINUX)
+
+#include <stdlib.h>
+#include "LinuxPowerSyscall.h"
+#include "utils/log.h"
+
+CLinuxPowerSyscall::CLinuxPowerSyscall()
+{ 
+	CLog::Log(LOGINFO, "Selected LinuxPower as PowerSyscall");
+}
+
+CLinuxPowerSyscall::~CLinuxPowerSyscall()
+{ }
+
+bool CLinuxPowerSyscall::Powerdown()
+{
+  system("/sbin/poweroff -F");
+  return 0;
+}
+
+bool CLinuxPowerSyscall::Reboot()
+{
+  system("/sbin/reboot -F");
+  return 0;
+}
+
+int CLinuxPowerSyscall::BatteryLevel(void)
+{ }
+
+bool CLinuxPowerSyscall::PumpPowerEvents(IPowerEventsCallback *callback)
+{    
+  return true;
+}
+
+#endif
diff -Nur xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/LinuxPowerSyscall.h xbmc-12.3-Frodo/xbmc/powermanagement/linux/LinuxPowerSyscall.h
--- xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/LinuxPowerSyscall.h	1970-01-01 01:00:00.000000000 +0100
+++ xbmc-12.3-Frodo/xbmc/powermanagement/linux/LinuxPowerSyscall.h	2014-01-10 14:57:23.365205874 +0100
@@ -0,0 +1,44 @@
+#pragma once
+/*
+ *      Copyright (C) 2014 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/>.
+ *
+ */
+
+#if defined (_LINUX)
+#include "powermanagement/IPowerSyscall.h"
+
+class CLinuxPowerSyscall : public CPowerSyscallWithoutEvents
+{
+public:
+  CLinuxPowerSyscall();
+  ~CLinuxPowerSyscall();
+
+  virtual bool Powerdown();
+  virtual bool Suspend(void) { return false; }
+  virtual bool Hibernate(void) { return false; }
+  virtual bool Reboot();
+
+  virtual bool CanPowerdown(void) { return true; }
+  virtual bool CanSuspend(void) { return false; }
+  virtual bool CanHibernate(void) { return false; }
+  virtual bool CanReboot(void) { return true; }
+  virtual int  BatteryLevel(void);
+
+  virtual bool PumpPowerEvents(IPowerEventsCallback *callback);
+};
+#endif
diff -Nur xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/Makefile xbmc-12.3-Frodo/xbmc/powermanagement/linux/Makefile
--- xbmc-12.3-Frodo.orig/xbmc/powermanagement/linux/Makefile	2013-12-12 22:47:49.000000000 +0100
+++ xbmc-12.3-Frodo/xbmc/powermanagement/linux/Makefile	2014-01-10 14:27:13.411383558 +0100
@@ -2,7 +2,8 @@
      ConsoleUPowerSyscall.cpp \
      HALPowerSyscall.cpp \
      UPowerSyscall.cpp \
-     SystemdUPowerSyscall.cpp
+     SystemdUPowerSyscall.cpp \
+     LinuxPowerSyscall.cpp
 
 LIB=powermanagement_linux.a
 
diff -Nur xbmc-12.3-Frodo.orig/xbmc/powermanagement/PowerManager.cpp xbmc-12.3-Frodo/xbmc/powermanagement/PowerManager.cpp
--- xbmc-12.3-Frodo.orig/xbmc/powermanagement/PowerManager.cpp	2013-12-12 22:47:49.000000000 +0100
+++ xbmc-12.3-Frodo/xbmc/powermanagement/PowerManager.cpp	2014-01-14 11:19:11.558337441 +0100
@@ -46,6 +46,9 @@
 #include "linux/ConsoleDeviceKitPowerSyscall.h"
 #include "linux/SystemdUPowerSyscall.h"
 #include "linux/UPowerSyscall.h"
+#ifdef HAS_SIMPLEPM
+#include "linux/LinuxPowerSyscall.h"
+#endif
 #ifdef HAS_HAL
 #include "linux/HALPowerSyscall.h"
 #endif
@@ -83,6 +86,10 @@
     m_instance = new CSystemdUPowerSyscall();
   else if (CUPowerSyscall::HasUPower())
     m_instance = new CUPowerSyscall();
+#ifdef HAS_SIMPLEPM
+  else
+    m_instance = new CLinuxPowerSyscall();
+#endif
 #ifdef HAS_HAL
   else
     m_instance = new CHALPowerSyscall();