! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
missing org.freedesktop.PowerManagement dbus interface stuff
Status:
RESOLVED: FIXED
Product:
Xfce4-power-manager
Component:
General

Comments

Description Brian J. Tarricone (not reading bugmail) 2009-07-15 09:22:54 CEST
According to:
http://people.freedesktop.org/~hughsient/temp/dbus-interface.html

a Reboot() method is required, but xfpm doesn't appear to provide it.

Also, according to the doc, the Suspend, Hibernate, Shutdown, and Reboot methods should throw the errors PermissionDenied (which appears to work), and NoHardwareSupport (which does not; I think you have custom errors for these).

Also missing: GetPowerSaveStatus(), CanShutdown(), and CanReboot().

There are also a bunch of Can{Suspend,Hibernate,Shutdown,Reboot}Changed() signals that are missing (though for my purposes I don't need them).

I'd like to switch xfce4-session to have it use xfce4-power-manager first for all of these things, but so far I can only implement Suspend and Hibernate, which is problematic because the current architecture isn't set up very well for doing some operations with one "backend" and others with another (hehe, of course that's not your fault!).

Anyway, doing all this should also fix your issues with xfpm and xfce4-session fighting over doing certain operations.
Comment 1 Ali Abdallah editbugs 2009-07-15 10:42:19 CEST
(In reply to comment #0)
> According to:
> http://people.freedesktop.org/~hughsient/temp/dbus-interface.html
> 
> a Reboot() method is required, but xfpm doesn't appear to provide it.
> 
> Also, according to the doc, the Suspend, Hibernate, Shutdown, and Reboot
> methods should throw the errors PermissionDenied (which appears to work), and
> NoHardwareSupport (which does not; I think you have custom errors for these).
> 
> Also missing: GetPowerSaveStatus(), CanShutdown(), and CanReboot().
> 

I'm working on these right now, but a question regarding Shutdown and Reboot, because in the current implementation xfpm forward any shutdown request to the session so it saves its state ... in hibernate/suspend these are handled inside xfpm since if everything goes fine we should return in to the same state. 

So i need clarification about Shutdown and Reboot.

> There are also a bunch of Can{Suspend,Hibernate,Shutdown,Reboot}Changed()
> signals that are missing (though for my purposes I don't need them).

I will consider adding these, thought i don't know how the Can hibernate be changed on a system, probably when doing hibernate we emit a signal with can't hibernate and with when waking up.

> I'd like to switch xfce4-session to have it use xfce4-power-manager first for
> all of these things,

Are you going to have a dbus session monitor for monitoring org.freedesktop.PowerManagemenent? presense.
Comment 2 Brian J. Tarricone (not reading bugmail) 2009-07-15 11:16:26 CEST
(In reply to comment #1)

> I'm working on these right now, but a question regarding Shutdown and Reboot,
> because in the current implementation xfpm forward any shutdown request to the
> session so it saves its state ... in hibernate/suspend these are handled inside
> xfpm since if everything goes fine we should return in to the same state. 
> 
> So i need clarification about Shutdown and Reboot.

Oof, good point.  This certainly needs some thought.

Some ideas:

1.  When xfpm gets a shutdown (or reboot) request, it should first ask the session manager to log out, and somehow tell it to wait after logging out (so X doesn't die) and signal that logout is complete.  Then xfpm can actually reboot.

1a. I don't really like the bit where there's a special "log out but don't really log out" mode.  So maybe xfpm will tell the SM to just log out, and then install an X error handler so xfpm doesn't die when X quits (not sure if you can do that with gtk tho).  Then when xfpm sees that X has quit, it can start shutdown.

1b.  A problem with that is if the shutdown process doesn't start fast enough, the user gets logged out and then GDM (or whatever) will take over and the user will get a login screen again, which might be confusing.  I'm not sure how to solve this problem.

2.  When xfpm gets a shutdown request, it forwards the request to the session manager.  The SM handles the shutdown request completely.

2a.  The problem here is that there is no existing interface for the SM to shut down the machine (or to reboot).  How we do it now is either a) via the log out dialog, which is entirely custom.  It's just triggered by the generic SaveYourselfRequest command over XSMP, with a 'shutdown' parameter set to 'true'.  This parameter is poorly specified and we can't expect it to do anything in particular -- xfce4-session for example will put up the logout dialog in response to that, which isn't what we want if the user explicitly selected "shut down" or "reboot" from a menu (and even if we *could* rely on it, there's only a shutdown option, not a reboot option).

Looking at what GNOME's session-manager dbus interface does, they have a Shutdown() method, which requests a shutdown *dialog*, and a Logout() method which can request a logout dialog, or can forcefully log out (but not shut down/reboot).  What I'm guessing is that maybe they have a way of telling GDM to shut down/reboot after logout finishes.  They do have a SessionOver() signal, so maybe g-p-m keys off that to start a reboot.

Hmm, actually, it seems that gpm_control_shutdown() calls org.freedesktop.ConsoleKit.Stop(), which causes a shutdown.  Weird.  So it doesn't try to let the session manager log the user out first?  I must be missing something.

So I'm still kinda at a loss.  I'd probably vote for 1+1a or something like that.  I'd rather the SM doesn't have to know about rebooting or shutting down, or suspending or hibernating... All it should care about is ending the *desktop* session... and of course forwarding on shutdown/reboot/etc. requests to the power manager because it has to at least have *some* idea.

Anyway, now I'm just sort of rambling on and on, and it's 4:15am, so I'd better finish this up and go to bed.

> > There are also a bunch of Can{Suspend,Hibernate,Shutdown,Reboot}Changed()
> > signals that are missing (though for my purposes I don't need them).
> 
> I will consider adding these, thought i don't know how the Can hibernate be
> changed on a system, probably when doing hibernate we emit a signal with can't
> hibernate and with when waking up.

Yeah, I'm not sure how or why these would ever change during runtime.  Maybe as you say, you 'disable' the ability to suspend or hibernate when a suspend or hibernate starts, but I'm not sure, of course.  Anyway, xfce4-session doesn't need these methods.

> 
> > I'd like to switch xfce4-session to have it use xfce4-power-manager first for
> > all of these things,
> 
> Are you going to have a dbus session monitor for monitoring
> org.freedesktop.PowerManagemenent? presense.

No, I don't think there's a need to have a monitor.  Just when the user requests the logout dialog, or presses one of the buttons, it will first try o.fd.PowerManagement, and if that's not present, will try HAL directly, and if that's not present, try the old "sudo" method.
Comment 3 Ali Abdallah editbugs 2009-07-16 09:54:57 CEST
(In reply to comment #0)
> According to:
> http://people.freedesktop.org/~hughsient/temp/dbus-interface.html
> 
> a Reboot() method is required, but xfpm doesn't appear to provide it.
> 
> Also, according to the doc, the Suspend, Hibernate, Shutdown, and Reboot
> methods should throw the errors PermissionDenied (which appears to work), and
> NoHardwareSupport (which does not; I think you have custom errors for these).
> 
> Also missing: GetPowerSaveStatus(), CanShutdown(), and CanReboot().
> 

These methods are implemented and the error code is corrected in r7729.
Comment 4 Ali Abdallah editbugs 2009-07-16 10:03:27 CEST
(In reply to comment #2)
> (In reply to comment #1)
> 
> > I'm working on these right now, but a question regarding Shutdown and Reboot,
> > because in the current implementation xfpm forward any shutdown request to the
> > session so it saves its state ... in hibernate/suspend these are handled inside
> > xfpm since if everything goes fine we should return in to the same state. 
> > 
> > So i need clarification about Shutdown and Reboot.
> 
> Oof, good point.  This certainly needs some thought.
> 
> Some ideas:
> 
> 1.  When xfpm gets a shutdown (or reboot) request, it should first ask the
> session manager to log out, and somehow tell it to wait after logging out (so X
> doesn't die) and signal that logout is complete.  Then xfpm can actually
> reboot.
> 
> 1a. I don't really like the bit where there's a special "log out but don't
> really log out" mode.  So maybe xfpm will tell the SM to just log out, and then
> install an X error handler so xfpm doesn't die when X quits (not sure if you
> can do that with gtk tho).  Then when xfpm sees that X has quit, it can start
> shutdown.
> 
> 1b.  A problem with that is if the shutdown process doesn't start fast enough,
> the user gets logged out and then GDM (or whatever) will take over and the user
> will get a login screen again, which might be confusing.  I'm not sure how to
> solve this problem.

Even if we can do this in Gtk, i'm not sure as well how to solve the problem of the login manager showing while we are planning to reboot/halt the system, i don't see any solution for this.

> 
> 2.  When xfpm gets a shutdown request, it forwards the request to the session
> manager.  The SM handles the shutdown request completely.
> 

It is currently like that in Xfpm, just in case of error xfpm tries to do that by itself.

> 2a.  The problem here is that there is no existing interface for the SM to shut
> down the machine (or to reboot).  
i didn't get the point here, there is a Shutdown method on xfce4-session!

> So I'm still kinda at a loss.  I'd probably vote for 1+1a or something like
> that.  I'd rather the SM doesn't have to know about rebooting or shutting down,
> or suspending or hibernating... All it should care about is ending the
> *desktop* session... and of course forwarding on shutdown/reboot/etc. requests
> to the power manager because it has to at least have *some* idea.
> 

I think should also care about shutdown/reboot, since a power manager will not exists always on all systems, as you said if no power manager is running then HAL, if HAL fails or not running then sudo.

I will post here if i can get better ideas about 1+1a.
Comment 5 Brian J. Tarricone (not reading bugmail) 2009-07-16 17:24:08 CEST
(In reply to comment #4)
> i didn't get the point here, there is a Shutdown method on xfce4-session!

Yeah, but it's on the private org.xfce.SessionManager interface.  There's no non-Xfce standard for shutting things down.  I'd rather we avoid custom interfaces if possible... people could run xfpm on a GNOME desktop, for example, or they could run g-p-m on Xfce, and it would be nice if everything would still more or less work as it should in both cases.

> I think should also care about shutdown/reboot, since a power manager will not
> exists always on all systems, as you said if no power manager is running then
> HAL, if HAL fails or not running then sudo.

Right, I was thinking about this while talking to Yves-Alexis (corsac), and xfce4-session should always at least know how to do shutdown/reboot, because we shouldn't expect people on non-laptops to have a power manager running, I don't think.

But in the future I'd be happy to have xfpm handle suspend and hibernate... probably after devicekit-power is used a lot, and HAL is gone, I won't add DK-power support to xfce4-session, and instead say "if you want suspend/hibernate, install xfpm."
Comment 6 Ali Abdallah editbugs 2009-07-17 07:14:52 CEST
(In reply to comment #5)
> Yeah, but it's on the private org.xfce.SessionManager interface.  There's no
> non-Xfce standard for shutting things down.  I'd rather we avoid custom
> interfaces if possible... people could run xfpm on a GNOME desktop, for
> example, or they could run g-p-m on Xfce, and it would be nice if everything
> would still more or less work as it should in both cases.

Yes, in xfpm i get if org.xfce.SessionManager has an owner, if yes, i use the Shutdown method with XfsmShutdownType, hopefully this method will not change radically as well as the order of XFSM_SHUTDOWN_*. well if the method itself changed in the future then there is no problem since the DBus call will fail, but if the order of XFSM_SHUTDOWN_* changes then i'm in trouble.

> But in the future I'd be happy to have xfpm handle suspend and hibernate...
> probably after devicekit-power is used a lot, and HAL is gone, I won't add
> DK-power support to xfce4-session, and instead say "if you want
> suspend/hibernate, install xfpm."

This is a reasonable solution, since most desktop users they don't use hibernate/suspend anyway.

Adding dkp support in xfpm should no take too much time, i already have something, i should collect the xfpm dkp code from my backup hard disk and put them in a dkp branch, but better to wait for the git movement.
Comment 7 Unnamed_Hero 2009-12-29 18:10:46 CET
Do not know exactly is what I want to say relate to this bug, but it's very close to it.

So, since version >0.8.2.2 it is unable to shutdown/reboot my computer if power manager is running. It says that org.freedesktop.PowerManagement war not provided by any .service files and just restart X.

I'm running Slackware Linux x86_64 ver13.

Is it related to this bug or it is better to create a new bug?
Comment 8 Ali Abdallah editbugs 2011-01-04 13:03:04 CET
(In reply to comment #7)
> Do not know exactly is what I want to say relate to this bug, but it's very
> close to it.
> 
> So, since version >0.8.2.2 it is unable to shutdown/reboot my computer if power
> manager is running. It says that org.freedesktop.PowerManagement war not
> provided by any .service files and just restart X.
> 
> I'm running Slackware Linux x86_64 ver13.
> 
> Is it related to this bug or it is better to create a new bug?

This is not related to this bug, please try out newer version of xfpm and open a new bug if you have any issue.

Thanks

Bug #5569

Reported by:
Brian J. Tarricone (not reading bugmail)
Reported on: 2009-07-15
Last modified on: 2011-01-04

People

Assignee:
Ali Abdallah
CC List:
1 user

Version

Version:
Unspecified

Attachments

Additional information