Skip to content

IvanSafonov/fanctl

Repository files navigation

⚠️ Warning ⚠️

You use it at your own risk. Overheating can destroy your hardware.

💡 About

That's a small service to control fan speed. It reads temperature sensors and current power profile and maps them to fan level. Mapping is set by the configuration file. There is no user interface, and there is no plan to make one.

Main features:

  • Multiple fans and sensors.
  • Power profile support.
  • Delay before changing fan speed.

Originally created for Thinkpad T14 gen 4 (Intel). There is thinkfan, but it does not support power profiles.

There are other fan speed control tools.

Adding new drivers and other improvements are welcome.

⚙️ Supported drivers

For now it support only thinkpads, but it's not that hard to add new drivers.

💻 Thinkpad ACPI Fan

❗Fan control is disabled by default. You need to enable it.

echo "options thinkpad_acpi fan_control=1" | sudo tee -a /usr/lib/modprobe.d/thinkpad_acpi.conf
sudo modprobe thinkpad_acpi

Links

🌡️ Hwmon sensors

It should work on every device, but you need to find sensor name and label.

tail -n 1 $(ls /sys/class/hwmon/hwmon*/{name,temp*_label,temp*_input} | sort)

Links

🚀 Profile platform

There is a file /sys/firmware/acpi/platform_profile that contains current power profile. In KDE and GNOME you can control current profile from the user interface.

# To see available profiles
cat /sys/firmware/acpi/platform_profile_choices

Links

🧪 Configuration

There is conf/fanctl.yaml file with all available parameters and some explanation. You can use it to create your own config.

conf/thinkpad.yaml is an example I tested on T14.

Binary file has -d flag which enables debug logs. And -c flag to pass the config file path.

sudo fanctl -d -c ./conf/fanctl.yaml

📦 Install

Manual

Install latest version of go

cd ./fanctl
go build -o fanctl ./cmd/fanctl
sudo cp ./fanctl /usr/sbin/fanctl
sudo cp ./systemd/* /lib/systemd/system/
sudo cp ./conf/fanctl.yaml /etc/
# Change /etc/fanctl.yaml according to your hardware
sudo systemctl enable fanctl.service fanctl-wakeup.service
sudo systemctl start fanctl
# Check service status
sudo systemctl status fanctl

Deb package

Download deb package here and install.

sudo apt install ./fanctl*.deb
# Change /etc/fanctl.yaml according to your hardware
sudo systemctl enable fanctl.service fanctl-wakeup.service
sudo systemctl start fanctl
# Check service status
sudo systemctl status fanctl