- Home
- Packages
- Forums
- Wiki
- Bugs
- AUR
- Download

# Laptop Mode Tools (简体中文)

From ArchWiki

摘要
笔记本用户Laptop Mode Tools电源管理套件的概述。
相关页面
acpid
cpufrequtils
pm-utils
资源
Laptop Mode Tools
Mailing List Archives
Less Watts - Official Site
Laptop - ArchWiki

Laptop Mode Tools 是一个 Linux 系统下的笔记本电源管理软件。它是让内核开启笔记本电脑模式功能的主要方法，它会让硬盘降速。另外，它允许你通过一个简单的配置文件调整一些其他的节能相关的设置。

与 acpid、 CPU frequency scaling、 和 pm-utils 结合，LMT 提供大多数用户一个完整的笔记本电脑电源管理方案。

## 安装

laptop-mode-tools 可以从 官方源 中 安装。

## 配置

启用`laptop-mode`服务：

     # systemctl enable laptop-mode.service

### 硬盘

为了使用该功能您需要安装 hdparm 或者 sdparm。 查看 Hdparm.

通过 `hdparm -S` 命令来降低硬盘转速可以让计算机更省电同时更安静. 即是您正在使用电脑您依然可以使用磁盘预读功能让硬盘经常降低转速。LMT（笔记本电脑工具包）也可以使用`hdparm -B` 命令。硬盘省电级别最高（最省电）为1,最低是254,使用交流电源供电时默认为254,使用电池供电时默认为1。如果你觉得硬盘减速使得一些操作变慢的话，把它设置为一个高一点的值（比如128）是个好主意，这会让它不会太频繁的减速。 `hdparm -S` 和 `hdparm -B` 命令的一些参数设置在 `/etc/laptop-mode/laptop-mode.conf`文件中。

如果 CONTROL_MOUNT_OPTIONS 选项为 on (默认即为 on), laptop-mode-tools 会自动重新挂载你的分区, 并在挂载选项中增加了 'commit=600,noatime'。这会让磁盘日志程序jbd2每10分钟更新一次磁盘日志，而不是通常情况下的几秒钟更新一次 (注意：使用该设置你可能会丢掉前10分钟的工作成果（当系统意外关闭时）). 同时请确保不要使用 `atime` 的挂载参数, 使用 `noatime` 或 `relatime` 来替代。

注意: CONTROL_MOUNT_OPTIONS 的值不应该在nilfs2分区上被设置为 on (原因可查看 https://bbs.archlinux.org/viewtopic.php?id=134656) (也可以查看 http://www.ibm.com/developerworks/cn/linux/l-cn-nilfs2/index.html 对nilfs2文件系统的中文介绍)

### CPU 频率调节

使用该功能你需要安装调节CPU频率的驱动模块。 查看 CPU Frequency Scaling.

    # cpufreq.conf
    # ThinkPad T40/T42/T60 Example
    #
    CONTROL_CPU_FREQUENCY=1
    BATT_CPU_MAXFREQ=fastest
    BATT_CPU_MINFREQ=slowest
    BATT_CPU_GOVERNOR=ondemand
    BATT_CPU_IGNORE_NICE_LOAD=1
    LM_AC_CPU_MAXFREQ=fastest
    LM_AC_CPU_MINFREQ=slowest
    LM_AC_CPU_GOVERNOR=ondemand
    LM_AC_CPU_IGNORE_NICE_LOAD=1
    NOLM_AC_CPU_MAXFREQ=fastest
    NOLM_AC_CPU_MINFREQ=slowest
    NOLM_AC_CPU_GOVERNOR=ondemand
    NOLM_AC_CPU_IGNORE_NICE_LOAD=0
    CONTROL_CPU_THROTTLING=0

### Device and bus

#### Intel SATA

- Enable the Intel SATA AHCI controller Aggressive Link Power Management feature to set the disk link into a very low power mode in the absence of disk IO.

    # intel-sata-powermgmt.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_INTEL_SATA_POWER=1
    BATT_ACTIVATE_SATA_POWER=1
    LM_AC_ACTIVATE_SATA_POWER=1
    NOLM_AC_ACTIVATE_SATA_POWER=0

Note: Review the well-documented `/etc/laptop-mode/conf.d/intel-sata-powermgmt.conf` file for additional configuration details.

#### USB 自动休眠

    # usb-autosuspend.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_USB_AUTOSUSPEND=1
    BATT_SUSPEND_USB=1
    LM_AC_SUSPEND_USB=1
    NOLM_AC_SUSPEND_USB=0
    AUTOSUSPEND_TIMEOUT=2

Note: Review the well-documented `/etc/laptop-mode/conf.d/usb-autosuspend.conf` file for additional configuration details.

### 显示和图形

#### LCD 显示器亮度

- 可以通过以下命令来查看可用的笔记本电脑屏幕亮度数值:

    $ cat /proc/acpi/video/VID/LCD/brightness

##### ThinkPad T40/T42

对于 ThinkPad T40/T42 笔记本，最小和最大亮度的查看要通过以下命令:

    $ cat /sys/class/backlight/acpi_video0/brightness
    $ cat /sys/class/backlight/acpi_video0/max_brightness

    # lcd-brightness.conf
    # ThinkPad T40/T42 Example
    #
    DEBUG=0
    CONTROL_BRIGHTNESS=1
    BATT_BRIGHTNESS_COMMAND="echo 0"
    LM_AC_BRIGHTNESS_COMMAND="echo 7"
    NOLM_AC_BRIGHTNESS_COMMAND="echo 7"
    BRIGHTNESS_OUTPUT="/sys/class/backlight/thinkpad_screen/brightness"

##### ThinkPad T60

- For ThinkPad T60 notebooks, minimum and maximum brightness values can be obtained by running:

    $ cat /sys/class/backlight/thinkpad_screen/max_brightness
    $ cat /sys/class/backlight/thinkpad_screen/brightness

    # lcd-brightness.conf
    # ThinkPad T60 Example
    #
    DEBUG=0
    CONTROL_BRIGHTNESS=1
    BATT_BRIGHTNESS_COMMAND="echo 0"
    LM_AC_BRIGHTNESS_COMMAND="echo 7"
    NOLM_AC_BRIGHTNESS_COMMAND="echo 7"
    BRIGHTNESS_OUTPUT="/sys/class/backlight/acpi_video0/brightness"

Note: 更多配置细节请阅读 `/etc/laptop-mode/conf.d/lcd-brightness.conf` 文件。

#### Terminal blanking

    # terminal-blanking.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_TERMINAL=1
    TERMINALS="/dev/tty1"
    BATT_TERMINAL_BLANK_MINUTES=1
    BATT_TERMINAL_POWERDOWN_MINUTES=2
    LM_AC_TERMINAL_BLANK_MINUTES=10
    LM_AC_TERMINAL_POWERDOWN_MINUTES=10
    NOLM_AC_TERMINAL_BLANK_MINUTES=10
    NOLM_AC_TERMINAL_POWERDOWN_MINUTES=10

Note: Review the well-documented `/etc/laptop-mode/conf.d/terminal-blanking.conf` file for additional configuration details.

### 网络

#### 以太网

    # ethernet.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_ETHERNET=1
    LM_AC_THROTTLE_ETHERNET=0
    NOLM_AC_THROTTLE_ETHERNET=0
    DISABLE_WAKEUP_ON_LAN=1
    DISABLE_ETHERNET_ON_BATTERY=1
    ETHERNET_DEVICES="eth0"

#### 无线局域网

Wireless interface power management settings are hardware-dependent, and thus a bit trickier to configure. Depending on the wireless chipset, the settings are managed in one of the following three files:

1. `/etc/laptop-mode/conf.d/wireless-power.conf` for a generic method of saving power (using "iwconfig wlan0 power on/off"). This applies to most chipsets (that is, anything but Intel chipsets listed below).
2. `/etc/laptop-mode/conf.d/wireless-ipw-power.conf` for Intel chipsets driven by the old ipw driver. This apply to IPW3945, IPW2200 and IPW2100. It currently (as of LMT 1.55-1) uses iwpriv for IPW3945, and a combination of iwconfig and iwpriv settings for IPW2100 and IPW220. See `/usr/share/laptop-mode-tools/modules/wireless-ipw-power` for details. (note that the ipw3945 is not used anymore, see below)
3. `/etc/laptop-mode/conf.d/wireless-iwl-power.conf` for Intel chipsets driven by modules iwl4965, iwl3945 and iwlagn (this latter supports chipsets 4965, 5100, 5300, 5350, 5150, 1000, and 6000)

Note that activating the three of them should not be much of a problem, since LMT detects the module used by the interface and acts accordingly.

The supported modules for each configuration file, indicated above, are taken directly from LMT. However, this seems to be a bit out-of-date, since the current 2.6.34 kernel does not provide the ipw3945 and iwl4965 modules anymore (3945 chipset uses iwl3945 instead, and 4965 uses the generic module iwlagn). This is only brought here for information, as this does not (or should not) affect the way LMT works.

There is a known issue with some chipsets running with the iwlagn module (namely, the 5300 chipset, and maybe others). On those chipsets, the following settings of `/etc/laptop-mode/conf.d/wireless-iwl-power.conf` :

    IWL_AC_POWER
    IWL_BATT_POWER

are ignored, because the `/sys/class/net/wlan*/device/power_level` file does not exist. Instead, the standard method (with "iwconfig wlan0 power on/off") is automatically used.

### 音频设备

#### AC97

    # ac97-powersave.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_AC97_POWER=1

#### Intel HDA

    # intel-hda-powersave.conf
    # ThinkPad T40/T42/T60 Example
    #
    DEBUG=0
    CONTROL_INTEL_HDA_POWER=1
    BATT_INTEL_HDA_POWERSAVE=1
    LM_AC_INTEL_HDA_POWERSAVE=1
    NOLM_AC_INTEL_HDA_POWERSAVE=0
    INTEL_HDA_DEVICE_TIMEOUT=10
    INTEL_HDA_DEVICE_CONTROLLER=0

## Tips and tricks

### Aliases

### lm-profiler

### Disabling

## 疑难问题

### Laptop-mode-tools is not picking up events

对于使用 systemd 的系统，开启并使其开机自动加载acpid 请运行以下命令:

    # systemctl enable acpid
    # systemctl start acpid

如果这样不管用的话，请仔细检查一边 laptop-mode 的配置文件并确定需要开启的服务被设置成 1 了。许多服务，包括cpu频率控制服务 (cpufreq control) 默认设置都是'自动'("auto")，所以可能没有开启。

I have experienced issues with bluetooth not working if i boot up with battery, and i fixed it with disabling runtime-pm.

### 连接电源后Laptop-mode-tools并没有停止

这可能是因为同时安装有laptop-mode-tools和pm-utils两个软件包，它们互相会冲突，从而导致laptop-mode-tools不能准确的设定自己的状态。

This can be fixed by disabling scripts with duplicate functionality in pm-utils. The main cause of this is the laptop-mode script located in /usr/lib/pm-utils/power.d. The script can be blacklisted by creating a file in /etc/pm/config.d as follows:

    HOOK_BLACKLIST="laptop-mode"

You can also add any other scripts found in /usr/lib/pm-utils/power.d to this list to disable them. I recommend going through and disabling any hook that has equivalent functionality in LMT.

Retrieved from "https://wiki.archlinux.org/index.php?title=Laptop_Mode_Tools_(简体中文)&oldid=262324"
Categories:

- 简体中文
- Power management (简体中文)

## Navigation menu