Crate rog_fan_curve[][src]

Expand description

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

Example

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)?;
 

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"] }
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);

Structs

Enums

A fan, some boards may not have all fans.