我在 Ubuntu 18.04 上有一台 ThinkPad T490。我想保护我的电池(tlp 电池,最大充电量为 80,开始充电量为 75)。
然而,我似乎遇到了一些问题:
~$ sudo tlp setcharge START_CHARGE 70
Error: ThinkPad battery features not available.
我认为这是由于 tp-sampi 和/或 tpacpi-bat 的问题造成的:
~$ sudo tlp stat
...
+++ ThinkPad Battery Features
tp-smapi = inactive (kernel module 'tp_smapi' load error)
tpacpi-bat = inactive (kernel module 'acpi_call' load error)
经过谷歌搜索,似乎tp-smapi
不适用于 *30 及以上版本的 ThinkPad,tpacpi-bat
应该使用替代解决方案。我找不到有关是否/如何设置的更多帮助tpacpi-bat
。有什么提示/说明吗?:)
答案1
之后与软件包作者和维护者讨论(非常感谢他对我的新手的耐心),解决方案是更新到 PPA 版本 1.2.2(我想更新的版本也可能有效):
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tp-smapi-dkms acpi-call-dkms tlp
之后事情开始发挥作用:
~$ sudo tlp-stat
--- TLP 1.2.2 --------------------------------------------
...
+++ Battery Features: Charge Thresholds and Recalibrate
natacpi = active (data, thresholds)
tpacpi-bat = inactive (kernel module 'acpi_call' load error)
tp-smapi = inactive (ThinkPad not supported)
...
并且可以更新电池电量:
~$ sudo tlp setcharge 70 80
Setting temporary charge thresholds for BAT0:
start = 70 (no change)
stop = 80 (no change)
导致:
~$ sudo tlp-stat
...
/sys/class/power_supply/BAT0/charge_start_threshold = 70 [%]
/sys/class/power_supply/BAT0/charge_stop_threshold = 80 [%]
...
请注意,如果您希望更新在重启后仍然有效,则需要/etc/default/tlp
通过取消注释/修改第 355-356 行来更新配置文件(您需要以 root 身份打开并覆盖只读保护,例如在 vim 中您需要:w!
):
350 # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
351 # required). Charging starts when the remaining capacity falls below the
352 # START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
353 # Main / Internal battery (values in %)
354 # Default: <none>
355 START_CHARGE_THRESH_BAT0=70
356 STOP_CHARGE_THRESH_BAT0=80
357 # Ultrabay / Slice / Replaceable battery (values in %)
358 # Default: <none>
359 #START_CHARGE_THRESH_BAT1=75
360 #STOP_CHARGE_THRESH_BAT1=80
更多细节:
https://linrunner.de/en/tlp/docs/tlp-configuration.html#chargethresholds
答案2
对于 THINKPAD E14 默认阈值:
/sys/class/power_supply/BAT0/charge_start_threshold = 20 [%] /sys/class/power_supply/BAT0/charge_stop_threshold = 20 [%]
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install tp-smapi-dkms acpi-call-dkms tlp
我们可以通过以下方式将阈值改为 60/80 sudo tlp setcharge 60 80
可以通过以下方式检查sudo tlp-stat