项目作者: hbriese

项目描述 :
A Linux fan control daemon
高级语言: C++
项目地址: git://github.com/hbriese/fancon.git
创建时间: 2017-02-12T04:03:41Z
项目社区:https://github.com/hbriese/fancon

开源协议:Apache License 2.0

下载


fancon

License

A Linux user-space fan control daemon

  • System, DELL and NVIDIA GPU fan control support
  • %, RPM or PWM custom speed-temperature curve configuration

Contents

Installation

Ubuntu, Debian (PPA)
  1. sudo add-apt-repository ppa:hbriese/fancon; sudo apt-get update
  2. sudo apt install fancon
.deb (alternative)
  1. wget https://github.com/hbriese/fancon/releases/latest/download/fancon_amd64.deb
  2. sudo dpkg -i ./fancon*.deb; sudo apt install -f
Fedora, Red Hat, CentOS (.rpm)
  1. wget https://github.com/hbriese/fancon/releases/latest/download/fancon.x86_64.rpm
  2. sudo yum nogpgcheck install ./fancon*.rpm
Arch Linux (AUR)
  1. git clone https://aur.archlinux.org/fancon.git; cd fancon
  2. makepkg -sirc

Configuration

/etc/fancon.conf is automatically created on first run once the tests complete

Only ‘sensor’ & ‘temp_to_rpm’ for each fan is required to be manually
configured

  1. config {
  2. update_interval:
  3. 1000 #Milliseconds between updating fan speeds dynamic
  4. : true #Interpolate speeds between temps e.g(30 : 800, 50 : 1200)
  5. results in 1000
  6. @40 smoothing_intervals : 3 #Intervals over which to smooth RPM changes
  7. top_stickiness_intervals : 2 #Intervals to wait before decreasing
  8. RPM temp_averaging_intervals : 3 #Intervals to average
  9. temperatures over -
  10. eliminating temp spikes
  11. }
  12. devices {
  13. fan {
  14. type:
  15. SYS #One of : SYS(default), DELL, NVIDIA;
  16. may excluded if SYS label : "hwmon3/fan1" #Name of device -
  17. anything you want sensor
  18. : "CPU Package" #Sensor to read -
  19. specify by label temp_to_rpm : "39: 0%, 40: 1%, 75: 50%, 90: 100%"
  20. #temp(optional : f | F; default °C) : RPM(optional : % | PWM; default RPM)
  21. # 40 : 0 % Stopped at or below 40°C(°C is used if F is omitted)
  22. # 50 : 1 % Lowest running speed at 50°C
  23. # 75 : 50 % 50 % of max RPM at 75°C, \
  24. could also be written as 75 : 180PWM in this case
  25. # 194f : 100 % Full speed at 194°F(194f = 90°C)
  26. rpm_to_pwm
  27. : "0: 0, 3206: 128, 4954: 180, 7281: 255" #Mappings of RPM to PWM
  28. start_pwm : 128 #PWM at which the fan starts
  29. #interval : 500 #Fan - specific update time; increasing improves test accuracy
  30. ignore
  31. : false #Don't control or test device; may be excluded if false
  32. #Following only applicable to SYS &DELL devices
  33. driver_flag : 2 #Driver flag to enable manual control pwm_path
  34. : "/sys/class/hwmon/hwmon3/pwm1" #Path to read /
  35. write PWM rpm_path
  36. : "/sys/class/hwmon/hwmon3/fan1_input" #Path to read RPM
  37. #Following only applicable to SYS devices
  38. enable_path
  39. : "/sys/class/hwmon/hwmon3/pwm1_enable" #Path to enable PWM control
  40. }
  41. fan{
  42. type : NVIDIA label : "980_Ti" sensor : "980_Ti_temp"
  43. temp_to_rpm : "54: 0%, 55: 1%, 90: 100%" rpm_to_pwm : "850: 0, 3832: 255"
  44. start_pwm : 128 interval : 500 id : 0 #Only applicable to NVIDIA devices
  45. } sensor {
  46. type:
  47. SYS #One of : SYS(default), NVIDIA;
  48. may excluded if SYS label : "CPU Package" #Name of device -
  49. anything you want input_path
  50. : "/sys/class/hwmon/hwmon5/temp1_input" #Path to
  51. read(only applicable to SYS devices)
  52. }
  53. sensor {
  54. type:
  55. NVIDIA
  56. label:
  57. "980_Ti_temp" id : 0 #Only applicable to NVIDIA devices
  58. }
  59. }

Usage

  1. fancon arg [value] ...
  2. h help Show this help
  3. s status Status of all fans
  4. e enable Enable control of all fans
  5. e enable [fan] Enable control of the fan
  6. d disable Disable control of all fans
  7. d disable [fan] Disable control of the fans
  8. t test Test all (untested) fans
  9. t test [fan] Test the fan (forced)
  10. f force Test even already tested fans (default: false)
  11. m monitor Monitor all fans
  12. m monitor [fan] Monitor the fan
  13. r reload Reload config
  14. c config [file] Config path (default: /etc/fancon.conf)
  15. service Start as service
  16. daemon Daemonize the process (default: false)
  17. stop-service Stop the service
  18. i sysinfo [file] Save system info to file (default: sysinfo.txt)
  19. recover Recover control of enabled devices
  20. nv-init Init nvidia devices
  21. v verbose Debug logging level
  22. a trace Trace logging level

Managing service

Status

sudo systemctl status fancon

Start

sudo systemctl start fancon

Without systemd

sudo fancon service

Debugging issues

Monitoring fans and their status

fancon monitor

Logs

journalctl -u fancon

Logging levels

fancon verbose

fancon trace

Undetected fans

First try detecting devices using lm-sensors

  1. sudo sensors-detect
  • You may need to reboot if unloaded kernel modules were added

Check to see if your device is detected

  1. sensors

Mis-configured or unsupported devices

Devices (fans & sensors) that:

  • Expose a sysfs like interface but are not found by lm-sensors
  • Are reported as not having the required features but they do

May be configurable by altering their configuration

$XAUTHORITY and or $DISPLAY env variable(s) not set

X11 access is required for NVIDIA control

You will need to configure the unset environmental variable.

Manually configure the unset environmental variable(s)

Inside /etc/profile

  • export XAUTHORITY=...; You can find the XAuthority file by running xauth info
  • xhost si:localuser:root; May be necessary on Wayland

https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root

Building from source:

With NVIDIA support:

  1. sudo apt install clang cmake lm-sensors libsensors5 libsensors4-dev libboost-system-dev libboost-filesystem-dev libboost-log-dev libpthread-stubs0-dev libpstreams-dev libprotobuf-dev protobuf-compiler libgrpc++-dev protobuf-compiler protobuf-compiler-grpc libxnvctrl-dev libx11-dev
  2. git clone https://github.com/hbriese/fancon.git && cd fancon; mkdir build; cd build
  3. cmake -DNVIDIA_SUPPORT=ON .. && make -j && sudo make install

Without NVIDIA support:

  1. sudo apt install clang cmake lm-sensors libsensors5 libsensors4-dev libboost-system-dev libboost-filesystem-dev libboost-log-dev libpthread-stubs0-dev libpstreams-dev libprotobuf-dev protobuf-compiler libgrpc++-dev protobuf-compiler protobuf-compiler-grpc
  2. git clone https://github.com/hbriese/fancon.git && cd fancon; mkdir build; cd build
  3. cmake -DNVIDIA_SUPPORT=OFF .. && make -j && sudo make install
CMake Option Default Description
NVIDIA_SUPPORT ON Support for NVIDIA GPUs
PROFILE OFF Support for Google Perf Tools CPU & heap profilers
LINT OFF Run Clang-Tidy