rog_fan_curve 0.1.7

A library and cli for setting fan curves on some asus laptops.
Documentation

The acpi_call kernel module is needed for this crate to interacti with acpi.

Example

# use rog_fan_curve::{
#     Curve,
#     Board,
#     Fan,
#     CurveError,
# };
# fn main() -> Result<(), CurveError> {
let mut curve = Curve::new();

curve.set_point(0,  30,   0);
curve.set_point(1,  40,   1);
curve.set_point(2,  50,   4);
curve.set_point(3,  60,   4);
curve.set_point(4,  70,  13);
curve.set_point(5,  80,  40);
curve.set_point(6,  90, 100);
curve.set_point(7, 100, 100);

let board = Board::from_name("GA401IV").unwrap();

curve.apply(board, Fan::Cpu)?;
curve.apply(board, Fan::Gpu)?;

# Ok(())
# }

Fan speeds and temperatures

Temperatures are in degrees celcius.

Fan speeds are roughly a percentage fan speed. The scale is non linear and values over 100 seem to result in slightly higher fan speeds. A value of 0 will turn the fan off.

A temperature, speed pair indicates fan speed over a certain temerature, e.g. 40c:10% means the fan will run at 10% speed when the temperature is over 40C.

Config string format

Config strings follow the format

<t>c:<s>%,<t>c:<s>%,<t>c:<s>%,<t>c:<s>%,<t>c:<s>%,<t>c:<s>%,<t>c:<s>%,<t>c:<s>%

where t is temperature and s is fan speed.

Curves must have exactly 8 pairs. This format should match the one used by atrofac.

Example

30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:65%`

Serde

Curve implements Serialize and Deserialize to and from the config string format.

Example

In Cargo.toml

rog_fan_curve = { version = "*", features = ["serde"] }
# use rog_fan_curve::Curve;
# fn main() -> serde_json::Result<()> {
# #[cfg(feature = "serde")] {
let json = "\"30c:0%,40c:5%,50c:10%,60c:20%,70c:35%,80c:55%,90c:65%,100c:75%\"";

let curve: Curve = serde_json::from_str(json)?;

let new_json = serde_json::to_string(&curve)?;
assert_eq!(json, new_json);
# }
# Ok(())
# }