Comment 45 for bug 1178373

Revision history for this message
In , Eric Koegel (eric-koegel) wrote :

Created attachment 5545
Suspend/hibernate upower 0.99 (no logind)

(In reply to Eric Koegel from comment #20)
> Created attachment 5541 [details]
> Suspend/hibernate upower 0.99 (no logind)
>
> So this version makes upower optional but still uses the shutdown helper.

Hmhm, so this one completely ignores logind? Is it really an improvement wrt. the runtime detection patch?
-------------

The hope is that this path will be used if the logind running check fails (i.e. FreeBSD, OpenBSD, Gentoo, Slackware, etc). So if you're using systemd this patch is nice but not useful.

------------
(In reply to Eric Koegel from comment #20)
> Created attachment 5541 [details]
> Suspend/hibernate upower 0.99 (no logind)
>
> So this version makes upower optional but still uses the shutdown helper.

A couple of notes:
- OpenBSD supports hibernation via /usr/sbin/ZZZ or /usr/sbin/apm -Z
- on FreeBSD you might want to call /usr/sbin/acpiconf -s 3 for suspend for consistency, /usr/sbin/zzz still supports APM but I doubt there is any APM-supporting hardware left
- on FreeBSD you can check for suspend/hibernate support by looking at the hw.acpi.supported_sleep_state property through the sysctl API, see sysctl(3)[1] and acpi(4)[2]

[1] http://www.freebsd.org/cgi/man.cgi?query=sysctl&sektion=3&apropos=0&manpath=FreeBSD+10.0-stable
[2] http://www.freebsd.org/cgi/man.cgi?query=acpi&apropos=0&sektion=4&manpath=FreeBSD+10.0-stable&arch=default&format=html

Also the long term plan still is to use a DBus-actiavted helper instead of sudo? Where should this live, both xfce4-session and xfce4-power-manager need to make use of it but either one depending on the other would probably not be nice. People run Xfce without xfpm and and xfpm is used outside Xfce.
--------------

Thanks for all the info and links! I've hopefully got all that in there, but let me know if I've got it wrong.

My idea for the Dbus helper is actually to write a daemon to provide some of the logind API, as in: PowerOff, Reboot, Suspend, Hibernate, HybridSleep, the Can stuff (like CanPowerOff), Inhibit, and the PrepareForShutdown, PrepareForSleep signals. This way other applications outside of xfce can use it too and without having to adapt to yet another API since they'll be similar. But it may take me some time which is why I wrote this patch.

--------------
(In reply to Eric Koegel from comment #20)
> Created attachment 5541 [details]
> Suspend/hibernate upower 0.99 (no logind)
>
> So this version makes upower optional but still uses the shutdown helper.

The patch is still missing bunch of #ifdef UPOWER lines:

xfsm-upower.c:24:20: fatal error: upower.h: No such file or directory

And when you add #ifdef UPOWER around that #include <upower.h>, the same file still has code without #ifdef's:

xfsm-upower.c:304:22: error: missing binary operator before token "("

Please try the patch with a system that doesn't have upower headers installed, and with --disable-upower

Thanks!
------------

Sorry! This new patch should be much better (it actually compiles with and without upower on everything the Jenkins instance currently supports).