Next: , Previous: Scripts, Up: Top


12 Powersave DBus specification

Namespace: com.novell.powersave

Interfaces:

  1. com.novell.powersave.manager
  2. com.novell.powersave.request
  3. com.novell.powersave.action

12.1 The Manager Interface

The Manager interface is connection oriented Interface. Clients have to connect (and send their capabilities) to the daemon.

12.1.1 Initial Connection by a Client at the Powersave Daemon

0 capabilities int32 (sum of CAPABILITY_* defines, see powersave_clientsocket.h)

-> client connection (message "connect" with the capabilities which can be handle by the connecting client).

-> return type: boolean (TRUE on successful connection, else: FALSE)

-> powersaved has to store the D-BUS sender string (e.g. ":1.5") of the "connect" message. Using this information gives the +possibility to track clients whether they died unexpectedly.

Depending on the amount of capabilities the client has, the daemon now knows

D-BUS Example:

signal sender=:1.5 -> dest=(null destination) interface=com.novell.powersave; member=connect

0 int32 "3"

11 corresponds to the capabilities CAPABILITY_NOTIFICATIONS and CAPABILITY_SCREENLOCK

12.1.2 Disconnect by a Client

D-BUS Example:

signal sender=:1.5 -> dest=(null destination) interface=com.novell.powersave; member=disconnect

-> According to the sender of the disconnect signal, the powersave daemon knows which capabilities are no longer available.

12.1.3 Events triggerd by the Powersave Daemon

Acpi events from /proc/acpi/events

0 string (e.g. "button_power")

Powersave events

0 string ("battery_low")

Possible events:

Daemon or script progress (e.g. 'unloading modules 40%)

Return types:

Simple messages, error messages or notifications

0 string (e.g. "Unable to unload module.")

D-BUS Example:

signal sender=:1.5 -> dest=(null destination) interface=com.novell.powersave; member=acpi_event 0 string "button.power"

-> according to its capabilities, the client has to set up matches in his filter function for the corresponding events triggered by the daemon.

When an event occurs the clients may want to use the Request interface to reread specific values (e.g. request "rem_charg_time_battery" after a event "battery.info", or request "schemes" after a event "daemon.scheme.changed"

12.2 IV. Client Requests (Client -(request)-> Daemon -(response)-> Client)

(Interface: com.novell.powersave.request)

-> All requests do not have any parameters.

Get all Powersave schemes

Return types:

Get a specific scheme description

Param:

Return types:

Cpu frequency policy

Return type:

Battery status

Return type:

Ac adapter power

Return type:

If suspend to ram is allowed

Return type:

If suspend to disk is allowed

Return type:

If standby is allowed

Return type:

Get current brightness level

Return type:

Get current brightness in percent

Return type:

Get available brightness levels

Return type:

Query list of device classes for runtime power management

Return type:

Query list of devices for a specific device class

Param:

Return type:

12.3 Daemon Actions (Client -(action)-> Daemon)

(Interface: com.novell.powersave.action)

Check whether daemon is up and replies

Set machine into suspend to disk mode

Set machine into suspend to ram mode

Set machine into standby mode

Set cpu policy to performance

Set cpu policy to powersave

Set cpu policy to dynamic

Enabled a single CPU

Param:

Disable a single CPU

Param:

Set a powersave scheme

Param:

Set brightness level

Param:

Set brightness level given in percent

Param:

Set brightness to minimum

Set brightness to medium

Set brightness to maximum

Increase brightness

Decrease brightness

Set a devices into powersave mode

Param:

Resume a devices from powersave mode

Param:

Notify connected clients of any progress going on

12.4 Return Messages

All calls to the bus get a return/error message replied.

Return messages include following types:

The error ids can be found in powersave_dbus.h as defines.

12.4.1 If no error occured the return message includes (normal message):

If an error happens the message will be an error reply (as specified by dbus). Following errors can be checked for all method calls/signals:

General Error

No connection Error (The daemon is probably not running)

No rights Error (The client is not allowed to speak with the daemon)

Invalid Paramet (The client sent bullshit)

Following request/actions may return specialised errors:

12.4.2 Specialised Error Replies

Following errors may occur on some actions/requests and must be checked by the client if such a action/request is made:

  1. Not supported (by HW):

    Interface: com.novell.powersave.action

  2. Disabled by administrator:

    Interface: com.novell.powersave.action

  3. Already set

    Interface: com.novell.powersave.action

  4. Does not exist

    Interface: com.novell.powersave.action