Bug 442064

Summary: the `powermanagement` data engine calling the `UnInhibit` method with incorrect signature
Product: [Plasma] plasmashell Reporter: Peifeng Yu <pfyu817>
Component: DataEnginesAssignee: Plasma Bugs List <plasma-bugs>
Severity: normal CC: nate
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Peifeng Yu 2021-09-06 05:19:41 UTC
I noticed the Battery and Brightness applet always ends up in a confusing state after using its "Inhibit automatic sleep and screen locking" feature. I tracked it down to the `powermanagement` data engine calling the `UnInhibit` method with incorrect signature:

- [when un-inhibit sleep](https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/powermanagement/powermanagementjob.cpp#L107)
- [when un-inhibit screen locking](https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/powermanagement/powermanagementjob.cpp#L126)

The correct signature should take an unsigned int: 
- [`org.freedesktop.PowerManagement.UnInhibit`](https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/org.freedesktop.PowerManagement.Inhibit.xml#L10)
- [`org.freedesktop.ScreenSaver.UnInhibit`](https://invent.kde.org/plasma/powerdevil/-/blob/master/daemon/org.freedesktop.ScreenSaver.xml#L30)

1. Make sure nothing is inhibiting
qdbus --literal org.kde.Solid.PowerManagement.PolicyAgent \
    /org/kde/Solid/PowerManagement/PolicyAgent \
2. Check the "Inhibit automatic sleep and screen locking" box in the Battery and Brightness applet
3. Wait 5 seconds for the inhibition to engage and verify the list of inhibitions. There should be 2 items.
4. Uncheck the "Inhibit automatic sleep and screen locking" box in the Battery and Brightness applet

Inhibitions are **not** released. And if you toggle the checkbox multiple times, there will be many duplicated items in the list.

If you run

dbus-monitor "destination=org.freedesktop.PowerManagement.Inhibit" "sender=org.freedesktop.PowerManagement.Inhibit"

during step 4, the error reply will be captured (something similar to the following):

error time=1630903644.048537 sender=:1.414 -> destination=:1.57 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=7813
   string "No such method 'UnInhibit' in interface 'org.freedesktop.PowerManagement.Inhibit' at object path '/org/freedesktop/PowerManagement/Inhibit' (signature 'i')"

Inhibitions are released.

Operating System: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.13.13-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-10750H CPU @ 2.60GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Comment 1 Bug Janitor Service 2021-09-06 05:33:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1041
Comment 2 Nate Graham 2021-09-07 16:15:55 UTC

*** This bug has been marked as a duplicate of bug 433675 ***