Для начала Вам нужно разработать схемы управления питанием.
Например:
--- | silent | normal | perf |
Яркость | 20 | 60 | 100 |
другие параметры | 1 | 2 | 3 |
Как управляется железо - читайте здесь:
http://axa-ru.blogspot.com/2009/08/tuning-linux-for-powersave.htmlКак основу можно использовать скрипт представленный ниже. Он у меня работает вместо Laptop Mode.
Соотвествующие команды управления записать внутри процедуры normal_mode()
#
# A script to agressively toggle power management between high performance and very low power usage.
# For more information on each of these options, see http://www.lesswatts.org
#
# To install:
#
# cd /usr/lib/pm-utils/power.d
# sudo install 99-savings.sh /etc/pm/sleep.d
# sudo install 99-savings.sh /etc/pm/power.d
#
##
## POWER SAVE OFF
##
ac_power()
{
#################################################
## USB Subsystem
##
for i in /sys/bus/usb/devices/*/power/level
do
echo "on" > $i
done
#################################################
## DISK and FILESYSTEMS
##
# Set the drive to mostly stay awake. Some may want to change -B 200
# to -B 255 to avoid accumulating Load_Cycle_Counts
# -S 240 => put in standby after 20 minutes idle
# -B 200 => do not permit spindown
# -M => not supported by my drive
hdparm -B 200 -S 240 -M 254 /dev/sda
# Remount ext3/4 filesystems so the journal commit only happens every 60
# seconds. By default this is 5 but, I prefer to reduce the disk
# activity a bit.
mount -o remount,commit=60,atime /
# Turn off the laptop mode disk optimization
echo 0 > /proc/sys/vm/laptop_mode
# Set the SATA to max performance
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host2/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host3/link_power_management_policy
#################################################
## NETWORK
##
# set the wifi to no power savings.
/sbin/iwconfig wlan0 power off
/sbin/iwconfig wlan0 txpower 15
# set the ethernet max speed.
ethtool -s eth0 wol d
ethtool -s eth0 autoneg off speed 1000
#################################################
## CPU AND MEMORY
##
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# Shedule Multitreading
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
# Set kernel dirty page value back to default
echo 10 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio
# Only wakeup every 60 seconds to see if we need to write dirty pages
# By default this is every 5 seconds but, I prefer 60 to reduce disk
# activity.
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs
# Make sure ondemand governor is set
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
#################################################
## SOUND, VIDEO. Bluetooth, Fingerprint
##
# Turn off sound card power savings
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
# Enable the webcam driver
modprobe uvcvideo
# Enable the bluetooth driver
echo enable > /proc/acpi/ibm/bluetooth
hciconfig hci0 up
# Setup maximum brigthness
echo 100 > /proc/acpi/video/VID/LCD0/brightness
}
##
## POWER SAVE ON
##
battery_power()
{
#################################################
## USB Subsystem
##
for i in /sys/bus/usb/devices/*/power/level
do
echo "auto" > $i
done
for i in /sys/bus/usb/devices/*/power/autosuspend
do
echo 1 > $i
done
echo 1 > /sys/module/usbcore/parameters/autosuspend
# rmmod uhci_hcd
#################################################
## DISK and FILESYSTEMS
##
# Set the disks to aggressively save power.
# Some might find these settings too aggressive. If so, change
# "-S 4" to something larger like -S 24 (two minutes) and -B 1 to -B 255.
# -S 4 => put in standby after 20 seconds idle
# -B 1 => highest degree of power savings
# -M => not supported by my drive
hdparm -B 1 -S 4 -M 128 /dev/sda
# Change ext3/ext4 filesystem settings to reduce disk activity.
# noatime => disable updates to a file's access time when the file is read.
# commit=600 => Change the commit times to 10 minutes.
mount -o remount,noatime,commit=600 /
# Set laptop disk write mode
echo 5 > /proc/sys/vm/laptop_mode
# Set SATA to minimum power
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
echo min_power > /sys/class/scsi_host/host2/link_power_management_policy
echo min_power > /sys/class/scsi_host/host3/link_power_management_policy
#################################################
## NETWORK
##
# set the wifi to power savings.
/sbin/iwconfig wlan0 power on
/sbin/iwconfig wlan0 txpower 5
# set the ethernet power savings.
ethtool -s eth0 wol d
ethtool -s eth0 autoneg off speed 100
#################################################
## CPU AND MEMORY
##
# Make sure ondemand governor is set
# echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# Make sure powersave governor is set
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# Shedule Multitreading
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
# Reduce disk activity by waiting up to 10 minutes before doing writes
echo 90 > /proc/sys/vm/dirty_ratio
echo 1 > /proc/sys/vm/dirty_background_ratio
echo 60000 > /proc/sys/vm/dirty_writeback_centisecs
#################################################
## SOUND, VIDEO. Bluetooth, Fingerprint
##
# Set sound card power savings
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
# Remove the webcam driver
modprobe -r uvcvideo
# Remove the bluetooth driver
hciconfig hci0 down
# rmmod hci_usb
echo disable > /proc/acpi/ibm/bluetooth
# Setup brigthness 30%
echo 30 > /proc/acpi/video/VID/LCD0/brightness
}
normal_mode ()
{
# здесь разместите команды управления оборудованием
# в режиме средней производительности
}
##
## APPLY SETTINGS
##
case "$1" in
false) ac_power ;;
true) battery_power ;;
silent) battery_power ;;
normal) normal_mode ;;
performance) ac_power ;;
esac