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
145
146
147
148
149
150
151
152
153
|
--- tdelibs/CMakeLists.txt.OR 2013-07-24 10:36:44.409135030 +0200
+++ tdelibs/CMakeLists.txt 2013-07-24 10:37:09.619389250 +0200
@@ -83,6 +83,7 @@
OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON )
OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} )
+option( WITH_DEVKITPOWER "Enable DevKit Power support" OFF )
option( WITH_UPOWER "Enable uPower support" ${WITH_ALL_OPTIONS} )
option( WITH_UDISKS "Enable uDisks support" ${WITH_ALL_OPTIONS} )
option( WITH_UDISKS2 "Enable uDisks2 support" ${WITH_ALL_OPTIONS} )
--- tdelibs/tdecore/CMakeLists.txt.ORI 2013-07-24 10:40:06.480153460 +0200
+++ tdelibs/tdecore/CMakeLists.txt 2013-07-24 10:40:38.037254501 +0200
@@ -21,6 +21,13 @@
if( WITH_UPOWER )
add_definitions( -DWITH_UPOWER )
+endif ( )
+
+if( WITH_DEVKITPOWER )
+ add_definitions( -DWITH_DEVKITPOWER )
+endif ( )
+
+if( WITH_UPOWER OR WITH_DEVKITPOWER )
set ( TDEUPOWER_INCLUDE_DIRECTORIES
${DBUS_TQT_INCLUDE_DIRS}
)
--- tdelibs/tdecore/tdehardwaredevices.cpp.ORI 2013-07-24 10:42:27.499248218 +0200
+++ tdelibs/tdecore/tdehardwaredevices.cpp 2013-07-24 10:55:02.895355871 +0200
@@ -70,13 +70,13 @@
#endif // WITH_NETWORK_MANAGER_BACKEND
// uPower and uDisks2 integration
-#if defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2)
+#if defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_DEVKITPOWER)
#include <tqdbusdata.h>
#include <tqdbusmessage.h>
#include <tqdbusproxy.h>
#include <tqdbusvariant.h>
#include <tqdbusconnection.h>
-#endif // defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2)
+#endif // defined(WITH_UPOWER) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_DEVKITPOWER)
#if defined(WITH_UDISKS) || defined(WITH_UDISKS2)
#include <tqdbuserror.h>
#include <tqdbusdatamap.h>
@@ -85,6 +85,14 @@
#if defined(WITH_UDISKS)
#include "tqdbusdatalist.h"
#endif // ddefined(WITH_UDISKS)
+#ifdef WITH_DEVKITPOWER
+#define DBUS_POWER_CONNECTION_NAME "org.freedesktop.DeviceKit.Power"
+#define DBUS_POWER_OBJECT_PATH "/org/freedesktop/DeviceKit/Power"
+#endif // WITH_DEVKITPOWER
+#ifdef WITH_UPOWER
+#define DBUS_POWER_CONNECTION_NAME "org.freedesktop.UPower"
+#define DBUS_POWER_OBJECT_PATH "/org/freedesktop/UPower"
+#endif // WITH_UPOWER
// BEGIN BLOCK
// Copied from include/linux/genhd.h
@@ -1364,10 +1372,10 @@
}
}
else {
-#ifdef WITH_UPOWER
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
if (dbusConn.isConnected()) {
- TQT_DBusProxy upowerProperties("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", dbusConn);
+ TQT_DBusProxy upowerProperties(DBUS_POWER_CONNECTION_NAME, DBUS_POWER_OBJECT_PATH, "org.freedesktop.DBus.Properties", dbusConn);
if (upowerProperties.canSend()) {
// can suspend?
TQValueList<TQT_DBusData> params;
@@ -1387,9 +1395,9 @@
else {
return FALSE;
}
-#else // WITH_UPOWER
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
return FALSE;
-#endif// WITH_UPOWER
+#endif// defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
}
}
@@ -1405,10 +1413,10 @@
}
}
else {
-#ifdef WITH_UPOWER
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
if (dbusConn.isConnected()) {
- TQT_DBusProxy upowerProperties("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", dbusConn);
+ TQT_DBusProxy upowerProperties(DBUS_POWER_CONNECTION_NAME, DBUS_POWER_OBJECT_PATH, "org.freedesktop.DBus.Properties", dbusConn);
if (upowerProperties.canSend()) {
// can hibernate?
TQValueList<TQT_DBusData> params;
@@ -1428,9 +1436,9 @@
else {
return FALSE;
}
-#else // WITH_UPOWER
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
return FALSE;
-#endif// WITH_UPOWER
+#endif// defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
}
}
@@ -1565,24 +1573,24 @@
return true;
}
else {
-#ifdef WITH_UPOWER
+#if defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
TQT_DBusConnection dbusConn;
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
if ( dbusConn.isConnected() ) {
if (ps == TDESystemPowerState::Suspend) {
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower",
+ DBUS_POWER_CONNECTION_NAME,
+ DBUS_POWER_OBJECT_PATH,
+ DBUS_POWER_CONNECTION_NAME,
"Suspend");
dbusConn.sendWithReply(msg);
return true;
}
else if (ps == TDESystemPowerState::Hibernate) {
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower",
+ DBUS_POWER_CONNECTION_NAME,
+ DBUS_POWER_OBJECT_PATH,
+ DBUS_POWER_CONNECTION_NAME,
"Hibernate");
dbusConn.sendWithReply(msg);
return true;
@@ -1594,9 +1602,9 @@
else {
return false;
}
-#else // WITH_UPOWER
+#else // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
return false;
-#endif // WITH_UPOWER
+#endif // defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER)
}
}
else if (ps == TDESystemPowerState::PowerOff) {
|