[Powerdevil] [Bug 364067] New: Automatic suspend when inhibitor is set

Ralph Scharpf via KDE Bugzilla bugzilla_noreply at kde.org
Tue Jun 7 17:15:51 UTC 2016


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

            Bug ID: 364067
           Summary: Automatic suspend when inhibitor is set
           Product: Powerdevil
           Version: 5.5.5
          Platform: Ubuntu Packages
               URL: http://www.vdr-portal.de/board17-developer/board21-vdr
                    -plugins/129134-softhddevice-und-vdr-shutdown/
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: plasma-devel at kde.org
          Reporter: rscharpf at onlinehome.de

A discussion came up with VDR experts (hey, these guys are also very
experienced) when I was trying to configure my Video Disk Recorder PC also to
be useable as a Desktop PC using KDE.  The idea is to have the PC being
controlled by VDR and the user. To avoid that the PCs gets shut down by the
desktop when a recording is active by VDR, the VDR process should set an
inhibitor that is avoiding the shutdown and the Desktop is recognizing this,
not requesting a shutdown. Logind / system-dbus provide the needed
infrastructure with inhibitors for that.  The todays behaviour is, that the
user will be prompted for a password in both cases. While this is ok when the
shutdown was triggered by the user, an inactivity timeout should not open a
popup. There I would expect that the desktop waits until the inhibitor has been
closed.


Reproducible: Always

Steps to Reproduce:
1. Set an inhibitor from another user. I used the added python program for
that.
2. Wait until the the desktop wants to suspend due to inactivity. Configure
PowerDevil accordingly. 


Actual Results:  
A dialog pops up asking for confirmation even that there is likely no user as
the session timed out and a suspend is triggered.

Expected Results:  
Power Devil should wait until the inhibitor has been removed. Then a shutdown
should beeing triggered. As an alternative there should be an timeout for the
password prompt a retry to suspend after some time.

This is the program I used to set the inhibitor. Run it from another user and
then try to suspend the machine from the session user. In any case the sleep
will be rejected.  

#!/usr/bin/python3

import dbus
import logging
import time

bus = dbus.SystemBus()

def inhibit(what='sleep', who='First Base',
            why="left field", mode="block"):
    try:
        a = bus.get_object('org.freedesktop.login1',
                                '/org/freedesktop/login1')
        interface = 'org.freedesktop.login1.Manager'
        print("Inhibitor opened: what = {}, mode = {}".format(what, mode))
        fd = a.Inhibit(what, who, why, mode, dbus_interface=interface)
        return fd
    except Exception as error:
        logging.exception(error)
        logging.warning("could not set inhibitor lock")

if __name__ == '__main__':
    my_inhibitor_fd = inhibit()
    #input('press any key to exit inhibitor')
    inhibitTime = 1200
    print("Suspend inhibitor will be active for {}
seconds".format(inhibitTime))
    time.sleep(inhibitTime)

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


More information about the Plasma-devel mailing list