Power Save Switch (Graphics related) for Linux

Now the graphics card switch…
First things first, backup your current xorg.conf file to xorg.conf.speed:

cp /etc/X11/xorg.conf/etc/X11/xorg.conf.speed

Next download the Intel Xorg driver. There should only be one.

Now to create a config for the intel card:

sudo nano /etc/X11/xorg.conf.stamina

and past the following in to save:

xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg

Section "Files"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbVariant" "intl"
Option "XkbOptions" "lv3:ralt_switch"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
Option "SHMConfig" "on"
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/wacom"
Option "Type" "stylus"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "eraser"
Option "Device" "/dev/input/wacom"
Option "Type" "eraser"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "cursor"
Option "Device" "/dev/input/wacom"
Option "Type" "cursor"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

Section "Device"
# Identifier "Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller"
# Driver "intel"
# BusID "PCI:0:2:0"
Identifier "Configured Video Device"
Option "AccelMethod" "uxa"
Option "EXAOptimizeMigration" "true"
Option "MigrationHeuristic" "greedy"
Option "Tiling" "true"
EndSection

Section "Monitor"
Identifier "Color LCD"
Option "DPMS"
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller"
Monitor "Color LCD"
DefaultDepth 24
SubSection "Display"
Modes "1280x800"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"

# Uncomment if you have a wacom tablet
# InputDevice "stylus" "SendCoreEvents"
# InputDevice "cursor" "SendCoreEvents"
# InputDevice "eraser" "SendCoreEvents"
InputDevice "Synaptics Touchpad"
EndSection

A lot of that is not necessary anymore so I’ll cut it down when I get some time to go through it.

Now, to create the switching script:

sudo nano /etc/init.d/xorg_conf

Add this to the file and then save it:

#!/bin/bash
#xorg.conf switcher shell script

VIDEO='/usr/bin/lspci |grep -c nVidia'

if [ "$VIDEO" = 1 ]; then
 cp -f /etc/X11/xorg.conf.speed /etc/X11/xorg.conf
else
 cp -f /etc/X11/xorg.conf.stamina /etc/X11/xorg.conf
fi

This just checks the switch and copies the relevant config file to the position of the main xorg.config.
Of course, we now need the system to actually run the script, so start by making it executable:

sudo chmod +x /etc/init.d/xorg_conf

and finally link it to the runlevel responsible for startup:

sudo ln -s /etc/init.d/xorg_conf /etc/rc2.d/S12xorg_conf

And there you go… switch working. Just remember we’ve left it so that power saving really is just that… power saving. No 3D acceleration, just low power usage from the Intel chipset.
For more control of power usage add two CPU scaling monitors to a panel and set them to monitor each of the CPU cores.

Leave a Reply

Your email address will not be published. Required fields are marked *