daringer / asus-fan

Kernel module to get/set (both) fan speed(s) on ASUS Zenbooks
GNU General Public License v2.0
95 stars 26 forks source link
acpi arch-linux archlinux asus asus-fan c dkms fan fan-control fan-speed fancontrol-script hwmon kernel linux temperature thermald ubuntu zenbook

asus-fan

ASUS (Zenbook) fan(s) control and monitor kernel module.

Buy Me A Coffee Or Beer

Compatibilty

The following Notebooks should be supported - be aware that it's still not in production state

Single Fan Two Fans (NVIDIA) Limited or no support
UX21E UX32VD UX3300UAR
UX31E UX42VS UX3410UA
UX21A UX52VS Zenbook 3U
UX31A U500VZ
UX32A NX500
UX301LA UX32LN
UX302LA UX303LB
N551JK N552VX
N56JN     N550JV
UX303UB

Installation with DKMS

Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree. The concept is to have DKMS modules automatically rebuilt when a new kernel is installed. - Wikipedia

Installing the asus-fan kernel module with DKMS means that when you upgrade to a new kernel you do not need to repeat the process outlined below in the Quickstart section each time. The asus-fan kernel module will automatically be rebuilt when a new kernel is installed.

More information on DKMS: Ubuntu Help - DKMS

Ubuntu

Scripted Ubuntu DKMS Setup for Asus Fan Module

Ubuntu - Symlink Creation on reboot

Symlinks will need to be created each time. The asus-fan-create-symlinks.sh is designed for this purpose, however it must be run after each reboot to create these links.

If you used the ubuntu_dkms_sudo_install.sh installation script above the asus-fan-ubuntu-create-symlinks.sh will have been installed at /usr/local/sbin/asus-fan-create-symlinks.sh.

Symlink creation using Upstart init system

For Ubuntu 14.04 using the Upstart init system add the following to the Thermald upstart configuration file, /etc/init/thermald.conf

pre-start script
if [ ! -d  /tmp/asus-fan-shm ]; then
/usr/local/sbin/asus-fan-create-symlinks.sh
echo " * creating symlinks ..."
fi
end script

My full /etc/init/thermald.conf looks like this:

# thermald - thermal daemon
# Upstart configuration file
# Manages platform thermals

description "thermal daemon"

start on runlevel [2345] and started dbus
stop on stopping dbus

#
# don't respawn on error
#
normal exit 1
Symlink creation using systemd init system

For newer Ubuntu versions that use systemd init system the following line can be added to /etc/systemd/system/dbus-org.freedesktop.thermald.service in the [Service] section to create the links when thermald starts.

ExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh

With this line added on Ubuntu 18.04 /etc/systemd/system/dbus-org.freedesktop.thermald.service looks like this:

[Unit]
Description=Thermal Daemon Service

[Service]
Type=dbus
SuccessExitStatus=1
BusName=org.freedesktop.thermald
ExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh
ExecStart=/usr/sbin/thermald --no-daemon --dbus-enable

[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.thermald.service

Manual Ubuntu DKMS Setup for Asus Fan Module

cd /usr/src
sudo wget -o asus-fan-master.tar.gz  https://github.com/daringer/asus-fan/archive/master.tar.gz
sudo mkdir asus_fan-master
cd asus_fan-master
sudo tar xpvf ../asus_fan.tar.gz --strip-components=1
sudo  tar xpvf ../asus_fan.tar.gz --strip-component
sudo  mv dkms.conf dkms.conf.archlinu
sudo mv dkms-ubuntu.conf dkms.conf
cd ..
sudo dkms add -m asus_fan -v master
sudo dkms install -m asus_fan -v master
sudo echo asus_fan >>/etc/modules
sudo cp misc/asus-fan-create-symlinks.sh /usr/local/sbin/asus-fan-create-symlinks.sh

For Ubuntu 14.04 you will also need to add the lines mention above in the Ubuntu - Symlink Creation on reboot section to /etc/init/thermald.conf so that symlinks get created at each reboot by the Upstart init system. Newer versions of Ubuntu use the Systemd init system and not Upstart.

ArchLinux

Just get the PKGBUILD and the install script and run makepkg:

    cd /tmp
    mkdir asus-fan-build 
    cd asus-fan-build 
    wget wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/PKGBUILD
    wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/asus-fan-dkms-git/asus-fan-dkms-git.install 
    makepkg
    sudo pacman -U asus-fan-dkms-git-*.pkg.tar.xz

Or simply use the AUR package and your fav. AUR tooling...

Troubleshooting Symlinks

Runing ls -l /tmp/asus-fan-shm/ will list the sysmlinks created. If it looks like you are missing some (this depends on the Asus laptop you have as to how many and which ones you will have) you can run sudo asus-fan-create-symlinks.sh. This will delete the links in the folder and recreate them. A number of them are only created if they are readable.

Quickstart - Manual installation

Short Comparison To Other Similar Projects

So this project distinguishes itself from the others by providing a hwmon standard state-of-art interface with a wide variety of supported zenbook models realized as a kernelspace driver. Guess you found the right one ;)

Tools / Configs / Simple Fancontrol Script

fancontrol script

There is a script called "fancontrol" that can be configured according to temperature source, fans to control, minimum and maximum temperature, thats done by "pwmconfig" Nevertheless that script did it worse for me than the original controller - thus you can tell it to stop the fan completely...

debug module

DEBUG=1 may be passed to make to build the module in debug-mode. dmesg will then contain alot more debug output for the module:

  make DEBUG=1
  sudo rmmod asus-fan
  sudo insmod asus-fan.ko

force load module

USE THIS ONLY WITH CAUTION FOR TESTING, UNFORSEEABLE THINGS MAY HAPPEN! YOU'VE BEEN WARNED... force_load=1 may be passed as an argument during module loading to skip the device checks and tests:

  sudo rmmod asus-fan
  sudo insmod asus-fan.ko force_load=1

TODOs:

THANKS TO: