mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Check inotify paths are valid. Add dgu/egpu/ac_online checks
This commit is contained in:
@@ -45,7 +45,7 @@ pub fn read_attr_bool(device: &Device, attr_name: &str) -> Result<bool> {
|
||||
pub fn write_attr_bool(device: &mut Device, attr: &str, value: bool) -> Result<()> {
|
||||
device
|
||||
.set_attribute_value(attr, &(value as u8).to_string())
|
||||
.map_err(|e| PlatformError::Io(attr.into(), e))
|
||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
||||
}
|
||||
|
||||
pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
||||
@@ -59,7 +59,7 @@ pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
||||
pub fn write_attr_u8(device: &mut Device, attr: &str, value: u8) -> Result<()> {
|
||||
device
|
||||
.set_attribute_value(attr, &(value).to_string())
|
||||
.map_err(|e| PlatformError::Io(attr.into(), e))
|
||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
||||
}
|
||||
|
||||
pub fn read_attr_u8_array(device: &Device, attr_name: &str) -> Result<Vec<u8>> {
|
||||
@@ -79,7 +79,7 @@ pub fn write_attr_u8_array(device: &mut Device, attr: &str, values: &[u8]) -> Re
|
||||
let tmp = tmp.trim();
|
||||
device
|
||||
.set_attribute_value(attr, &tmp)
|
||||
.map_err(|e| PlatformError::Io(attr.into(), e))
|
||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user