I am facing an hardware-issue with "HybridSleep", so I set the CriticalPowerAction to "Hibernate" in UPower.conf. After reloading the upower-systemd.unit I still get critical-action "HybridSleep" from "upower -d". So I had a look into the code and didn't find a trace where this Parameter is read.
I use UPower 0.99.0-r1 together with systemd 215-r3 on Gentoo.
Created attachment 105065 [details] upower -d
Created attachment 105066 [details] UPower.conf with option CriticalPowerAction=Hibernate
The method up_backend_take_action(...) calls logind to do the actual sleeping and hibernating. This method defines a field for supported Hibernate modes starting with HybridSleep, then Hibernate and then PowerOff. It then probes for the ability to Hibernate in that order but never reads any variable with the setting of CriticalPowerAction. So it will always try the "best" method regardless of the user setting.
Created attachment 105242 [details] [review] daemon: Add helper to get string from config
Created attachment 105243 [details] [review] linux: Respect the CriticalPowerAction config option It was documented, but the configuration was never actually read.
(In reply to comment #4) > The method up_backend_take_action(...) calls logind to do the actual > sleeping and hibernating. This method defines a field for supported > Hibernate modes starting with HybridSleep, then Hibernate and then PowerOff. > It then probes for the ability to Hibernate in that order but never reads > any variable with the setting of CriticalPowerAction. So it will always try > the "best" method regardless of the user setting. Doh! Can you please test those 2 attached patches, which should fix it.
(In reply to comment #7) > Can you please test those 2 attached patches, which should fix it. Yes, I'll let you know about the results.
I am not sure if the patches work. portage (Gentoo) doesn't complain applying the patches to version 0.99.1 . But after reinstalling my custom ebuild, the output of "upower -d" still tells that it is configured with "critical-action: HybridSleep". I have to say, this is my first ever edited ebuild (see attachment). I didn't try to build an ebuild for version 0.99.0, yet. I tried to apply the patches manually on the sources for both versions 0.99.0 and 0.99.1. Both patches seem to be correctly applied on both versions and sources still compiled. I did not "make install" outside of portage. I will attach a log of the manual patching, configuring and compiling of upower-0.99.0 . Please tell me if I made a mistake here.
Created attachment 105466 [details] upower-0.99.0_patch-configure-make.log
Created attachment 105467 [details] upower-0.99.1-r1.ebuild (Gentoo)
Created attachment 105476 [details] [review] linux: Respect the CriticalPowerAction config option It was documented, but the configuration was never actually read.
Created attachment 105477 [details] [review] daemon: Add helper to get string from config
Created attachment 105478 [details] [review] linux: Respect the CriticalPowerAction config option It was documented, but the configuration was never actually read.
The "daemon: Add helper to get string from config" patch was broken, we were trying to read an integer instead of a string. Please try again.
Created attachment 105631 [details] upower-0.99.1-r1_emerge-before-after.log (Gentoo) So far so good, the patch seems to work. (o: "upower -d" prints out the configured "critical-action: Hibernate" (see full log with patches applied and installed). I am waiting now for the battery to go critical to confirm that upower actually tells systemd to hibernate instead of hybrid-sleeping.
The test was successful! The system did go to hibernate on critical power as configured.
Attachment 105477 [details] pushed as 07fa35c - daemon: Add helper to get string from config Attachment 105478 [details] pushed as 6573310 - linux: Respect the CriticalPowerAction config option
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.