DeviceKit-power and latency control

David Zeuthen david at
Thu Nov 6 09:26:36 PST 2008

On Thu, 2008-11-06 at 16:47 +0000, Richard Hughes wrote:
> I’ve put an interface file up here:

Some comments

1. Regarding GetRequests() returning a(ussi), e.g. an array of

    - pid, connection, type, value

why is the connection necessary? That should probably go. The docs
should also tell about the envisioned usage, e.g. "an application can
use this to show a dialog of active applications with outstanding
latency requests". I'm guessing that is the intended usage (am I
right?), e.g. purely informational purposes (as opposed to controlling

For that you want a bit more than information actually, you need
something like this

including e.g. the command line (and for convenience the uid too).
Because then you can write a class like GduProcess;a=blob;h=362a1d596d93c03ec4d8bf6c8a036ecee712401c;hb=a0d34ca7f540abc6d390ea0c4b614b55c7b5fc10;f=src/gdu/gdu-process.h

that gives you a GAppInfo back so you can do dialogs like these

that uses more suitable names / icons for representing the applications
with active outstanding requests. You probably also want to lock this
method down using PolicyKit and default to granting the authorization to
active local sessions.

2. nitpick; Don't use abbrev for things like Minimum; e.g. SetMinLatency
-> SetMinimumLatency

3. SetLatency should probably be called RequestLatencyGuarantee since
that is what it's doing? Or maybe a better name... but Set* sounds wrong
since you're not setting anything; you are making a request that the
latency is at least XYZ (it may already be that, another client may have
an even harder request outstanding).

If a client disconnects from the bus, will the request be removed? I
definitely think it should (you want to listen to NameOwnerChanged), we
need to document this in the docs for SetLatency + friends.

4. What's the difference between SetLatency() and SetMinLatency()
anyway? When would I use on over the other?

5. How do I undo a latency request? Probably the Request* methods needs
to return a cookie and we need a CancelLatencyRequest() method to cancel
it that you pass the obtained cookie in.

6. Should we return the cookie in the GetRequests() thus allowing other
clients to cancel a request? Maybe

7. GetLatency() is probably the right name since it will be computed
from the set of outstanding requests. What does it return if there are
no outstanding requests?

8. I see that you have a separate polkit action for each method call.
That's probably wrong (and confusing for admins), I think you just need
a single action for everything, e.g. something like


9. Why is there a separate error name space (with a single error
org.freedesktop.DeviceKit.Power.Latency.GeneralError) for this? Also, I
note that for the Device interface we have


and for the Power interface we have none (I believe this is partly my
fault). Suggest to have a single error name space for the entire project
and s/GeneralError/Failed/, e.g. we'll have the name space


with (probably) only a single error


Doing this will make it much easier to map to e.g. GObject on the client
since you'll only a single Error enumeration. Makes sense?

Hope this helps.


More information about the devkit-devel mailing list