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 1589

Summary: tdepowersave shows "Suspend to disk" option, but my system does not support hibernate
Product: TDE Reporter: Francois Andriot <albator78>
Component: non-core programsAssignee: Francois Andriot <albator78>
Status: RESOLVED FIXED    
Severity: normal CC: albator78, bugwatch, darrella, slavek.banko
Priority: P5    
Version: R14.0.0 [Trinity]   
Hardware: All   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Attachments: tdepowersave 14.0.0 : fix "suspend to disk" option display

Description Francois Andriot 2013-07-24 05:23:34 CDT
I have a computer that  can suspend to ram, but not suspend to disk.
But still, tdepowersave shows the "Suspend to disk" option.
Kickoff menu does not show the option, so the information is correct in TDE HW library.
Comment 1 Francois Andriot 2013-07-24 05:24:49 CDT
Created attachment 1378 [details]
tdepowersave 14.0.0 : fix "suspend to disk" option display

It looks like a bad copy/paste was the culprit. See attached patch.
Comment 2 Darrell 2013-07-30 14:12:34 CDT
Francois, is there a way to test this on systems supporting suspend to disk? That is, a way to emulate no support for suspend to disk?
Comment 3 Francois Andriot 2013-07-30 14:49:47 CDT
Yes, just remove (comment) your swapfile from /etc/fstab and reboot.
Without swap (my case), you cannot suspend to disk.
Comment 4 Darrell 2013-07-30 15:36:32 CDT
Ok. Thanks. I have a laptop. I will build and test the patch.
Comment 5 Darrell 2013-07-30 17:25:05 CDT
The patch does disable the Suspend to Disk option from the tdepowersave system tray popup menu.

But only for non root users. The menu option still appears when logging into Trinity as root. Despite zealots freaking out about logging into a graphical desktop as root, we probably should fix that.

Comment: should the CPU frequency policies submenu options match the names of the actual kernel scaling policy names? The actual scaling names are:

performance
powersave
ondemand
conservative

tdepowersave uses the term "Dynamic" rather than "OnDemand." I think changing that from Dynamic to OnDemand would add consistency.

I don't know why conservative is not supported in tdepowersave.

Should this same patch be applied to kpowersave too (the HAL version)?

Francois, do you have permissions to push patches to git?
Comment 6 Darrell 2013-07-30 21:15:31 CDT
> But only for non root users. The menu option still appears when logging into
> Trinity as root. Despite zealots freaking out about logging into a graphical
> desktop as root, we probably should fix that.

The original patch probably can pushed to git. We should not close the bug report until we resolve the "Suspend to Disk" menu option appearing when root uses the Trinity desktop. Even super user root can't do the impossible of saving to disk when the swap partition is disabled. :-)

> tdepowersave uses the term "Dynamic" rather than "OnDemand."
> I think changing that from Dynamic to OnDemand would add consistency.

Never mind. I grepped the sources and there are too many occurences of dynamic/Dynamic/DYNAMIC. Too much testing.

> Should this same patch be applied to kpowersave too (the HAL version)?

I checked. Looks like the answer is no.
Comment 7 Francois Andriot 2013-07-31 02:56:05 CDT
Hello, I did not test with the root user, I will do it.

In the new TDEPowerSave, the power capabilities of the computer are detected/used through the TDE HW Library, which is part of tdelibs.
So if there is no problem in TDEPowerSave, it may in fact be a problem in 'tdelibs/tdecore/tdehardwaredevices.cpp'.

And no I cannot push patches to GIT, so we'll have to wait here :)

The original bug was obviously a typo (I bet a mistake in copy/paste).
Comment 8 Darrell 2013-07-31 11:53:45 CDT
> Hello, I did not test with the root user, I will do it.

Great!

> And no I cannot push patches to GIT, so we'll have to wait here :)

That's fine. I only wanted to know because if you can't then I'll push patches to git. :-)

I don't know whether this is a separate bug, but I cannot invoke suspend to ram on my laptop when I'm non root. That tdepowersave option works as root. The non root user is a member of the power group. Anything else I can do to debug? (I do have the option to close the lid but I want to see Trinity software working as advertised.)
Comment 9 Slávek Banko 2013-07-31 15:06:19 CDT
Comment on attachment 1378 [details]
tdepowersave 14.0.0 : fix "suspend to disk" option display

Pushed to GIT in hash afcfc2e0.
Comment 10 Slávek Banko 2013-07-31 15:14:12 CDT
(Odpověď na komentář #8)
> > Hello, I did not test with the root user, I will do it.
> 
> Great!
> 
> > And no I cannot push patches to GIT, so we'll have to wait here :)
> 
> That's fine. I only wanted to know because if you can't then I'll push patches
> to git. :-)
> 
> I don't know whether this is a separate bug, but I cannot invoke suspend to ram
> on my laptop when I'm non root. That tdepowersave option works as root. The non
> root user is a member of the power group. Anything else I can do to debug? (I
> do have the option to close the lid but I want to see Trinity software working
> as advertised.)

Do you have installed upower? TDE HW Library has two options to do suspend and hibernate - either the user has write access to /sys/power/state (ie, the root), or is possible to use upower. Try:

 upower -d
Comment 11 Darrell 2013-07-31 16:48:26 CDT
Hmm. Running upower -d reveals root has permission to suspend but non-root user accounts do not. Permissions to /sys/power/state are 644, root:root.
Comment 12 Darrell 2013-07-31 21:29:41 CDT
I found a solution. I had to add a new power group policy to /etc/polkit-1/localauthority/50-local.d. Now upower -d shows can-suspend: yes and I can suspend to ram using tdepowersave.

Trying to suspend with klaptop is broken, refer to bug report 1603.

As Francois's patch was pushed to git, I'll close this report as resolved.

Thanks for the patch!