|
|
|
@ -32,13 +32,13 @@
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
|
|
#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT)
|
|
|
|
|
#if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_CONSOLEKIT)
|
|
|
|
|
#include <tqdbusdata.h>
|
|
|
|
|
#include <tqdbusmessage.h>
|
|
|
|
|
#include <tqdbusproxy.h>
|
|
|
|
|
#include <tqdbusvariant.h>
|
|
|
|
|
#include <tqdbusconnection.h>
|
|
|
|
|
#endif // defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UPOWER) || defined(WITH_DEVKITPOWER) || defined(WITH_HAL) || defined(WITH_CONSOLEKIT)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
TDERootSystemDevice::TDERootSystemDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
|
|
|
|
|
m_hibernationSpace = -1;
|
|
|
|
@ -247,32 +247,6 @@ bool TDERootSystemDevice::canSuspend() {
|
|
|
|
|
}
|
|
|
|
|
#endif// WITH_DEVKITPOWER
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_HAL
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if (dbusConn.isConnected()) {
|
|
|
|
|
TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn);
|
|
|
|
|
if (halProperties.canSend()) {
|
|
|
|
|
// can suspend?
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
TQT_DBusMessage reply;
|
|
|
|
|
params.clear();
|
|
|
|
|
params << TQT_DBusData::fromString("power_management.can_suspend");
|
|
|
|
|
reply = halProperties.sendWithReply("GetPropertyBoolean", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
|
|
|
|
|
return reply[0].toBool();
|
|
|
|
|
}
|
|
|
|
|
params.clear();
|
|
|
|
|
params << TQT_DBusData::fromString("power_management.can_suspend_to_ram");
|
|
|
|
|
reply = halProperties.sendWithReply("GetPropertyBoolean", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
|
|
|
|
|
return reply[0].toBool();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_HAL
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TDEHWLIB_DAEMONS
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
@ -362,32 +336,6 @@ bool TDERootSystemDevice::canHibernate() {
|
|
|
|
|
}
|
|
|
|
|
#endif// WITH_DEVKITPOWER
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_HAL
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if (dbusConn.isConnected()) {
|
|
|
|
|
TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn);
|
|
|
|
|
if (halProperties.canSend()) {
|
|
|
|
|
// can hibernate?
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
TQT_DBusMessage reply;
|
|
|
|
|
params.clear();
|
|
|
|
|
params << TQT_DBusData::fromString("power_management.can_hibernate");
|
|
|
|
|
reply = halProperties.sendWithReply("GetPropertyBoolean", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
|
|
|
|
|
return reply[0].toBool();
|
|
|
|
|
}
|
|
|
|
|
params.clear();
|
|
|
|
|
params << TQT_DBusData::fromString("power_management.can_suspend_to_disk");
|
|
|
|
|
reply = halProperties.sendWithReply("GetPropertyBoolean", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
|
|
|
|
|
return reply[0].toBool();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_HAL
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TDEHWLIB_DAEMONS
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
@ -444,26 +392,6 @@ bool TDERootSystemDevice::canHybridSuspend() {
|
|
|
|
|
// No support "hybrid suspend" in org.freedesktop.UPower
|
|
|
|
|
// No support "hybrid suspend" in org.freedesktop.DeviceKit.Power
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_HAL
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if (dbusConn.isConnected()) {
|
|
|
|
|
TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn);
|
|
|
|
|
if (halProperties.canSend()) {
|
|
|
|
|
// can hybrid suspend?
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
TQT_DBusMessage reply;
|
|
|
|
|
params.clear();
|
|
|
|
|
params << TQT_DBusData::fromString("power_management.can_suspend_hybrid");
|
|
|
|
|
reply = halProperties.sendWithReply("GetPropertyBoolean", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
|
|
|
|
|
return reply[0].toBool();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_HAL
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TDEHWLIB_DAEMONS
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
@ -794,53 +722,6 @@ bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_DEVKITPOWER
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_HAL
|
|
|
|
|
{
|
|
|
|
|
// No support for "freeze" in org.freedesktop.Hal
|
|
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
|
|
dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
|
|
|
|
|
if ( dbusConn.isConnected() ) {
|
|
|
|
|
if (ps == TDESystemPowerState::Suspend) {
|
|
|
|
|
TQT_DBusProxy halPowerManagement(
|
|
|
|
|
"org.freedesktop.Hal",
|
|
|
|
|
"/org/freedesktop/Hal/devices/computer",
|
|
|
|
|
"org.freedesktop.Hal.Device.SystemPowerManagement",
|
|
|
|
|
dbusConn);
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
params << TQT_DBusData::fromInt32(0);
|
|
|
|
|
TQT_DBusMessage reply = halPowerManagement.sendWithReply("Suspend", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (ps == TDESystemPowerState::Hibernate) {
|
|
|
|
|
TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
|
|
|
|
|
"org.freedesktop.Hal",
|
|
|
|
|
"/org/freedesktop/Hal/devices/computer",
|
|
|
|
|
"org.freedesktop.Hal.Device.SystemPowerManagement",
|
|
|
|
|
"Hibernate");
|
|
|
|
|
TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (ps == TDESystemPowerState::HybridSuspend) {
|
|
|
|
|
TQT_DBusProxy halPowerManagement(
|
|
|
|
|
"org.freedesktop.Hal",
|
|
|
|
|
"/org/freedesktop/Hal/devices/computer",
|
|
|
|
|
"org.freedesktop.Hal.Device.SystemPowerManagement",
|
|
|
|
|
dbusConn);
|
|
|
|
|
TQValueList<TQT_DBusData> params;
|
|
|
|
|
params << TQT_DBusData::fromInt32(0);
|
|
|
|
|
TQT_DBusMessage reply = halPowerManagement.sendWithReply("SuspendHybrid", params);
|
|
|
|
|
if (reply.type() == TQT_DBusMessage::ReplyMessage) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif // WITH_HAL
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_TDEHWLIB_DAEMONS
|
|
|
|
|
{
|
|
|
|
|
TQT_DBusConnection dbusConn;
|
|
|
|
|