Crates.io | libmedium |
lib.rs | libmedium |
version | 0.12.0 |
source | src |
created_at | 2019-11-24 20:07:42.178312 |
updated_at | 2024-11-15 02:07:11.577228 |
description | Library to interface with lm_sensors |
homepage | |
repository | https://gitlab.com/Maldela/libmedium |
max_upload_size | |
id | 184045 |
size | 277,566 |
A safe rust library to communicate with the sysfs interface of lm-sensors.
Just add this to your Cargo.toml
file:
[dependencies]
libmedium = "0.12"
writeable
: Standard feature that enables all functions that write to sysfs. This includes setting pwm values and disabling sensors.sync
: Build synchronous versions of all sensors.virtual_sensors
: Feature that lets you create virtual sensors. Virtual sensors don't belong to sysfs but can be any file provided by a driver or the user.uom_units
: Sensor values are returned as types from the uom
crate.unrestricted_parsing
: This feature allows parsing of paths other than '/sys/class/hwmon'. This should only be useful for testing and debugging.async
: Build asynchronous versions of all sensors.use libmedium::{
parse_hwmons,
sensors::sync_sensors::{temp::TempSensor, SyncSensor},
};
let hwmons = parse_hwmons().unwrap();
for 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);
}
}
writeable
feature to not be disabled):use libmedium::{
parse_hwmons,
sensors::sync_sensors::pwm::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::FULLSPEED).unwrap();
}
}
This project is licensed under the MIT License - see the LICENSE file for details