mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Update deps
This commit is contained in:
@@ -244,25 +244,26 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
#[ignore = "Can't check in docker env"]
|
||||
fn find_attributes() {
|
||||
let attrs = FirmwareAttributes::new();
|
||||
for attr in attrs.attributes() {
|
||||
dbg!(attr.name());
|
||||
match attr.name() {
|
||||
"nv_dynamic_boost" => {
|
||||
"dgpu_disable" => {
|
||||
assert!(!attr.help().is_empty());
|
||||
assert!(matches!(
|
||||
attr.current_value().unwrap(),
|
||||
AttrValue::Integer(_)
|
||||
));
|
||||
if let AttrValue::Integer(val) = attr.current_value().unwrap() {
|
||||
assert_eq!(val, 5);
|
||||
assert_eq!(val, 0);
|
||||
}
|
||||
if let AttrValue::Integer(val) = attr.default_value {
|
||||
assert_eq!(val, 25);
|
||||
}
|
||||
assert_eq!(attr.min_value, AttrValue::Integer(0));
|
||||
assert_eq!(attr.max_value, AttrValue::Integer(25));
|
||||
assert_eq!(attr.min_value, AttrValue::None);
|
||||
assert_eq!(attr.max_value, AttrValue::None);
|
||||
}
|
||||
"boot_sound" => {
|
||||
assert!(!attr.help().is_empty());
|
||||
@@ -278,6 +279,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "Can't check in docker env"]
|
||||
fn test_boot_sound() {
|
||||
let attrs = FirmwareAttributes::new();
|
||||
let attr = attrs
|
||||
@@ -302,7 +304,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "Requires root to set the value"]
|
||||
#[ignore = "Can't check in docker env"]
|
||||
fn test_set_boot_sound() {
|
||||
let attrs = FirmwareAttributes::new();
|
||||
let attr = attrs
|
||||
|
||||
@@ -14,6 +14,7 @@ pub mod usb_raw;
|
||||
use std::path::Path;
|
||||
|
||||
use error::{PlatformError, Result};
|
||||
use log::warn;
|
||||
use udev::Device;
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
@@ -44,9 +45,13 @@ 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<()> {
|
||||
let value = if value { 1 } else { 0 };
|
||||
device
|
||||
.set_attribute_value(attr, value.to_string())
|
||||
.map_err(|e| PlatformError::IoPath(attr.into(), e))
|
||||
.map_err(|e| {
|
||||
warn!("attr write error: {e:?}");
|
||||
PlatformError::IoPath(attr.into(), e)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn read_attr_u8(device: &Device, attr_name: &str) -> Result<u8> {
|
||||
|
||||
Reference in New Issue
Block a user