summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-10-06 02:05:04 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-10-06 02:05:04 +0200
commit95b83ac28d43228cbcc6864e483c4f9f884275f4 (patch)
tree9d48f835043c30f1c1a04ba68be8dd8ac93db72f /src
parente7fb1fe3ea4bee5d99b2e57ef89b7aca5f86d258 (diff)
downloadkpowersave-95b83ac28d43228cbcc6864e483c4f9f884275f4.tar.gz
kpowersave-95b83ac28d43228cbcc6864e483c4f9f884275f4.zip
More accurate reporting failure while acquire org.freedesktop.Policy.Power
Diffstat (limited to 'src')
-rw-r--r--src/dbusHAL.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dbusHAL.cpp b/src/dbusHAL.cpp
index 3188669..7f72b83 100644
--- a/src/dbusHAL.cpp
+++ b/src/dbusHAL.cpp
@@ -218,8 +218,15 @@ bool dbusHAL::acquirePolicyPowerIface(){
return false;
}
- switch (dbus_bus_request_name(dbus_connection, "org.freedesktop.Policy.Power",
- DBUS_NAME_FLAG_REPLACE_EXISTING, NULL)) {
+ DBusError err;
+ dbus_error_init(&err);
+ int ret = dbus_bus_request_name(dbus_connection, "org.freedesktop.Policy.Power",
+ DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
+ if (dbus_error_is_set(&err)) {
+ kdWarning() << "Acquire org.freedesktop.Policy.Power interface failed with error: " << err.message << endl;
+ dbus_error_free(&err);
+ }
+ switch (ret) {
case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
kdDebug() << "Acquired org.freedesktop.Policy.Power interface" << endl;
acquiredPolicyPower = true;
@@ -229,7 +236,6 @@ bool dbusHAL::acquirePolicyPowerIface(){
acquiredPolicyPower = false;
break;
default:
- kdWarning() << "Unknown error while acquire org.freedesktop.Policy.Power interface" << endl;
acquiredPolicyPower = false;
break;
}