|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|