FanControl

starlitxiling Lv3

风扇控制

这里只记录笔者本人对蓝天模具(clevo)使用linux的过程中控制风扇的探索,如果你不是此类模具,请参考Fan_speed_control

国内二线品牌大部分都是蓝天模具,不是的比如有联想、华硕、戴尔,其它我也不清楚,网上随便搜搜就能找到自己电脑是什么模具了。

对于蓝天模具的电脑,我在探索过程中发现Archlinux wiki中给的所有方法均不起作用,sensors-detect会检测不到风扇的转速,nbfc也无法运行,CoolerControl因为显卡驱动问题应用会卡在空白页,解决方法可以参考issue229 ,但是这对本人并没有效果,网页也缺少风扇的设置选项,如图这里尝试通过命令行去设置风扇的速度,例如sudo coolercontrol --statussudo coolercontrol --set-fan 1 --speed 2000,会出现Could not determine the accessibility bus address的错误,无法确定可访问总线地址,说明它无法获取风扇有关的值。

在一名群友的帮助下,我找到了clevo-indicator ,不过它是在Ubuntu下的,本人是Archlinux,所以如果你也想在Archlinux使用这个,你可以进行以下步骤:

1
2
3
4
5
sudo pacman -Syu base-devel gtk3 git    
yay -S libayatana-appindicator
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig
https://github.com/starlitxiling/clevo-indicator(本人仓库已修复了一些api过时的问题,2024.07.29)
make && sudo make install

在安装之后,你可以直接clevo-indicator来运行,这样默认是auto模式,也就是蓝天模具默认的极其激进的风扇策略,你也可以clevo-indicator 40这样指定风扇的转速。在开始使用时,你可能会遇到下面这样的报错:

1
2
3
4
5
6
7
Simple fan control utility for Clevo laptops
Indicator...
modprobe: FATAL: Module ec_sys not found in directory /lib/modules/6.10.0-arch1-2
unable to read EC from sysfs: No such file or directory
main on worker quit signal

[1] + 24416 done sudo clevo-indicator

这是因为你的内核缺少ec_sys模块,你可以先ls /lib/modules/$(uname -r)/kernel/drivers/acpi/ec_sys.ko检测是否存在ec_sys模块,如果存在,可以手动加载sudo modprobe ec_sys。如果没有,你需要自行安装,这里从网上下载的都存在一些问题,提供一个最直接的办法就是用linux内核直接编译一个出来,过程如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 编译模块
mkdir -p ~/kernel-source
cd ~/kernel-source
git clone https://github.com/torvalds/linux.git
cd linux
git checkout v6.10 (这里的分支要与当前运行内核相匹配,可以使用`uname -a`查看)
cd drivers/acpi
make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
# 安装模块
sudo cp ec_sys.ko /lib/modules/$(uname -r)/kernel/drivers/acpi/
sudo modprobe ec_sys write_support=1
# 设置模块在启动时加载
echo "ec_sys" | sudo tee /etc/modules-load.d/ec_sys.conf
echo "options ec_sys write_support=1" | sudo tee /etc/modprobe.d/ec_sys.conf

在完成之后,你可以通过lsmod | grep ec_sys来查看该模块是否正常加载,为了不每次都要sudo运行,你可以进入/usr/local/bin下面执行sudo chown root clevo-indicatorsudo chmod u+s clevo-indicator


但这个软件在我的电脑上只能控制CPU风扇,GPU风扇依然狂转,所以并没有满足我的需求,又经过一轮寻找后,我发现了tuxedo-control-center ,在Archlinux,你可以直接yay -S tuxedo-control-center-bin,它和蓝天在Windows上提供的Control Center一样可以完美控制你的风扇,至此,解决了我的风扇问题。

你可以通过sudo od -Ax -t x1 /sys/kernel/debug/ec/ec0/io来读取嵌入式控制器(EC)的寄存器内容,如下图:
这里面存在和温度有关的数据,你可以根据此对clevo-indicator的代码进行修改,以便能正确控制风扇。

以下记录一些在控制风扇过程中可能对你有帮助的资料:
https://tieba.baidu.com/p/8762954668?pid=149182033061&cid=#149182033061
https://tieba.baidu.com/p/5971634018?see_lz=1
https://www.cnblogs.com/javawebsoa/archive/2013/05/31/3111351.html
https://github.com/LiZhenhuan1019/clevo_fan_control
https://github.com/zuyan9/RLECViewer
https://github.com/elight2/ClevoFanControl
https://github.com/agramian/clevo-fan-control
https://notebooktalk.net/topic/2209-obsidian-pc-fan-control/
https://github.com/foucault/nvfancontrol

  • Title: FanControl
  • Author: starlitxiling
  • Created at : 2024-07-29 02:19:32
  • Updated at : 2024-09-14 22:05:39
  • Link: http://starlitxiling.github.io/2024/07/29/FanControl/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
FanControl