Next: , Previous: Security, Up: Top


14 Internals

14.1 The Daemon

The heart of the package is the daemon (/usr/sbin/powersaved). It listens for client requests (normally from non-root users), listens for hardware changes and checks e.g. the CPU load to adjust the CPU frequency dynamically.

There are a fixed amount of events that the daemon my throw. The events could be triggerd by the underlying hardware/kernel and the daemon just forwards them (e.g. ACPI events) or the daemon can generate his own events when it recognises hardware changes (e.g. low/high CPU usage, changed battery levels, ...). See Events for an complete overview of all events and Scripts how you can use them in your own scripts and programs.

14.2 The User Binary

This binary (/usr/bin/powersave) provides general information about your system (APM/ACPI, battery, throttling, CPU frequency, ...).

For some functionalities you may need a running daemon. The binary then connects to the daemon through a socket and sends its requests (e.g. suspend, standby, change CPU freq policy, ...).

The modifications could only be temporarily. They could e.g. be overridden by the policy of the daemon. E.g. if you plug/unplug AC adapter and another power scheme (see Schemes) is activated which then adjusts your power policy as you specified them for this scheme.

The binary should mainly give you some information of your hardware. Please have a look at the manpage for details.

14.3 The C-Libraries

If you intend to write your own power manageing program you can make use of the provided libraries. All libraries are build statically and shared by the build system.

14.3.1 Library that directly accesses the Hardware

The libpowersave.a/libpowersave.so library directly accesses kernel functions (through /proc, /sys or ioctl) and could be very useful to gain hardware information (Have a look into powerlib.h for provided functions).

The library is currently converted to make use of HAL functions to gain hardware information. You may want to have a look at the code and also directly make use of HAL to gain that information. However, HAL lacks in some functionalities, therefore there are still functions that access /proc and /sys files directly.

14.3.2 Library to send Requests to and retrieve HW Information from the Daemon

Only exists in old versions, deprecated, don't use.
Use the DBus interfaces instead.

14.3.3 Library to register at the Daemon to retrieve Events asynchronously

Only exists in old versions, deprecated, don't use.
Use the DBus interfaces instead.

14.3.4 Library to access the powersave daemon via DBus

This library should make it a bit easier to connect to the powersave daemon over the DBus system bus.

However, you should make use of the DBus bindings directly if possible. They are offered in different languages (perl, QT, glib, phython, ...).

See DBus what information you can query from the powersave daemon and what actions(e.g. suspend, cpufreq policy, ...) you can trigger.