#!/bin/sh # Anything related to powersaving WLANPATH=/sys/bus/pci/drivers/iwl3945/0000:03:00.0/power_level INTF_WOL=(eth0) # List of interfaces separated by whitespace HAL_POLLING=(scd0) # Disable device polling case "$1" in true) # Wireless power saving; sacrifice performance slightly if [ -e $WLANPATH ] ; then echo 1 > ${WLANPATH} & fi # Disable WOL for a MagicPacket(tm) for i in ${INTF_WOL[*]}; do ethtool -s $i wol d done # Enable USB autosuspend for all active USB devices for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done & # Disable HAL device polling for i in ${HAL_POLLING[*]}; do hal-disable-polling --device /dev/${i} done # Enable CPU powersaving echo 1 > /sys/devices/system/cpu/sched_mc_power_savings & echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor & # Enable "laptop mode" echo 5 > /proc/sys/vm/laptop_mode & # Modify VM dirty writeback time 5/15 seconds echo 1500 > /proc/sys/vm/dirty_writeback_centisecs & ;; false) # Disable wireless power saving if [ -e $WLANPATH ] ; then echo 0 > ${WLANPATH} & fi # Enable WOL for a MagicPacket(tm) for i in ${INTF_WOL[*]}; do ethtool -s $i wol g done # Enable HAL device polling for i in ${HAL_POLLING[*]}; do hal-disable-polling --enable-polling --device /dev/${i} done # Disable USB autosuspend for all active USB devices for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 0 > $i; done & # Disable CPU powersaving echo 0 > /sys/devices/system/cpu/sched_mc_power_savings & echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor & # Disable "laptop mode" echo 0 > /proc/sys/vm/laptop_mode & # Modify VM dirty writeback time 5/15 seconds echo 500 > /proc/sys/vm/dirty_writeback_centisecs & ;; esac