suspend/hibernate support in xfce4-session

Brian J. Tarricone bjt23 at cornell.edu
Sat Nov 1 22:52:18 CET 2008


On Sat, 01 Nov 2008 22:32:36 +0100 Ali Abdallah wrote:

> Brian J. Tarricone wrote:
> > On Sat, 01 Nov 2008 14:44:18 +0100 Maximilian Schleiss wrote:
> >
> >   
> >> Le samedi 01 novembre 2008 à 02:59 -0700, Brian J. Tarricone a
> >> écrit : 
> >>
> >>     
> >>> I just committed suspend/hibernate support for xfce4-session,
> >>> based on a patch from Xubuntu (recently updated by Michael
> >>> Casadevall). I can't test this myself (susp/hibernate doesn't
> >>> work on my laptop), so please give it a quick test if you can
> >>> before beta2.
> >>>
> >>>       
> >> suspend and hibernate work here
> >>     
> >
> > Yay!
> >
> >   
> >> but shows this error message when it
> >> resumes even though it did suspend, hibernate and resume properly:
> >>
> >> *TITLE*Shutdown Failed
> >>
> >> Failed to suspend session
> >>
> >> Did not receive a reply. Possible causes include: the remote
> >> application did not send a reply, the message bus security policy
> >> blocked the reply, the reply timeout expired, or the network
> >> connection was broken.
> >>     
> >
> > Boo!  That's strange.  Does it happen every time, or just sometimes?
> > Mike says it doesn't happen for him and suspend otherwise
> > works :-( . Unfortunately I don't think there's a way to tell in
> > code if this message is spurious as in your case, or is a real
> > error (hald died, or wasn't running, or whatever).
> >
> > Well, it looks like the dbus default method call timeout is 25
> > seconds, but xfce4-session was requesting a timeout of only 2
> > seconds.  Maybe that's part of the problem.  I changed
> > xfce4-session to just use the default.  Can you svn up and give
> > that a try?
> >
> >   
> The problem here is the D-Bus timeouts, nothing can be set here to
> fix it, any timeout set for suspend/hibernate messages will possibly 
> produces this error message, so one has to ignore it, 
> gnome-power-manager ignores this and xfce4-power-manager as well, in 
> xfce4-power-manager there is a filter to get only serious errors with 
> respect  also with the exit code sent by HAL ( if we manage to get
> it ), this approach seems to work.

Yeah, I was thinking about this... the problem is that if HAL is having
issues, this could be a valid error message.  I was thinking a hacky
workaround could look something like this:

GTimeVal before, after;
g_get_current_time(&before);
ret = dbus_connection_send_with_reply_and_block(conn, msg, 7000, &derr);
g_get_current_time(&after);

... and then if 'ret' is an error reply, and the error is a timeout
error, and the time between 'before' and 'after' is more than, say 10
seconds, then we assume that we're waking up successfully.  Otherwise
we assume that the call failed.

Of course, this assumes that the system time is correct immediately
after resume, which may not be the case.  So I guess ignoring it is the
way to go, sigh.

	-brian



More information about the Xfce4-dev mailing list