{"id":22139958,"url":"https://github.com/daringer/asus-fan","last_synced_at":"2025-04-05T09:06:03.736Z","repository":{"id":21800519,"uuid":"25123074","full_name":"daringer/asus-fan","owner":"daringer","description":"Kernel module to get/set (both) fan speed(s) on ASUS Zenbooks","archived":false,"fork":false,"pushed_at":"2025-03-03T12:09:31.000Z","size":201,"stargazers_count":96,"open_issues_count":13,"forks_count":28,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-29T08:05:35.560Z","etag":null,"topics":["acpi","arch-linux","archlinux","asus","asus-fan","c","dkms","fan","fan-control","fan-speed","fancontrol-script","hwmon","kernel","linux","temperature","thermald","ubuntu","zenbook"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daringer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-12T15:17:26.000Z","updated_at":"2025-03-03T12:09:35.000Z","dependencies_parsed_at":"2025-01-13T16:10:58.983Z","dependency_job_id":"f4d17730-b1d1-4c4c-8ee1-23ae1b85962e","html_url":"https://github.com/daringer/asus-fan","commit_stats":{"total_commits":173,"total_committers":15,"mean_commits":"11.533333333333333","dds":0.5028901734104047,"last_synced_commit":"955389110c59c72db9673df429dc296a246d4880"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daringer%2Fasus-fan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daringer%2Fasus-fan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daringer%2Fasus-fan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daringer%2Fasus-fan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daringer","download_url":"https://codeload.github.com/daringer/asus-fan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acpi","arch-linux","archlinux","asus","asus-fan","c","dkms","fan","fan-control","fan-speed","fancontrol-script","hwmon","kernel","linux","temperature","thermald","ubuntu","zenbook"],"created_at":"2024-12-01T20:20:55.068Z","updated_at":"2025-04-05T09:06:03.688Z","avatar_url":"https://github.com/daringer.png","language":"C","funding_links":["https://www.buymeacoffee.com/daringer"],"categories":[],"sub_categories":[],"readme":"# **asus-fan**\n\nASUS (Zenbook) fan(s) control and monitor kernel module. \n\n**This project is deprecated, I neither own a relevant device anymore nor I see actual use for this module anymore.**\n\n\n\u003ca href=\"https://www.buymeacoffee.com/daringer\" target=\"_blank\"\u003e \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/lato-green.png\" alt=\"Buy Me A Coffee Or Beer\" height=22\u003e\u003c/a\u003e\n\n- [Compatibilty](#compatibilty)\n- [Installation with DKMS](#installation-with-dkms)\n  - [ArchLinux](#archlinux)\n  - [Ubuntu](#ubuntu)\n- [Quickstart](#quickstart)\n- [Short Comparison To Other Similar Projects](#short-comparison-to-other-similar-projects)\n- [Tools/Configs/Misc](#tools--configs--simple-fancontrol-script)\n  - [fancontrol script](#fancontrol-script)\n  - [build module in debug-mode](#debug-module)\n  - [force loading of module](#force-load)\n- [ToDos](#todos)\n- [ThanksTo](#thanks-to)\n\n## Compatibilty\nThe following Notebooks should be supported - be aware that it's still not in production state\n\nSingle Fan | Two Fans (NVIDIA)  | Limited or no support\n-----------|--------------------|--------------------------\nUX21E      | UX32VD             | UX3300UAR\nUX31E      | UX42VS             | UX3410UA\nUX21A      | UX52VS             | Zenbook 3U\nUX31A      | U500VZ             |\nUX32A      | NX500              | \nUX301LA    | UX32LN             |\nUX302LA    | UX303LB            |\nN551JK     | N552VX             |\nN56JN      | N550JV             |\nUX303UB    |                    |\n\n## Installation with DKMS\nDynamic 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](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support)\n\nInstalling 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.\n\nMore information on DKMS: [Ubuntu Help - DKMS](https://help.ubuntu.com/community/DKMS)\n\n### Ubuntu\n#### Scripted Ubuntu DKMS Setup for Asus Fan Module\n\n* Download the `ubuntu_dkms_sudo_install.sh` script from the `misc` folder of this repository. (ie. right-click over **Raw** \u003e select **Save link as...**)\n* Make sure the script is executable (ie. `chmod +x ubuntu_dkms_sudo_install.sh`)\n* Run the script (ie. `./ubuntu_dkms_sudo_install.sh`)\n* The script will need super user powers and will ask you to enter your password to get sudo permissions\n* Check that the module has been built and installed with `lsmod | grep asus_fan`. If you get something like **asus_fan               14880  0** you are good. If you get nothing the module is not loaded.\n\n#### \u003ca name=\"ubuntu-symlink\"\u003eUbuntu - Symlink Creation on reboot\u003c/a\u003e\n\nSymlinks 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.\n\nIf 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`.\n\n##### Symlink creation using Upstart init system\nFor Ubuntu 14.04 using the Upstart init system add the following to the Thermald upstart configuration file, `/etc/init/thermald.conf`\n\n``` bash\npre-start script\nif [ ! -d  /tmp/asus-fan-shm ]; then\n/usr/local/sbin/asus-fan-create-symlinks.sh\necho \" * creating symlinks ...\"\nfi\nend script\n```\n\nMy full `/etc/init/thermald.conf` looks like this:\n\n``` bash\n# thermald - thermal daemon\n# Upstart configuration file\n# Manages platform thermals\n\ndescription\t\"thermal daemon\"\n\nstart on runlevel [2345] and started dbus\nstop on stopping dbus\n\n#\n# don't respawn on error\n#\nnormal exit 1\n```\n\n##### Symlink creation using systemd init system\nFor 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.\n\n`ExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh`\n\nWith this line added on Ubuntu 18.04 `/etc/systemd/system/dbus-org.freedesktop.thermald.service` looks like this:\n\n```bash\n[Unit]\nDescription=Thermal Daemon Service\n\n[Service]\nType=dbus\nSuccessExitStatus=1\nBusName=org.freedesktop.thermald\nExecStartPre=/usr/local/sbin/asus-fan-create-symlinks.sh\nExecStart=/usr/sbin/thermald --no-daemon --dbus-enable\n\n[Install]\nWantedBy=multi-user.target\nAlias=dbus-org.freedesktop.thermald.service\n```\n\n#### Manual Ubuntu DKMS Setup for Asus Fan Module\n\n``` bash\ncd /usr/src\nsudo wget -o asus-fan-master.tar.gz  https://github.com/daringer/asus-fan/archive/master.tar.gz\nsudo mkdir asus_fan-master\ncd asus_fan-master\nsudo tar xpvf ../asus_fan.tar.gz --strip-components=1\nsudo  tar xpvf ../asus_fan.tar.gz --strip-component\nsudo  mv dkms.conf dkms.conf.archlinu\nsudo mv dkms-ubuntu.conf dkms.conf\ncd ..\nsudo dkms add -m asus_fan -v master\nsudo dkms install -m asus_fan -v master\nsudo echo asus_fan \u003e\u003e/etc/modules\nsudo cp misc/asus-fan-create-symlinks.sh /usr/local/sbin/asus-fan-create-symlinks.sh\n```\n\nFor Ubuntu 14.04 you will also need to add the lines mention above in the **[Ubuntu - Symlink Creation on reboot](#ubuntu-symlink)** 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.\n\n\n### ArchLinux\nJust get the [PKGBUILD](https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/asus-fan-dkms-git/PKGBUILD) and the [install script](https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/asus-fan-dkms-git/asus-fan-dkms-git.install) and run ``makepkg``:\n```bash\n    cd /tmp\n    mkdir asus-fan-build \n    cd asus-fan-build \n    wget wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/PKGBUILD\n    wget https://raw.githubusercontent.com/daringer/asus-fan/master/buildscripts/archlinux/asus-fan-dkms-git/asus-fan-dkms-git.install \n    makepkg\n    sudo pacman -U asus-fan-dkms-git-*.pkg.tar.xz\n```\nOr simply use the [AUR](https://aur.archlinux.org) [package](https://aur.archlinux.org/packages/asus-fan-dkms-git/) and your fav. AUR tooling...\n\n\n## Troubleshooting Symlinks\n\n\nRuning `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.\n\n\n## \u003ca name=\"quickstart\"\u003eQuickstart - Manual installation\u003c/a\u003e\n\n- **Build** - just run ```make``` inside the directory\n- **Install** - run ```sudo make install``` inside the directory\n- **Load** - simply as usual:\n```bash\nmodprobe asus_fan\n```\n- **Interface** - the fan(s) is/are exposed as ```hwmon```, thus available in:\n```bash\nfpath=\"/sys/class/hwmon/hwmonX\"\n```\n- **Monitor Fan speed** - simply use [xsensors](http://www.linuxhardware.org/xsensors/) or [psensors](http://wpitchoune.net/psensor/) for graphical, or [sensors](http://www.lm-sensors.org/) for console monitoring. My personal preference is [conky](https://github.com/brndnmtthws/conky)---there are alot [linux system monitors](https://lmgtfy.com/?q=linux+system+monitor).\n\n- **Set Fan Speed** - write anything from 0 to 255 to ```pwmX```, like:\n```bash\necho 123 \u003e ${fpath}/pwmX   # set to 123\necho 0 \u003e ${fpath}/pwmX     # switch fan off (DANGEROUS!)\necho 255 \u003e ${fpath}/pwmX   # set to max speed\n```\n- **ATTENTION** - the fan is now in manual mode - do not burn your machine!\n- **Set Auto-Fan(s)**: to reactivate the automatic fan control write \"0\" to ```pwmX_enable```:\n```bash\necho 0 \u003e ${fpath}/pwmX_enable   # reset to auto-mode (always for all fans)\n```\n\n- **Max fan speed** There is an additional file for controling the maximum fan speed. It's r/w and controls both, automatic mode and manual mode maximum speed. Value range: 0-255 reset value:256\n\n\n## Short Comparison To Other Similar Projects\n- [asus-fancontrol](https://github.com/nicolai-rostov/asus-fancontrol) userland application, acpi_call based, limited number of (offical/tested) compatible zenbook models, no (standard) interface exposed, no support for second fan\n- [zenbook](https://github.com/juyrjola/zenbook) userland appliaction, acpi_call based, only UX32VD supported, no (standard) interface exposed, no support for second fan\n- [asusfan](https://github.com/gpiemont/asusfan) kernelspace driver, model support: A8J, A8JS, N50V[cn], no (standard) interface exposed, interface based on module parameters, replaces automatic control with own realization, no support for second fan\n- [asusfan (original)](https://code.google.com/p/asusfan/) kernelspace driver, Model support A8J and A8JS, no (standard) interface, automatic fan speed adjustment, no support for second fan\n- [asusfanctrld](https://github.com/nflx/asusfanctrld) userland (bash) application, acpi_call  based, only UX32VD, second fan support?, no (standard) interface exposed\n- [asus_ux32v_fan_control](https://github.com/chrischdi/asus_ux32v_fan_control) is actually a fork of this project undergone a renaming (hmm), very old state, no hwmon (interface) support, thermal_device interface, most likely as buggy as this project was one year ago\n- [asus_wmi](https://github.com/KastB/asus_wmi) realization as a part of the exisiting `asus_wmi` module, which is maybe the only way to submit it for the upstream kernel, nevertheless support for the second fan is not available through wmi. Sister project, closely related to the one shown here.\n- [NBFC](https://github.com/hirschmann/nbfc) *NotebookFanControl* provides---despite others---support for various ASUS Zenbook models, written in C#, cross-platform, user-land only. Convinient and easy to use, but might be a little too much overhead in order to manage a hw-fan, but that's a matter of preference for sure.\n\nSo this [project](https://github.com/daringer/asus-fan) 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 ;)\n\n\n## Tools / Configs / Simple Fancontrol Script\n### fancontrol script\nThere is a script called \"fancontrol\" that can be configured according to temperature source, fans to control, minimum and maximum temperature, thats done by \"pwmconfig\"\nNevertheless that script did it worse for me than the original controller - thus you can tell it to stop the fan completely...\n\n### debug module\n`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:\n\n```bash\n  make DEBUG=1\n  sudo rmmod asus-fan\n  sudo insmod asus-fan.ko\n```\n### force load module \n**USE THIS ONLY WITH CAUTION FOR TESTING, UNFORSEEABLE THINGS MAY HAPPEN! YOU'VE BEEN WARNED...**\n`force_load=1` may be passed as an argument during module loading to skip the device checks and tests:\n\n```bash\n  sudo rmmod asus-fan\n  sudo insmod asus-fan.ko force_load=1\n```\n\n## TODOs:\n- do a code review and clean it up\n- check with more models\n- ~~submit an upstream patch - any howtos?? wtf, write acpi-devel kernel-mailinglist ??~~\n\n\n## THANKS TO:\n- To Felipe Contreras [felipec](https://github.com/felipec) for providing the initial version (https://gist.github.com/felipec/6169047)\n- To Markus Meissner [daringer](https://github.com/daringer) for the asus_fan version using the \"thermal_device\" interface\n- To Bernd Kast [KastB](https://github.com/KastB) for the port using the hwmon interface\n- To Frederick Henderson [frederickjh](https://github.com/frederickjh) for ubuntu dkms support\n- To [Tharre](https://github.com/Tharre) for the never ending stream of useful hints and information\n- Various testers and users providing valuable information and thus increasing the list of compatible devices\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaringer%2Fasus-fan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaringer%2Fasus-fan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaringer%2Fasus-fan/lists"}