# What actions does Ubuntu trigger when battery is low?

When the battery is low, the screen gets dimmed after a few seconds already.

This appears to be some special power-saving mode, and might be related to the time in org.gnome.settings-daemon.plugins.power.time-low (1200 seconds (20 minutes) the default).

While this seems to get triggered by gnome-settings-daemon, I wonder what else Ubuntu does when this happens (e.g. via DBus listeners), or other event listeners that look for a "low battery" state.

It seems like something in this regard causes Ubuntu / X / the system to behave more sluggish afterwards (when the laptop is on AC again), and I would like to look into what might be causing this.

I could not find anything related via dconf-editor, e.g. in org.gnome.settings-daemon.plugins.power.

It appears to get setup via idle_configure in plugins/power/gsd-power-manager.c, but it's probably something more related to something that listens on the DBus interface, which gets notified via e.g.:

    if (!g_dbus_connection_emit_signal (manager->priv->connection,
NULL,
GSD_POWER_DBUS_PATH,
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
props_changed,
&error))


I could imagine that some "power saving" property gets set, but not unset when AC is available anymore and/or the battery is not low anymore.

I have looked at the CPU governor setting (/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor), but it was ondemand.

I am using gnome-settings-daemon with awesomeWM on Ubuntu 14.04.

gnome-settings-daemon=3.8.6.1-0ubuntu11.1


I've also compared gsd's plugins/power/gsd-power-manager.c with the one from Debian's gnome-settings-daemon-3.12.1, but could not find anything obvious that might have been fixed/changed in this regard.

I have managed to trigger the gnome-power-manager's gnome-settings plugin (which dims the screen etc), by patching upower and use it after killing the system's upower daemon. (note that it's probably only energy that is being used by gpm to calculate it by itself).

It does not make the system become sluggish..

OTOH I have not heard the speaker's beeping, which might come from the BIOS, which might be involved here, too - or other programs using the kernel's interface on /sys/class/power_supply/BAT0/.

--- src/linux/up-device-supply.c.orig   2014-06-07 16:48:32.735920661 +0200
+++ src/linux/up-device-supply.c    2014-06-07 16:48:39.391920525 +0200
@@ -821,6 +821,9 @@
supply->priv->energy_old_first = 0;
}

+   percentage = 3.1f;
+   time_to_empty = 3*60;
+   energy = 5;
g_object_set (device,
"energy", energy,
"energy-full", energy_full,

• You might also wish to examine acpi events: this appears to be related: askubuntu.com/questions/33062/… – Elder Geek Jul 14 '14 at 20:56
• This is interesting as well cat /usr/share/acpi-support/policy-funcs – Elder Geek Jul 14 '14 at 20:58
• @ElderGeek I only have /usr/share/acpi-support/state-funcs on my system. policy-funcs is available in acpi-support-base (but only for Debian). – blueyed Jul 17 '14 at 1:04
• This page features intersting script, power.d hook: help.ubuntu.com/community/PowerManagement/ReducedPower – Sergiy Kolodyazhnyy Aug 24 '14 at 12:39
• Not a direct answer, but you should look into tlp and tlp-rdw, and what they can have Ubuntu do when there is low power. – earthmeLon Sep 21 '14 at 21:21