mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Fix the handling of of the kernel change from "quiet" to "low-power"
A coming kernel change will convert "quiet" to "low-power" due to how platform_profile can now have multiple registered handlers. (kernel 6.14 est) Fixes #609
This commit is contained in:
@@ -15,6 +15,7 @@ use std::path::Path;
|
||||
|
||||
use error::{PlatformError, Result};
|
||||
use log::warn;
|
||||
use platform::PlatformProfile;
|
||||
use udev::Device;
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
@@ -107,6 +108,18 @@ pub fn write_attr_string(device: &mut Device, attr: &str, value: &str) -> Result
|
||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
||||
}
|
||||
|
||||
pub fn read_attr_string_array(device: &Device, attr_name: &str) -> Result<Vec<PlatformProfile>> {
|
||||
if let Some(value) = device.attribute_value(attr_name) {
|
||||
let tmp: Vec<PlatformProfile> = value
|
||||
.to_string_lossy()
|
||||
.split(' ')
|
||||
.map(PlatformProfile::from)
|
||||
.collect();
|
||||
return Ok(tmp);
|
||||
}
|
||||
Err(PlatformError::AttrNotFound(attr_name.to_owned()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user