Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ivansafonov/fanctl
Service to control fan speed on linux
https://github.com/ivansafonov/fanctl
cpu fan fan-control hwmon temperature thinkpad
Last synced: about 1 month ago
JSON representation
Service to control fan speed on linux
- Host: GitHub
- URL: https://github.com/ivansafonov/fanctl
- Owner: IvanSafonov
- License: mit
- Created: 2024-01-06T15:11:04.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-09-28T04:29:28.000Z (3 months ago)
- Last Synced: 2024-10-03T06:54:54.786Z (3 months ago)
- Topics: cpu, fan, fan-control, hwmon, temperature, thinkpad
- Language: Go
- Homepage:
- Size: 57.6 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# β οΈ 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.
* Change fan level before sleep/suspend.Originally created for Thinkpad T14 gen 4 (Intel). There is [thinkfan](https://github.com/vmatare/thinkfan), but it does not support power profiles.
There are other fan [speed control tools](https://wiki.archlinux.org/title/fan_speed_control).
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.
```bash
echo "options thinkpad_acpi fan_control=1" | sudo tee -a /usr/lib/modprobe.d/thinkpad_acpi.conf
sudo modprobe thinkpad_acpi
```#### Links
* [Arch wiki](https://wiki.archlinux.org/title/fan_speed_control#ThinkPad_laptops)
* [Thinkpad acpi documentation](https://www.kernel.org/doc/Documentation/laptops/thinkpad-acpi.txt)## π‘οΈ Hwmon sensors
It should work on every device, but you need to find sensor name and label.
```bash
tail -n 1 $(ls /sys/class/hwmon/hwmon*/{name,temp*_label,temp*_input} | sort)
```#### Links
* [Hwmon kernel documentation](https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface)
## π 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.
```bash
# To see available profiles
cat /sys/firmware/acpi/platform_profile_choices
```#### Links
* [Kernel commit](https://patchwork.kernel.org/project/linux-acpi/patch/[email protected]/)
# π§ͺ Configuration
There is [conf/fanctl.yaml](conf/fanctl.yaml) file with all available parameters and some explanation. You can use it to create your own config.
[conf/thinkpad.yaml](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.
```bash
sudo fanctl -d -c ./conf/fanctl.yaml
```# π¦ Install
## Manual
Install [latest version of go](https://go.dev/doc/install)
```bash
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 fanctl-suspend.service
sudo systemctl start fanctl
# Check service status
sudo systemctl status fanctl
```## Deb package
Download deb package [here](https://github.com/IvanSafonov/fanctl/releases) and install.
```bash
sudo apt install ./fanctl*.deb
# Change /etc/fanctl.yaml according to your hardware
sudo systemctl enable fanctl.service fanctl-wakeup.service fanctl-suspend.service
sudo systemctl start fanctl
# Check service status
sudo systemctl status fanctl
```