Expand description
A library that lets you use lm_sensor’s sysfs interface from rust.
Similar to libsensors this library lets you use the various sensors in your system.
#Examples
Print the temperature of all the temp sensors in your system:
use libmedium::{
parse_hwmons,
sensors::{shared_subfunctions::Input, Sensor},
};
let hwmons = parse_hwmons().unwrap();
for (hwmon_index, hwmon_name, hwmon) in &hwmons {
println!("hwmon{} with name {}:", hwmon_index, hwmon_name);
for (_, temp_sensor) in hwmon.temps() {
let temperature = temp_sensor.read_input().unwrap();
println!("\t{}: {}", temp_sensor.name(), temperature);
}
}
Set the pwm value of all your pwm capable fans to full speed:
use libmedium::{
parse_hwmons,
sensors::WriteablePwmSensor,
units::{Pwm, PwmEnable},
};
let hwmons = parse_hwmons().unwrap();
for (_, _, hwmon) in &hwmons {
for (_, pwm) in hwmon.writeable_pwms() {
pwm.write_enable(PwmEnable::ManualControl).unwrap();
pwm.write_pwm(Pwm::try_from_percent(100.0).unwrap()).unwrap();
}
}
Modules
Module containing the Hwmon struct and related functionality.
Module containing the sensors and their functionality.
Units used in this library.
Enums
Functions
Convenience function for hwmon::Hwmons::parse