The minimalist fan control program
Branch: master
Clone or download
vmatare TpSensorDriver: fix read_temps() on linux-4.19
Seems that /proc/acpi/ibm/thermal suddenly has a newline at the end, so
f.eof() isn't true when we stop being able to read numbers from it, so
we ran into an infinite loop there.
Latest commit 594db25 Feb 21, 2019


thinkfan version 1.0 beta -- copyleft 2015, Victor Mataré

thinkfan is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
thinkfan is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with thinkfan.  If not, see <>.

Thinkfan is a simple, lightweight fan control program. Originally designed
specifically for IBM/Lenovo Thinkpads, it now supports any kind of system via
the sysfs hwmon interface (/sys/class/hwmon). It is designed to eat as little
CPU power as possible.


There's only very basic sanity checking on the configuration (semantic
plausibility). You can set the temperature limits as insane as you like.

Any change to fan behaviour that results in higher temperatures in some parts
of the system will shorten your system's lifetime and/or cause weird hardware
bugs that'll make you pull out your hair.

   No warranties whatsoever.

If this program steals your car, kills your horse, smokes your dope or pees
on your carpet...
 - too bad, you're on your own.

Building and installing

To compile thinkfan, you will need to have the following things installed:
- A recent C++ compiler (GCC >= 4.8 or clang)
- pkgconfig or an equivalent (pkgconf or pkg-config)
- cmake (and optionally a cmake GUI if you want to configure interactively)
- optional: libyaml-cpp for YAML support (the -dev or -devel package)

1. In the thinkfan main directory, do
    mkdir build && cd build

2. Then configure your build, either interactively:
    ccmake ..

   Or set your build options from the command line. E.g. to configure a build
   with full debugging support:
    cmake -D CMAKE_BUILD_TYPE:STRING=Debug ..

   CMAKE_BUILD_TYPE:STRING can also be "Release", which produces a fully
   optimized binary, or "RelWithDebInfo", which is also optimized but can
   still be debugged with gdb.
   Other options are:

   USE_NVML:BOOL (default: ON)
       Allows thinkfan to read GPU temperatures from the proprietary nVidia
       driver. The interface library is loaded dynamically, so it does not
       need to be installed when compiling.

       Enable libatasmart to read temperatures directly from hard disks. Use
       this only when you really need it, since libatasmart is unreasonably

   USE_YAML:BOOL (default: ON)
       Support config file in the new, more flexible YAML format. The old
       config format will be deprecated after the thinkfan 1.0 release. New
       features will be supported in YAML configs only. See
       examples/thinkfan.conf.yaml.  Requires libyaml-cpp.

3. To compile simply run:

4. If you did not change CMAKE_INSTALL_PREFIX, thinkfan will be installed
   under /usr/local by doing:
    sudo make install

   CMake will detect whether you use OpenRC or systemd and install some
   appropriate service files. With systemd, you can edit the commandline
   arguments of the thinkfan service with `systemctl edit thinkfan`.
   With OpenRC, we install only a plain initscript (edit /etc/init.d/thinkfan
   to change options).


Run thinkfan -h
Manpages: thinkfan(1), thinkfan.conf(5)
Example configs in examples/ subfolder
If all fails: