# &application; Manual

&application; is a session daemon for the GNOME Desktop that manages the power settings for your laptop or desktop computer.

2006 Richard Hughes (richard@hughsie.com)
Richard Hughes &legal;
Richard Hughes richard@hughsie.com
2.0
2006-08-30

Richard Hughes richard@hughsie.com

Richard Hughes

Feedback

To report a bug or make a suggestion regarding the &app; application or this manual, follow the directions in the &application; Contact Page.

## Introduction

The &app; session daemon is a power management daemon for the GNOME desktop

&application; Manual gnome-power-manager

## Usage

&app; is usually started in GNOME startup, but you can manually start &app; by doing:

Command line

  Type `gnome-power-manager --verbose --no-daemon`, then press Return:

## Notification Messages

When &application; has started, the following notifications may be displayed.

### AC Adapter Unplugged

&app; Notification when AC adapter is removed

You can disable this notification by changing the GConf key `/apps/gnome-power-manager/notify/discharging`.

### Fully Charged

&app; Notification when laptop primary battery is fully charged

You can disable this notification by changing the GConf key `/apps/gnome-power-manager/notify/fully_charged`.

You will only get a repeat notification if your battery percentage charge drops below 95% and then is again fully charged. This prevents some machines from showing unwanted repeat notifications if the battery is incorrectly reporting the charged status.

### Power Low

When the battery is low, you will receive the following notification. You should consider switching to AC power really soon.

&app; Notification when battery power is low

You can disable this notification by changing the GConf key `/apps/gnome-power-manager/notify/low_power`.

### Power Critical

When the computer has run out of power, it will show this notification explaining what action is required. You can change the critical low action using the preferences tool.

&app; Notification when the system power is critically low

### Suspend Failure

When a suspend failure occurs you may get this following warning. The most common reason for this notification is that the current user does not have permission to suspend or hibernate the computer.

&app; Notification when suspend failure occurs

You can disable this notification by changing the GConf key `/apps/gnome-power-manager/notify/sleep_failed`.

## Statistics

The statistics program allows you to visualize the power consumption of your laptop hardware.

This has been removed from the information window of previous versions of &app; as the data interface is now using DBUS rather than internal IPC. This allows other applications to query and display the data if required.

Power History going from battery power to AC

You may not see some options or graphs if your computer does not have the required hardware. You may also see other hardware not shown here (for example UPS devices) but these are treated the same way as other devices.

### Charge History

This graph shows the percentage charge available for the composite primary battery, so if you have a main laptop battery and an auxiliary battery then only the averaged value will be shown. A legend is not shown with this graph.

### Power History

This graph shows the power history charge used by the composite primary battery. This line represents the amount of power that is either being used to charge the batteries in the system, or the power being used by the system from the batteries. You should see the line go up when processor intensive tasks are performed, and down when the system is at idle, or when the screen is dimmed. A legend is shown with this graph when data events have been received.

You do will not receive rate data from your computer if it is not charging or discharging, or if the computer is suspended. This is due to hardware limitations where the rate is only sent from the battery management chip, rather than the power management chip on the motherboard.

### Estimated Time History

This graph shows the estimated charge history for the composite primary battery. This line represents the amount of time required until charged, or the amount of time until discharge. This line should go proportionally up when the rate decreases and down when the rate increases. A legend is shown with this graph when data events have been received.

## Preferences

The preferences window allows you to control:

- The LCD brightness when on AC and battery power

- The idle time for the screen power-down and suspend action

- The actions to perform when the laptop lid is closed

- The notification area icon policy

Some sliders or option boxes may be disabled if the GConf policy keys are not writable. This allows administrators to lock-down the actions that a user can select.

### AC Preferences

&app; AC tab

### Battery Preferences

&app; battery tab

This allows a powerful computer to reduce the power usage when idle, or when the full capabilities are not required.

### General Preferences

&app; general tab

### Session and system idle times

`gnome-screensaver` is a session daemon that monitors user input, and if the mouse has not been moved, or the keyboard been pressed then it starts a timeout. When the value of this timeout reaches the value set in `gnome-screensaver-preferences`, then the login is marked as 'session idle'. This is when &application; performs all the session idle actions such as enabling low-power mode and lowering the laptop panel brightness.

Changing the session idle timeout in `gnome-screensaver-preferences`

As soon as the session is marked at idle, &application; starts its own 'system' timer. When the timeout set in `gnome-power-preferences` is reached, and the CPU load is idle, then the idle action is performed, which is usually to turn off the screen, or to suspend or hibernate.

To make this clearer, the sliders in `gnome-power-preferences` are set to start at the value of the session-timeout + 1 minute, as we cannot logically trigger before the session is marked as idle. If you adjust the value of the 'session idle' timeout in `gnome-screensaver-preferences` then the start of the sliders in `gnome-power-preferences` will change accordingly.

## Advanced Preferences

### Screen Dim Brightness

You can change the idle laptop panel brightness by changing the GConf key `/apps/gnome-power-manager/backlight/idle_brightness`.

### Screen Locking

By default, &application; supports a simple locking scheme. This means that the screen will lock if set to "Lock screen" in gnome-screensaver when the lid is closed, or the system performs a suspend or hibernate action.

There is a complex locking scheme available for power users that allows locking policy to change for the lid, suspend and hibernate actions. To enable this complex mode, you will have to disable the GConf key:

- `/apps/gnome-power-manager/lock/use_screensaver_settings`

Then the policy keys can be set to force a gnome-screensaver lock and unlock when the action is performed:

- `/apps/gnome-power-manager/lock/blank_screen`

- `/apps/gnome-power-manager/lock/suspend`

- `/apps/gnome-power-manager/lock/hibernate`

The lock policy for gnome-screensaver is ignored until the simple mode is re-enabled.

## GNOME Power Applets

### Brightness Applet

The brightness applet allows the user to change the brightness temporarily without changing the default policy. This may be useful if you have got a laptop without brightness buttons, as you can now change the brightness easily.

Brightness applet drop-down.

You will not get the slider if your hardware is not supported.

### Inhibit Applet

The inhibit applet allows the user to prevent the computer auto-sleeping when inactive. This may be required with old or proprietary programs such as VMWare or Matlab. Just click the icon for the auto-suspend to be inhibited, and click it again for normal operation.

Inhibit applet in inhibited state.

Don't use this applet if you just use GNOME software, instead file a bug to make the application use the Inhibit() and UnInhibit() methods as this should 'just work'.

## Frequently Asked Questions

These are questions the mailing list gets asked frequently.

### What is battery capacity?

Capacity is how much charge your battery can store compared to its manufacturer's guidelines.

This graph shows the capacity of a typical lithium ion battery over a few hundred charge-discharge cycles.

### What's the difference between suspend and hibernate?

The Suspend state is a power saving feature which is the lowest level of power consumption that preserves program data in the computer's memory. When your computer is in the Suspended state, computation will not be performed until normal activity is resumed. It will not resume until signaled by an external event such as a keyboard button press. It generally takes a few seconds to suspend and then resume your computer.

You still use a small amount of battery power whilst suspended, so is not recommended for the low power action. If you remove AC power on a desktop, or run out of battery power on a laptop then you will lose your work.

The Hibernation state saves the complete state of the computer to hard disk and turns off the power, so that the computer appears to be off. It will not resume until signaled by an external event such as a keyboard button press. This is the lowest power sleeping state available. If you remove AC power on a desktop, or run out of battery power on a laptop then work will not be lost. It can take up to a minute or more to hibernate and wake your computer.

### My monitor is broken and treats DPMS standby and off states as 'no-signal' which leaves the monitor powered on.

You have to change the DPMS suspend mode &application; uses. Open `gconf-editor`, and then change the keys `/apps/gnome-power-manager/backlight/dpms_method_ac` and `/apps/gnome-power-manager/backlight/dpms_method_battery` to one of the modes that work, e.g. standby, suspend or off.

### I've set the computer inactive timeout to one minute and it still takes longer than that to suspend.

gnome-screensaver is a session daemon that monitors user input, and if the mouse has not been moved, or the keyboard been pressed then it starts a timeout. When the value of this timeout reaches the value set in gnome-screensaver-preferences, then the login is marked as 'session idle'. This is when &application; performs all the session idle actions such as enabling low-power mode and lowering the laptop panel brightness.

As soon as the session is marked at idle, &application; starts its own 'system' timer. When the timeout set in gnome-power-preferences is reached, and the CPU load is idle, then the idle action is performed, which is usually to turn off the screen, or to suspend or hibernate.

In &application; 2.14 the timeouts were not obviously linked to gnome-screensaver, but the timeouts are linked in reality. This is because the gnome-screensaver declares the session "idle" and then &application; starts. Therefore the real time to suspend is actually the GNOME Screensaver timeout PLUS the &application; time.

In &application; 2.16 and newer, the sliders in `gnome-power-preferences` are set to start at the value of the session-timeout + 1 minute, as we cannot logically trigger before the session is marked as idle. If you adjust the value of the 'session idle' timeout in `gnome-screensaver-preferences` then the start of the sliders in `gnome-power-preferences` will change accordingly. This makes it more obvious for new users.

### My time to discharge is always incorrect due to a faulty battery, what can I do?

You might be able to use the percentage charge for g-p-m to use as the policy data. Open `gconf-editor`, and then change the key `/apps/gnome-power-manager/general/use_time_for_policy` to false. You can do this easily by doing: `gconftool-2 --set --type bool /apps/gnome-power-manager/general/use_time_for_policy false`

This should get the policy actions working for you, but of course the time remaining will still be incorrect.

### Why does not my IBM laptop have the brightness sliders in Power Preferences?

You need to add to `/etc/modprobe.conf` the following text: `options ibm_acpi experimental=1`

This will enable the experimental features and make the LCD work.

You will have to use sudo or a root account to edit this file.

### Why does my lid state get confused after suspending or hibernating? (and) My laptop suspended when I didn't expect it to when I removed the power cord!

When you suspend and then resume, ACPI does not seem to send the "lid open" event like it should, which I presume is because userspace is not in a position to handle the kernel event when we start to thaw userspace processes.

What we have to do it manually refresh the lid device using HAL when we resume, so that the new "lid open" value is propagated to &application;.

You need to update to a newer version of HAL, or use your updated distribution bug-fix packages.

### Does &application; support APM?

It supports whatever backends HAL supports! At the moment this includes:

- APM (Pre-2000 Intel computers)

- ACPI (most modern Intel compatible computers)

- PMU (Powerbook, and iBook PPC computers)

### Why does &application; not let me suspend or hibernate?

Before showing items such as "Suspend" and "Hibernate" in the menu g-p-m checks two things:

- If HAL can detect a sleep handler in the kernel. You can test this doing `lshal | grep can_suspend`. HAL works this out from looking at `/sys/power/state`, and also checking for the presence of suspend2.

- If your administrator (or you!) has disabled the ability to do a certain action. You can test this using `gconftool-2 -R /apps/gnome-power-manager | grep can` and change the values to be something more suitable.

For instance, my PowerBook reports from HAL that it can suspend and hibernate, but because I know my hibernate does not work, I can disable it in `gconf-editor` removing the option from `gnome-power-preferences` and the drop-down menu.

If HAL does not list the options you want, then maybe you need to check your BIOS to check that it's running in the correct mode, and also that you have compiled your kernel with the correct options.

If there are no gconf keys returned by the second check above, you need to reinstall your gconf schema as per gnomebug:341256: (as root):

    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
    gconftool-2 --makefile-install-rule data/gnome-power-manager.schemas
    killall -HUP gconfd-2

### Why does my screen dim or screensaver start even when I'm clicking the mouse?

If you click the mouse, or scroll the scroll-wheel without moving the pointer, then gnome-screensaver will detect the session as being idle. This is a limitation of X.org, but is worked around in newer versions of gnome-screensaver.

### How do I make my application stop the computer auto-suspending?

If your application is doing a long operation, you might want to disable the ability to suspend for a little while. You should use this method if you really don't want the user to be able to suspend, or for the computer to save power by hibernating or suspending during:

- Copying files in Nautilus

- Doing a long kernel compile or Matlab simulation

- During a SELinux relabel

- Many others...

Then you can use the Inhibit() and UnInhibit() DBUS methods built into the newest versions of &application;. Here is a simple demonstration in python:

    #!/usr/bin/python
    import dbus
    import time
    bus = dbus.Bus(dbus.Bus.TYPE_SESSION)
    devobj = bus.get_object('org.freedesktop.PowerManagement', '/org/freedesktop/PowerManagement/Inhibit')
    dev = dbus.Interface(devobj, "org.freedesktop.PowerManagement.Inhibit")
    cookie = dev.Inhibit('Nautilus', 'Copying files')
    time.sleep(100)
    dev.UnInhibit(cookie)

There is an example which shows developers how to add Inhibit and UnInhibit DBUS methods into existing programs.

### Are &application; and GNOME Screensaver inhibit methods the same?

If you call the inhibit methods on gnome-screensaver, then gnome-screensaver will not mark your session as idle. This means that the screen will not dim, the screensaver will not start and the computer will not suspend automatically.

While playing a movie full-screen, totem should use the gnome-screensaver inhibit methods. The idea is that totem does not have to worry at all about power management. The only thing it wants to assert is that even though there are no key presses or mouse movements, the session is still being used.

The only applications that should use the &application; inhibit method are things that want to assert that the session can be marked as idle, but important things are still happening, so it should not power down. For example, when copying 4.5GB of files in Nautilus, you want the screensaver to display, and the LCD panel to dim, but you don't want the computer to think that it is idle and shutdown, suspend or hibernate.

### &application; does not spin down my hard-drive!

After numerous debates, the consensus was that is was not a good idea to add this functionality to HAL. It was decided user-configurable power management was not really required when modern hard disks have really intelligent power management.

Here the power consumption data for a typical notebook hard disk (IDE/SATA):

    Startup (peak, max.)		5.5W 	NC
    Seek				2.3W	2.7W
    Read (avg.)			2.0W	2.3W
    Write (avg.)			2.0W	2.3W
    Active idle (avg.)		1.1W	1.2W
    Low power idle (avg.)		0.85W	0.9W
    Standby (avg.)			0.2W	0.25W
    Sleep				0.1W	NC

The conclusions you can take from this are:

- A disk on low power idle mode needs less than 1 Watt. For a normal battery with 50Wh you could run the hard disk for over 50 hours.

- If you do not read/write from/to the hard disk the disk regulates power, but never shuts down the device. The reason is easy: you lost more power with each startup than to leave the hard disk online somewhere between 'Active idle' and 'Low power idle' (depends on the model/manufacturer).

- The other reason to leave this to the internal power management of the disk is: the time needed to reactivate the device. You lose more performance than you lose power between 'Active idle' and 'Low power idle'.

- If you use a journaling file system you normally need to flush periodically. This could run in a race between shut down device and restart device by system to flush. This means more power consumption as you change nothing.

- You can't set power management for external USB hard disks, because you can't send the needed commands over the USB link to the disk.

### I'm running ACPI. Why do events (such as removing the AC adapter) take so long to register?

One of two things might be the problem.

- HAL might not be running the addon that captures the ACPI event.

- You BIOS could be faulty, and might need a work-around. Please send a bug report.

For the first case, try to find the HAL processes that are running: `ps -eaf | grep hal`

And check for the process `hald-addon-acpi`. If it is not being run, then please make sure that HAL is being run with the `--retain-privileges` option in the `haldaemon` initscript. An alternative to this is to use acpid, rather than the kernel proc file.

### How do I query or do actions on &application; from my shell script?

You can use the dbus-send program. For example, you can set the DPMS mode by running the following:

    dbus-send --session \
    	  --dest=org.freedesktop.PowerManagement \
    	  --type=method_call \
    	  --print-reply \
    	  --reply-timeout=2000 \
    	  /org/freedesktop/PowerManagement \
    	  org.freedesktop.PowerManagement.SetDpmsMode \
    	  string:suspend

You can put the system into hibernation using the following:

    dbus-send --session \
    	  --dest=org.freedesktop.PowerManagement \
    	  --type=method_call \
    	  --print-reply \
    	  --reply-timeout=2000 \
    	  /org/freedesktop/PowerManagement \
    	  org.freedesktop.PowerManagement.Hibernate

See the developers guide file in CVS for the full list.

### Nothing happens when I click suspend or hibernate!

HAL might not *yet* support your distro, or you might have found a bug in &application;. Refer to the reporting bugs section.

### Why does not my video adaptor come back after a suspend? It just displays black!

You may need to add a s3 command to your kernel boot string so that the kernel can re-initialize your video card. See this document for more details, or to see if your system has been identified as needing any extra switches.

Using the new pm-utils should make all this stuff just work in the future using HAL fdi matching against machine DMI and video card vendor and product IDs.

## About

&app; was written by Richard Hughes richard@hughsie.com. To find more information about &app;, please visit the &application; web page.

To report a bug or make a suggestion regarding this application or this manual, follow the directions at the &application; Bug Page.

This program is distributed under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license can be found at this link, or in the file COPYING included with the source code of this program.

&application;
gnome-power-manager