mirror of
https://gitlab.steamos.cloud/holo/steamos-manager.git
synced 2025-07-12 09:22:26 -04:00
power: Return 0 if no GPU clock can be found
This commit is contained in:
parent
96ebb6d75c
commit
fc77feef2a
1 changed files with 10 additions and 2 deletions
12
src/power.rs
12
src/power.rs
|
@ -145,7 +145,7 @@ pub async fn get_gpu_clocks() -> Result<u32> {
|
||||||
|
|
||||||
return Ok(mhz.parse()?);
|
return Ok(mhz.parse()?);
|
||||||
}
|
}
|
||||||
Err(anyhow!("Couldn't find GPU clocks"))
|
Ok(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn find_hwmon() -> Result<PathBuf> {
|
async fn find_hwmon() -> Result<PathBuf> {
|
||||||
|
@ -399,9 +399,17 @@ CCLK_RANGE in Core0:
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_get_gpu_clocks() {
|
async fn test_get_gpu_clocks() {
|
||||||
let _h = testing::start();
|
let _h = testing::start();
|
||||||
setup().await;
|
|
||||||
|
|
||||||
assert!(get_gpu_clocks().await.is_err());
|
assert!(get_gpu_clocks().await.is_err());
|
||||||
|
setup().await;
|
||||||
|
|
||||||
|
let filename = path(GPU_CLOCKS_PATH);
|
||||||
|
create_dir_all(filename.parent().unwrap())
|
||||||
|
.await
|
||||||
|
.expect("create_dir_all");
|
||||||
|
write(filename.as_path(), b"").await.expect("write");
|
||||||
|
|
||||||
|
assert_eq!(get_gpu_clocks().await.unwrap(), 0);
|
||||||
write_clocks(1600).await;
|
write_clocks(1600).await;
|
||||||
|
|
||||||
assert_eq!(get_gpu_clocks().await.unwrap(), 1600);
|
assert_eq!(get_gpu_clocks().await.unwrap(), 1600);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue