By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 1941

Summary: Systemd power features are not supported by TDE
Product: TDE Reporter: Francois Andriot <albator78>
Component: tdelibsAssignee: Francois Andriot <albator78>
Status: RESOLVED FIXED    
Severity: normal CC: albator78, bugwatch, slavek.banko
Priority: P5    
Version: R14.0.0 [Trinity]   
Hardware: All   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Bug Depends on:    
Bug Blocks: 1931    
Attachments: tdelibs: add the systemd/logind power features to tdehwlib
tdelibs: add the systemd/logind power features to tdehwlib (1)

Description Francois Andriot 2014-02-17 15:52:11 CST
Hello, under Fedora 20 and Mageia 4 (probably even other recent distributions), the suspend/hibernate feature of TDE does not work when using -DWITH_UPOWER=ON in tdelibs .

Currentlyn the UPOWER backend in TDE use DBUS connection to query the UPOWERD daemon.

Try following command:
$ qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.CanSuspend
=> false
It used to return "true" in previous distributions.

Now try:
$ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend
=> yes
It did not work at all in previous distributions.

I believe this a new SYSTEMD related evolution.
We should add a new power backend in TDE to support this new DBUS call.
Comment 1 Francois Andriot 2014-02-19 14:36:08 CST
Created attachment 1940 [details]
tdelibs: add the systemd/logind power features to tdehwlib

Here is a patch to implement the power features of Systems/LoginD in the TDE HW Library.

Build tdelibs with flag -DWITH_LOGINDPOWER=ON to enable it.

More documentation about this:
http://www.freedesktop.org/wiki/Software/systemd/logind/

It works on Mageia 4, where upower can no more manager power features (obsolete).
Comment 2 Francois Andriot 2014-02-19 14:39:21 CST
Please note that this patch is theorically incomplete.

See (extract from official site):

CanPowerOff(), CanReboot(), CanSuspend(), CanHibernate(), CanHybridSleep() tests whether the system supports the respective operation and whether the calling user is eligible for the desired operation. Returns one of "na", "yes", "no" or "challenge". If "na" is returned the operation is not available because hardware, kernel or drivers do not support it. If "yes" is returned the operation is supported and the user may execute the operation without further authentication. If "no" is returned the operation is available but the user is not allowed to execute the operation. If "challenge" is returned the operation is available, but only after authorization.

In my patch, only the "yes" answer is taken into account.
Comment 3 Slávek Banko 2014-02-25 11:35:21 CST
I looked into the patch. For state 'freeze' you used HybridSleep, which I think is not right. I examined the source code systemd - there does not distinguish between "standby" and "freeze". Therefore, do not allow the user to directly request "freeze".

I make a few minor adjustments and then I will publish an updated patch. In any case, thank you - you saved me some time.
Comment 4 Slávek Banko 2014-02-26 13:13:52 CST
Created attachment 1959 [details]
tdelibs: add the systemd/logind power features to tdehwlib (1)

I made the adjustments I suggested in a previous comment. I attach an updated patch. (So ​​far, I have not tested it on my builder / in my environment.)
Comment 5 Slávek Banko 2014-03-02 19:52:13 CST
Comment on attachment 1959 [details]
tdelibs: add the systemd/logind power features to tdehwlib (1)

Pushed to GIT in hash 316893d4.
Comment 6 Slávek Banko 2014-03-02 19:55:54 CST
Because the standby / freeze / suspend / hibernation can be performed using tde-dbus-daemon the current solution seems to be sufficient.