Crates.io | meh-asus |
lib.rs | meh-asus |
version | 0.1.0 |
source | src |
created_at | 2024-11-09 09:21:57.04973 |
updated_at | 2024-11-09 09:21:57.04973 |
description | Abstraction over ASUS hardware configurations to control it programatically on Linux. |
homepage | |
repository | |
max_upload_size | |
id | 1441948 |
size | 48,791 |
Abstraction over ASUS hardware configurations to control it programatically on Linux.
This can utilize any hardware's DEV_ID, to read and modify its configuration as defined by the user.
You can find the DEV_ID of the hardware you're interested in ASUS WMI source code.
Some of the hardware dev id and their states are defined by default, serving as an example as well as direct abstraction over them.
[!NOTE] Users can refer to them to use it themselves, or to create abstraction over some other hardware component of their choice. Also look at examples.
With sudo: sudo cargo r -r --example toggle_fan_mode
.
This is how toggle_fan_mode
can be setup, camera_modprobe
and other porgrams can be used in a similar fashion.
Compile using cargo cargo b -r --example toggle_fan_mode
Give root level execution permission
sudo chown root:root ./target/release/examples/toggle_fan_mode
sudo chmod 4005 ./target/release/examples/toggle_fan_mode
[!TIP] One would also like to enable notification for the changes. For notifications, make sure
libnotify
andxargs
is installed on your system, and use the following command/PATH/TO/BINARY/debugfs_fan_mode 2>&1 | xargs -I {} notify-send -a "meh-asus" "Fan Mode Switch" "{}"
This is example command using fan_mode toggle (with debugfs).
[!IMPORTANT] Use single thread, since all the configurations are essentially using file modification techniques, hence parallel execution might fail.
Your laptop may not support some of the tests execution, this way you get to know about what crate in-built hardware features you can use.
sudo cargo test --no-fail-fast -- --test-threads=1
Windows doesn't allow you to switch to fan modes such as FullSpeed
when you are not connected to AC power. This module doesn't impose any such restriction, although the configuration may be rejected by the hardware itself (passing an error message), but you should still be careful yourself to handle such scenerio, else you may end up harming you laptop's battery life.
There are more fan configuration and files which can be used to handle the fan, but I didn't need them.
Not all asus laptops are supported. I mean they are, if you create mapping yourself, the majority of code remains same, only file names and the byte mapping to fan mode changes. My laptop only had the pwm1_enable
and pwm2_enable
(cpu and gpu fans), so I didn't program for other possible fans (only pwm{id}_enable
in general).
Refer https://wiki.archlinux.org/title/Fan_speed_control#ASUS_laptops
I would advise to use the debugfs abstraction over this, this is more of "manual" configuration.