Laptop (简体中文)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
翻译状态:本文是 Laptop翻译。上次翻译日期:2017-11-13。如果英文版本有所更改,则您可以帮助同步翻译。

本文是笔记本索引页面,包括很多到其它页面的链接,以帮助用户将笔记本电脑配置为最佳体验。配置笔记本电脑大体上和配置台式机相同,但仍然存在一些关键的区别。Arch Linux 提供了完成这些配置所需的软件工具。下文重点讲述这些软件,并附以适当的提示和教程。

下面的厂商专页包含具体笔记本型号需要注意的地方。

AcerAppleASUSDellFujitsuHPIBM/LenovoMSISamsungSonyToshibaOther

如果某个笔记本需要特殊的操作,会在厂商页面提供链接,如果找不到您的型号,可以参考 Category:Laptops 中的相似型号。

电源管理

注意: 阅读本节应首先阅读 Power management,本节介绍的是笔记本特有的功能设置。

如果想充分利用电池容量,电源管理是非常重要的。下列工具能帮助延长电池寿命,并保持笔记本电脑的低温和静音。

电池状态

有多种方式可以读取电池状态,传统方法是用 ACPI 接口周期查询。在某些系统中,电池会在每消耗 1% 电量的时候发送 udev 事件,可以用 udev 规则执行需要的操作。

ACPI

电池状态可以从终端用 ACPI 工具读取。acpi 软件包提供了 ACPI 命令行工具,详情请参见 ACPI modules

  • cbatticon 是常驻系统托盘的电池图标。
  • batterymon-cloneAUR 是常驻系统托盘的电池监控程序,与 batti。
  • batifyAUR 是一个通过充放电和电量变化 udev 规则文件触发的通知程序(支持 multi-x 会话)。
  • batsignalAUR 是一个使用 libnotify 来通知低电量警告的轻量化电池监控守护程序。

低电量时自动休眠

If your battery sends events to udev whenever it (dis)charges by 1%, you can use this udev rule to automatically hibernate the system when battery level is critical, and thus prevent all unsaved work from being lost.

注意: Not all batteries report discharge events. Test by running udevadm monitor --property while on battery and see if any events are reported. You should wait at least 1% drop. If no events are reported and /sys/class/power_supply/BAT0/alarm is non-zero then the battery will likely trigger an event when BAT0/energy_now drops below the alarm value, and the udev rule will work as long as the percentage math works out. Some laptops have an option for this disabled in BIOS by default.
/etc/udev/rules.d/99-lowbat.rules
# Suspend the system when battery level drops to 5% or lower
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/usr/bin/systemctl hibernate"

This rule will be repeated whenever the condition is set. As such, when resuming from hibernate when the battery is critical, the computer will hibernate directly. Some laptops do not boot beyond a certain battery level, so the rule could be adjusted accordingly.

Batteries can jump to a lower value instead of discharging continuously, therefore a udev string matching pattern for all capacities 0 through 5 is used.

Other rules can be added to perform different actions depending on power supply status and/or capacity.

If your system has no or missing ACPI events, use cron with the following script:

#!/bin/sh
acpi -b | awk -F'[,:%]' '{print $2, $3}' | {
	read -r status capacity

	if [ "$status" = Discharging -a "$capacity" -lt 5 ]; then
		logger "Critical battery threshold"
		systemctl hibernate
	fi
}
Testing events

One way to test udev rules is to have them create a file when they are run. For example:

/etc/udev/rules.d/98-discharging.rules
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", RUN+="/usr/bin/touch /home/example/discharging"

This creates a file at /home/example/discharging when the laptop charger is unplugged. You can test whether the rule worked by unplugging your laptop and looking for this file. For more advanced udev rule testing, see Udev#Testing rules before loading.

挂起和休眠

根据笔记本的使用模式,手动将系统挂起到内存或磁盘是提高电池使用时间的最有效方法。请参阅 Suspend and hibernate

硬盘停转问题

Documented here.

To prevent your laptop hard drive from spinning down too often, set less aggressive power management as described in hdparm#Power management configuration. Even the default values may be too aggressive.

Modify wake events

Events which cause the system to resume from power states can be regulated in /proc/acpi/wakeup. Writing an entry from the Device column toggles the status from enabled to disabled, or vice-versa.

For example, to disable waking from suspend (S3) on opening the lid, run:

# echo LID > /proc/acpi/wakeup

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: "Permanent toggling" is not the desired behaviour considering that systemd-tmpfiles can be run repeatedly. (Discuss in Talk:Laptop (简体中文))

This change can be made permanent with tmpfiles.d(5):

/etc/tmpfiles.d/disable-lid-wakeup.conf
w /proc/acpi/wakeup - - - - LID

Cpufrequtils

CPU frequency scaling依据当前系统载荷及电源方案,使CPU加速或降速。快速简易的安装。

硬件支持

屏幕亮度

请参见 Backlight

触摸板

要使触摸板正常工作,可参见 libinput 页面。Touchpad Synaptics 是较旧的输入驱动程序,目前处于维护状态且不再更新。

完全检测不到触摸板

如果系统完全未检测到触摸板并将其显示为设备,使用一个或多个下列的内核参数是一种可行的解决方法。

i8042.noloop i8042.nomux i8042.nopnp i8042.reset
Elantech

如果系统检测不到 Elantech 触摸板,并且能在 journalctl -k 中看到下列行内容:

elan_i2c 5-0015: 5-0015 supply vcc not found, using dummy regulator

这与 psmouse 模块尝试为触摸板设备使用辅助总线时出现的一个问题有关,因为 elan_i2c 无法那样做。解决方法是强制模块使用主总线。只需创建下面这样一个文件并重新加载 psmouse 模块或者重启系统:

/etc/modprobe.d/psmouse.conf
options psmouse elantech_smbus=0

指纹传感器

请参阅 Fingerprint-gui, fprintThinkFinger (适用于 ThinkPads)。

网络摄像头

请参阅 Webcam setup

硬盘冲击保护

不同厂家的多款笔记本都有硬盘冲击保护的功能。目前,由于制造商不愿支持所需软件组件的开源开发,Linux 对于冲击保护的支持在不同的硬件设施之间有很大的差异。

当前,有两个分别叫做 HDAPSHpfallAUR 中可用)的项目支持硬盘保护功能。前者适用于 IBM/联想 Thinkpads,而后者适用于惠普/康柏笔记本。

混合图形显示

笔记本制造商已经开发了新技术,可以将两个显卡融入一台计算机中,使得高性能和低耗电的兼顾成为可能。这些笔记本通常默认情况下使用英特尔显卡用于显示,所以首先需要安装 英特尔显卡 驱动。然后可以从 这里选择方法 来利用第二张显卡。

音频静音 LED

使用英特尔高清音频技术(Intel HD Audio)的笔记本,可能需要用户手动指定编解码器型号才能使音频静音 LDE 指示灯正常工作。首先,检查笔记本是否使用了英特尔高清音频技术:

# lsmod | grep snd_hda_intel

如果有任意形式的输出,说明这台笔记本确实使用了英特尔高清音频技术。下一步,需要找到对应的音频编解码器型号,运行:

# cat /proc/asound/card*/codec* | grep Codec

现在,需要在 可用模块名称列表中 找到相应的编解码器。如果找不到特定型号的编解码器,则可以通过反复试验找到适合的编解码器。

为告知内核要加载哪个型号指定的选项,请指定 model= 内核模块选项。 例如:

/etc/modprobe.d/mute-led.conf
options snd-hda-intel model=model_name

要测试其是否可用,内核模块必须要重新加载。也可以通过重启来完成。

网络时间同步

对于笔记本电脑,为了通过网络同步时钟,Chrony相较于NTPdOpenNTPDsystemd-timesyncd 更好. Chrony 被设计为:即使在没有永久网络连接的系统(如笔记本电脑)上也能很好地工作;而且相较于标准ntp,能更快地进行时间同步。当在虚拟机中的系统使用时,Chrony 有如下优点:更大的频率校正范围,能校正快速漂移的时钟;更好地响应时钟频率的快速变化。它的内存占用较小,且非必要不唤醒进程,提高了电量的使用效率。

参阅

通用页面
  • CPU frequency scaling is a technology used primarily by notebooks which enables the OS to scale the CPU frequency up or down, depending on the current system load and/or power scheme.
  • Display Power Management Signaling describes how to automatically turn off the laptop screen after a specified interval of inactivity (not just blanked with a screensaver but completely shut off).
  • Wireless network configuration provides information about setting up wireless connection.
  • Extra keyboard keys describes configuration of Media keys.
  • acpid which is a flexible and extensible daemon for delivering ACPI events.
型号相关页面
  • See Category:Laptops and its subcategories for pages dedicated to specific models/vendors.
  • Battery tweaks for ThinkPads can be found in TLP and the tp_smapi article.
  • acerhdf is a kernel module for controlling fan speed on Acer Aspire One and some Packard Bell Notebooks.
外部资源