[Powerdevil] [Bug 344456] Plasma 5 desktop does not suspend with only upower, no systemd

Lukáš Tinkl lukas at kde.org
Sun Feb 22 23:34:57 UTC 2015


https://bugs.kde.org/show_bug.cgi?id=344456

--- Comment #3 from Lukáš Tinkl <lukas at kde.org> ---
Are you really sure there's no login1 service on DBUS? It may not be visible
but it's activated on first usage.

The code responsible for querying the suspend/hibernate capabilities first
tries with login1 and only if that's not available, falls back to upower. It
not only checks whether the method is available (CanSuspend) but also whether
it's allowed by polkit (SuspendAllowed), see below for the snippet:

   if (m_login1Interface) {
        QDBusPendingReply<QString> canSuspend =
m_login1Interface.data()->asyncCall("CanSuspend");
        canSuspend.waitForFinished();
        if (canSuspend.isValid() && (canSuspend.value() == "yes" ||
canSuspend.value() == "challenge"))
            supported |= ToRam;

        QDBusPendingReply<QString> canHibernate =
m_login1Interface.data()->asyncCall("CanHibernate");
        canHibernate.waitForFinished();
        if (canHibernate.isValid() && (canHibernate.value() == "yes" ||
canHibernate.value() == "challenge"))
            supported |= ToDisk;

        QDBusPendingReply<QString> canHybridSleep =
m_login1Interface.data()->asyncCall("CanHybridSleep");
        canHybridSleep.waitForFinished();
        if (canHybridSleep.isValid() && (canHybridSleep.value() == "yes" ||
canHybridSleep.value() == "challenge"))
            supported |= HybridSuspend;
    } else {
        if (m_upowerInterface->canSuspend() &&
m_upowerInterface->SuspendAllowed()) {
            qCDebug(POWERDEVIL) << "Can suspend";
            supported |= ToRam;
        }

        if (m_upowerInterface->canHibernate() &&
m_upowerInterface->HibernateAllowed()) {
            qCDebug(POWERDEVIL) << "Can hibernate";
            supported |= ToDisk;
        }
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Plasma-devel mailing list