Bug 310317

Summary: "Dim display" does not "listen" the org.freedesktop.ScreenSaver.SimulateUserActivity method.
Product: [Unmaintained] solid Reporter: firewalker <firew4lker>
Component: powermanagementAssignee: Dario Freddi <drf>
Status: RESOLVED UPSTREAM    
Severity: normal CC: afiestas, bernhard+kde, mklapetek, oliver.henshaw, rdieter
Priority: NOR    
Version: 4.9.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=56649
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: python script to show session idle time

Description firewalker 2012-11-19 10:27:59 UTC
Since kde 4.9.2 the display on my laptop dims after the time out specified although the the command  

qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity

gets executed periodically.

Reproducible: Always

Steps to Reproduce:
1. Set the dim display time to 1 minute for example.
2. run on a terminal

while [ 1 ]; do qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity; sleep 10; done
Actual Results:  
The display will dim after 1 minute.

Expected Results:  
The display should not dim.
Comment 1 Alex Fiestas 2013-03-03 17:46:57 UTC
I can reproduce this.
Comment 2 Oliver Henshaw 2013-03-04 17:43:49 UTC
In the long term, we probably shouldn't support polling.
Comment 3 Alex Fiestas 2013-03-05 20:55:33 UTC
@Oliver Henshaw I agree but in the meanwhile...  what can we do? :/
Comment 4 Oliver Henshaw 2013-03-07 14:26:03 UTC
Created attachment 77835 [details]
python script to show session idle time

Firstly we need to find out why inhibitions don't work well for firewalker: can you explain what your needs are and why powerdevil inhibitions aren't fulfilling them?

Secondly, yes, we should keep SimulateUserActivity working as long as we can. Can you run the following and tell me the output of:

"sleep 5; qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity ; sleep 5;  python idletime.py"

with the attached script as idletime.py. It should report 5 seconds idle if SimulateUserActivity is working, otherwise it will report 10 seconds idle.

It works for me on fedora 17 with stale packages and kde-workspace 4.10 but not on the fedora 18 livecd with kde-workspace 4.9.4 so it could be some non-kde packages at fault.
Comment 5 firewalker 2013-03-07 16:37:06 UTC
My needs? I don;t want KDE to dim the monitor when user activity is simulated. For example xdg-screensaver used this method.

Few hours ago I updated my system to 4.10.1 and it seems to work as expected. 

The set time though to Dim the display is the half you set. If you set it to 1 minute for example, the dim will start at 30 secs. Is it normal?

The output of the command is "System idle for 0.0 minutes, 5.339 seconds"
Comment 6 Oliver Henshaw 2013-03-07 16:55:58 UTC
(In reply to comment #5)
> My needs? I don;t want KDE to dim the monitor when user activity is
> simulated. For example xdg-screensaver used this method.
Right, but we try and support that without requiring polling. Video players should be inhibiting screen power saving, you can configure activities to never turn off the screen or you can disable power saving in the battery applet. Which of these is failing to meet your needs?

> Few hours ago I updated my system to 4.10.1 and it seems to work as
> expected. 
Ah, good. I haven't been able to pin it down but I suspect it's some non-kde package (new enough to exist in fedora 18 but not in fedora 17) that breaks things on 4.9.x but not on 4.10.x

> The set time though to Dim the display is the half you set. If you set it to
> 1 minute for example, the dim will start at 30 secs. Is it normal?
This is bug #304696 - I'm not sure if it's a "feature" or just tradition or what but I agree it's not particularly intuitive.
Comment 7 firewalker 2013-03-07 17:10:04 UTC
I don't quite understand the polling thing.

Isn't the simulate activity through Dbus a valid method for a developer/user to use in order to inhibit operations like screen/power saver?

If not what is the correct way?
Comment 8 Oliver Henshaw 2013-03-07 18:10:37 UTC
Third party applications should use http://specifications.freedesktop.org/idle-inhibit-spec/0.1/ and KDE SC applications can use  begin(stop)SuppressingScreenPowerManagement from http://api.kde.org/4.10-api/kdelibs-apidocs/solid/html/namespaceSolid_1_1PowerManagement.html

The only problem with this is that you can't use the dbus API from shell since the calling process needs to stay on the session bus for the duration of the inhibition. But as far as I know, the polling SimulateUserActivity method doesn't work on gnome at all.

You might also find http://drfav.wordpress.com/2011/10/04/power-management-a-new-screencast/ interesting.
Comment 9 firewalker 2013-03-07 19:09:15 UTC
Thanks for the info!
Comment 10 firewalker 2013-03-07 19:12:26 UTC
The inhibit method is the one bellow?

https://bugs.kde.org/show_bug.cgi?id=299367
Comment 11 Oliver Henshaw 2013-03-08 13:22:34 UTC
Did you update the xserver at the same time you updated to 4.10.1? (And could your problem have appeared after an xserver update, around the time you updated to 4.9.2?)

In my testing I can not reproduce this on fedora 17 with xserver 1.12 but could on fedora 18 with xorg-x11-server-Xorg-1.13.0-11.fc18.x86_64 (with both kde 4.9.5 and 4.10.1). It seems to be fixed by xorg-x11-server-Xorg-1.13.2-2.fc18.x86_64 which IIRC was the first update to F18.
Comment 12 firewalker 2013-03-08 15:06:47 UTC
Yes, there was an xorg update in both cases (when installed 4.9.3 and 4.10.1) as I can see from the logs. 
upgraded xorg-server (1.13.1-1 -> 1.13.2-1)
Comment 13 Martin Klapetek 2013-03-13 17:33:24 UTC
Running 4.10.0 here with xorg-server 1.13.0, output of the test in comment #4 is 10 seconds for me.
Comment 14 Oliver Henshaw 2013-04-02 15:35:50 UTC
Have this been solved through xserver updates?  If you haven't had updates, what distribution is it that offers xserver 1.13 but not bugfix updates?
Comment 15 Martin Klapetek 2013-04-03 11:47:15 UTC
Seems so, 1.13.2 on Kubuntu 13.04, test from comment #4 prints 5 seconds. Also screen does not dim anymore while watching a movie (though there is still bug 287501 that I hitting).
Comment 16 Oliver Henshaw 2013-04-03 16:24:12 UTC
Thanks. Looks like this was indeed an upstream xserver bug.
Comment 17 Oliver Henshaw 2013-04-16 16:15:03 UTC
*** Bug 318344 has been marked as a duplicate of this bug. ***