I configured power saving in two files.

/etc/rc.local

My /etc/rc.local looks like the following:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# runtime power management
for i in `find /sys/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/pci/devices/*/power/control`; do echo auto > $i; done;
# usb autosuspend
for i in `find /sys/bus/usb/devices/*/power/level`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;
exit 0

This takes care of several settings PowerTop refers to. I want these applied in all cases. Most of these are set by default, but I include these here to make certain.

/etc/pm/power.d/powertop

I created a new file /etc/pm/power.d/powertop with the following:

# Power saving tunables
 #
 # The true case will trigger when on battery, false when on AC power
case $1 in
 true)
 # nmi watchdog off
 echo 0 > /proc/sys/kernel/nmi_watchdog
 # vm writeback
 echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
 # dim screen brightness on battery
 echo 0 > /sys/bus/pci/devices/0000:00:02.0/backlight/acpi_video0/brightness
 ;;
 false)
 #nmi watchdog on
 echo 1 > /proc/sys/kernel/nmi_watchdog
 # vm writeback
 echo 500 > /proc/sys/vm/dirty_writeback_centisecs
 # brighten screen brightness on AC
 echo 10 > /sys/bus/pci/devices/0000:00:02.0/backlight/acpi_video0/brightness
 ;;
 esac
exit 0

Do a 'chmod 755' on the file. This will tweak some settings when on battery. It reverts to the default when on AC power.



My original entry is here: Ubuntu 12.04.1 Power Tweaks on a ThinkPad T430s. It posted Sun, 28 Oct 2012 00:46:18 +0000.

Filed under: technology, Lenovo, t430s, ThinkPad, Ubuntu,