Richard Hughes ([info]hughsient) wrote,
@ 2006-06-14 16:39:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
gnome-power-manager Inhibit and UnInhibit methods in use
Further to my earlier posts, I've been improving the documentation for the Inhibit and UnInhibit methods, and really testing them hard.

There's now a testing utility, gnome-power-inhibit-test in g-p-m CVS that allows you to play with multiple Inhibits and other issues.

The testing utility shows how easy it is to add the DBUS methods into your program. The same methods can be used with GNOME Screensaver (but you'll have to change the service and interface names to ScreenSaver).

Trying to suspend when we have an multiple Inhibit requests gives us this.



And a single inhibit:




(Post a new comment)


[info]marnanel
2006-06-14 04:14 pm UTC (link)
That's excellent!

Maybe "because it is" instead of just "because", because that will make a full sentence.

(Reply to this) (Thread)


[info]marnanel
2006-06-14 04:18 pm UTC (link)
(I am really excited about all this. dbus is opening up so many cool possibilities.)

(Reply to this) (Parent)


(Anonymous)
2006-06-14 05:44 pm UTC (link)
Splicing sentences like that doesn't work well in other languages.

(Reply to this) (Parent)

There are pitfalls
[info]federico
2006-06-14 10:42 pm UTC (link)
Please read http://blogs.msdn.com/oldnewthing/archive/2006/02/16/533250.aspx and the links to which it points. It describes why letting programs override the Suspend command is a bad idea.

(Reply to this) (Thread)

Re: There are pitfalls
[info]hughsient
2006-06-15 07:11 pm UTC (link)
Yes, I've seem this link and I've considered this. The Inhibit is not a promise that the suspend will be halted, but a recommendation. I can't imagine lots of closed source stuff will start to use this interface, and so OSS we can trivially patch and bugzilla if it uses the method incorrectly.

(Reply to this) (Parent)


(Anonymous)
2006-06-14 11:18 pm UTC (link)
I wanted to make you aware of something in case it effects this.

When the lid on my laptop closes, the system MUST SUSPEND. Otherwise the heat from my CPU, rising thorugh the keys (as designed, the heatsink is under the keyboard), would melt my LCD.

Designed by Apple. =)

However, inhibting suspend when not initiated by the lid close is fine.

(Reply to this) (Thread)


[info]hughsient
2006-06-15 10:07 am UTC (link)
>When the lid on my laptop closes, the system MUST SUSPEND.

I'm sure we can work something out with a HAL property or something, so worry not :-)

(Reply to this) (Parent)

Why?
(Anonymous)
2006-06-15 12:02 am UTC (link)
Why would an app be able to stop suspending? If you're downloading or copying a file, just pause, and continue when you wake up. In fact, I'm not sure I can come up with any good reason to tell me I can't suspend.

(Reply to this) (Thread)

Re: Why?
[info]davyd
2006-06-15 12:07 am UTC (link)
Burning a CD would be a good reason. It should at least warn you that you're about to coaster a CD.

(Reply to this) (Parent)

Re: Why?
[info]hughsient
2006-06-15 10:06 am UTC (link)
Image you've got auto-suspend set to 5 minutes of inactivity. You start ripping a CD, which is going to take 20 minutes. You walk away and make a coffee, while it rips.

You come back, move the mouse, and it resumes, after only doing 25% of the rip. Assuming the kernel is in a good mood, the rip continues.

This isn't what the user wants -- g-p-m needs more info from the program about what is happening. This makes things "just work" without having to do dirty blacklists and stuff like that.

(Reply to this) (Parent)(Thread)

Re: Why?
(Anonymous)
2006-06-16 06:37 am UTC (link)
"This isn't what the user wants" -- huh? It's exactly what I'd expect.

If you want stuff to run while you're getting coffee, don't set it to suspend after 5 minutes!

If the computer prevents suspend for ripping a CD, then what process *wouldn't* it prevent suspend for?

(Reply to this) (Parent)(Thread)

Re: Why?
[info]hughsient
2006-06-16 11:11 am UTC (link)
For max power saving, a user shouldn't have to set a policy and then do an action, for the same reason a user shouldn't have to set a "presentation" powersaving policy just before they start a presentation (as lots of research suggests that most people forget to turn it either on beforehand or off afterwards).

This stuff is suppost to just work *with* the user, and not be rigid so that a policy action is done regardless of the users preference.

(Reply to this) (Parent)


[info]davyd
2006-06-15 12:12 am UTC (link)
I like what this is doing. The question is, does it move the machine into an INHIBITED state (instead of leaving it in the running state)? It seems to me that if you close your lid (and you don't have one of those melty LCDs) that it would be handy for your machine to enter the INHIBITED state, and once the inhibitions are gone the machine can enter suspend. If you open the lid again before the inhibitions are gone, the machine will go back to the normal running state.

It would also be quite nice to be able to override any inhibition with a "Suspend Anyway" button, and perhaps have a preference which is "Ignore inhibitions". Actually... that sounds remarkably dodgy.

(Reply to this) (Thread)


[info]hughsient
2006-06-15 10:01 am UTC (link)
Good questions. I don't see why if the lid is closed then the computer couldn't do the action when all the inhibited stuff has gone away, but I would need to think more on the state stuff before I started to impliment this.

I was thinking of a [x] ignore inhibit requests in the gui or maybe just a gconf var, to keep people with melty screens happy.

Maybe a "suspend anyway" button might be best as you suggest.

(Reply to this) (Parent)(Thread)


[info]davyd
2006-06-15 10:07 am UTC (link)
I'm trying to think of a really good use case for the first part, where I am doing an operation and need to quickly shove my laptop in my bag and run for the bus. Perhaps I'm burning a CD. On the bus, I get chatting to the pretty girl next to me, so I forget about the fact that my laptop is still running (or more likely, don't want to get my laptop out and suspend it, because that would be geeky). End result is that my laptop goes flat quicker. I'm also the sort of person who doesn't carry about their plugpack.

'Suspend anyway' works as long as you don't close the lid. I think the best options here are the GConf variable (I can't decide on exposing this to the UI) and the 'Suspend Anyway' button.

(Reply to this) (Parent)


[info]prokoudine
2006-06-15 02:30 pm UTC (link)
Great stuff! Very useful for us, laptoppers :)

(Reply to this)

Suspend when done
(Anonymous)
2006-06-15 05:25 pm UTC (link)
Any chance of having an option to click a button to make the suspend happen once the inhibitions have gone away?

(Reply to this) (Thread)

Re: Suspend when done
[info]hughsient
2006-06-15 07:13 pm UTC (link)
I think this should be configurable somewhere, at least at the gconf level. I think this makes sense to do this by default if the laptop lid is closed or the computer is idle, but not if the user clicks the tray icon.

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…