Fix invalid hwmon directory path

This commit is contained in:
Adrian Woźniak 2021-11-28 14:46:54 +01:00
parent 0c9305359a
commit 0411594e96
No known key found for this signature in database
GPG Key ID: 0012845A89C7352B
9 changed files with 71 additions and 14 deletions

6
Cargo.lock generated
View File

@ -13,7 +13,7 @@ dependencies = [
[[package]] [[package]]
name = "amdfand" name = "amdfand"
version = "1.0.6" version = "1.0.7"
dependencies = [ dependencies = [
"amdgpu", "amdgpu",
"gumdrop", "gumdrop",
@ -26,7 +26,7 @@ dependencies = [
[[package]] [[package]]
name = "amdgpu" name = "amdgpu"
version = "1.0.6" version = "1.0.7"
dependencies = [ dependencies = [
"gumdrop", "gumdrop",
"log", "log",
@ -38,7 +38,7 @@ dependencies = [
[[package]] [[package]]
name = "amdvold" name = "amdvold"
version = "1.0.6" version = "1.0.7"
dependencies = [ dependencies = [
"amdgpu", "amdgpu",
"gumdrop", "gumdrop",

View File

@ -66,9 +66,17 @@ temp = 80.0
speed = 100.0 speed = 100.0
``` ```
## Roadmap
* [ ] Write metrics
* [ ] Add support for multiple cards
* Multiple services must recognize card even if there's multiple same version cards is installed
* Support should be by using `--config` option
* [ ] CLI for fan config edit
* [ ] CLI for voltage edit
* [ ] GUI application using native Rust framework (ex. egui, druid)
## :bookmark: License ## :bookmark: License
This work is dual-licensed under Apache 2.0 and MIT. This work is dual-licensed under Apache 2.0 and MIT.
You can choose between one of them if you use this work. You can choose between one of them if you use this work.
`SPDX-License-Identifier: Apache-2.0 OR MIT`

View File

@ -1,6 +1,6 @@
[package] [package]
name = "amdfand" name = "amdfand"
version = "1.0.6" version = "1.0.7"
edition = "2018" edition = "2018"
description = "AMDGPU fan control service" description = "AMDGPU fan control service"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -9,7 +9,7 @@ categories = ["hardware-support"]
repository = "https://github.com/Eraden/amdgpud" repository = "https://github.com/Eraden/amdgpud"
[dependencies] [dependencies]
amdgpu = { path = "../amdgpu", version = "1.0.6" } amdgpu = { path = "../amdgpu", version = "1.0.7" }
serde = { version = "1.0.126", features = ["derive"] } serde = { version = "1.0.126", features = ["derive"] }
toml = { version = "0.5.8" } toml = { version = "0.5.8" }

View File

@ -86,6 +86,7 @@ fn setup() -> Result<(String, Config)> {
.config .config
.unwrap_or_else(|| DEFAULT_CONFIG_PATH.to_string()); .unwrap_or_else(|| DEFAULT_CONFIG_PATH.to_string());
let config = load_config(&config_path)?; let config = load_config(&config_path)?;
log::info!("{:?}", config);
log::set_max_level(config.log_level().as_str().parse().unwrap()); log::set_max_level(config.log_level().as_str().parse().unwrap());
Ok((config_path, config)) Ok((config_path, config))
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "amdgpu" name = "amdgpu"
version = "1.0.6" version = "1.0.7"
edition = "2018" edition = "2018"
description = "Subcomponent of AMDGPU fan control service" description = "Subcomponent of AMDGPU fan control service"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"

View File

@ -59,7 +59,7 @@ impl HwMon {
} }
pub fn mon_dir(&self) -> std::path::PathBuf { pub fn mon_dir(&self) -> std::path::PathBuf {
self.device_dir().join(&*self.name) self.device_dir().join("hwmon").join(&*self.name)
} }
#[inline] #[inline]

View File

@ -22,8 +22,22 @@ pub fn read_cards() -> std::io::Result<Vec<Card>> {
pub fn hw_mons(filter: bool) -> std::io::Result<Vec<HwMon>> { pub fn hw_mons(filter: bool) -> std::io::Result<Vec<HwMon>> {
Ok(read_cards()? Ok(read_cards()?
.into_iter() .into_iter()
.filter_map(|card| hw_mon::open_hw_mon(card).ok()) .map(|card| {
.filter(|hw_mon| !filter || { hw_mon.is_amd() }) log::info!("opening hw mon for {:?}", card);
.filter(|hw_mon| !filter || hw_mon.name_is_amd()) hw_mon::open_hw_mon(card)
})
.flatten()
.filter(|hw_mon| {
!filter || {
log::info!("is vendor ok? {}", hw_mon.is_amd());
hw_mon.is_amd()
}
})
.filter(|hw_mon| {
!filter || {
log::info!("is hwmon name ok? {}", hw_mon.name_is_amd());
hw_mon.name_is_amd()
}
})
.collect()) .collect())
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "amdvold" name = "amdvold"
version = "1.0.6" version = "1.0.7"
edition = "2018" edition = "2018"
description = "AMDGPU fan control service" description = "AMDGPU fan control service"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@ -9,7 +9,7 @@ categories = ["hardware-support"]
repository = "https://github.com/Eraden/amdgpud" repository = "https://github.com/Eraden/amdgpud"
[dependencies] [dependencies]
amdgpu = { path = "../amdgpu", version = "1.0.6" } amdgpu = { path = "../amdgpu", version = "1.0.7" }
serde = { version = "1.0.126", features = ["derive"] } serde = { version = "1.0.126", features = ["derive"] }
toml = { version = "0.5.8" } toml = { version = "0.5.8" }

View File

@ -0,0 +1,34 @@
log_level = "Info"
temp_input = "temp1_input"
[[speed_matrix]]
temp = 4.0
speed = 4.0
[[speed_matrix]]
temp = 30.0
speed = 33.0
[[speed_matrix]]
temp = 45.0
speed = 50.0
[[speed_matrix]]
temp = 60.0
speed = 66.0
[[speed_matrix]]
temp = 65.0
speed = 69.0
[[speed_matrix]]
temp = 70.0
speed = 75.0
[[speed_matrix]]
temp = 75.0
speed = 89.0
[[speed_matrix]]
temp = 80.0
speed = 100.0