当前位置: 首页 > 工具软件 > PHP-Tools > 使用案例 >

LINUX电源管理laptop-mode-tools

尹乐邦
2023-12-01

下载地址:http://samwel.tk/laptop_mode/packages/fedora


为了不让电脑风扇一直响个不停,现在实验下linux的电源管理软件laptop-mode-tools,kde下有kpowersaver据说也有这些功能,至于gnome下能不能用我也没测试,现在开始laptop-mode-tools:
1.新德里 搜索laptop-mode-tools,标记安装;
2.首先我们启动laptop-mode,edgy默认设置是禁止laptop-mode运行的
修改 /etc/default/acpi-support

代码:
   ENABLE_LAPTOP_MODE=true

sudo /etc/init.d/laptop-mode start


好了现在我们来详细配置,有中文注释的地方是我修改过的地方
修改/etc/laptop-mode/laptop-mode.conf

#
# Enable laptop mode when on AC power.
#
ENABLE_LAPTOP_MODE_ON_AC=1

#
# Enable laptop mode when the laptop's lid is closed, even when we're on AC
# power? (ACPI-ONLY)
#
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=1

# Read-ahead, in kilobytes. You can spin down the disk while playing MP3/OGG
# by setting the disk readahead to a reasonable size, e.g. 3072 (3 MB).
# Effectively, the disk will read a complete MP3 at once, and will then spin
# down while the MP3/OGG is playing. Don't set this too high, because the
# readahead is applied to _all_ files that are read from disk.
# 设定laptop_mode下的readahead buffer,如果是听mp3 3-5M,如果是看电影 8-10M
LM_READAHEAD=4096
NOLM_READAHEAD=128

# Should laptop mode tools control the maximum CPU frequency?
# 启动CPU频率控制
CONTROL_CPU_FREQUENCY=1

# Legal values are "slowest" for the slowest speed that your
# CPU is able to operate at, "fastest" for the fastest speed,
# "medium" for some value in the middle, or any value listed in
# /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies.
# 设定电池模式下的CPU频率
BATT_CPU_MAXFREQ=slowest
BATT_CPU_MINFREQ=slowest
BATT_CPU_GOVERNOR=ondemand

6.acpi能截获电源适配器事件
/etc/acpi/events/ac
在这个脚本中我们可以看到实际上调用的是/etc/acpi/power.sh脚本
保存如下代码到power.sh脚本
代码:
for x in /proc/acpi/ac_adapter/*; do
    grep -q off-line $x/state

    if [ $? = 0 ] && [ x$1 != xstop ]; then   
   for SCRIPT in /etc/acpi/battery.d/*.sh; do
       . $SCRIPT
   done
   if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
       (sleep 5 && laptop_mode_enable)&
   fi
    else
   for SCRIPT in /etc/acpi/ac.d/*.sh; do
       . $SCRIPT
   done
   if [ x$ENABLE_LAPTOP_MODE = xtrue ]; then
       (sleep 5 && laptop_mode_disable)&
   fi
    fi
done


在这段脚本中我们看到如果要让脚本在bettary模式下运行就放在/etc/acpi/battery.d/目录下,要让脚本在电源模式下于虚拟就把脚本放在/etc/acpi/ac.d/目录下



7.laptop-mode-tools的使用详见http://forum.ubuntu.org.cn/viewtopic.php?t=33119


 类似资料: