feature: rework PPT tuning handling more

1. Per profile, per-ac/dc
2. Do not apply unless group is enabled
3. Better reset/disable handling
4. Selecting a profile defaults PPT to off/disabled
This commit is contained in:
Luke D. Jones
2025-01-20 22:03:39 +13:00
parent 25823dc6b7
commit 911ff8690e
14 changed files with 351 additions and 122 deletions

View File

@@ -2,6 +2,7 @@ use std::fs::{read_dir, File, OpenOptions};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use log::debug;
use serde::{Deserialize, Serialize};
use zbus::zvariant::{OwnedValue, Type, Value};
@@ -75,6 +76,15 @@ impl Attribute {
}
}
pub fn base_path_exists(&self) -> bool {
let exists = self.base_path.exists();
debug!(
"Attribute path {:?} exits? {exists}",
self.base_path.as_os_str()
);
exists
}
/// Write the `current_value` directly to the attribute path
pub fn set_current_value(&self, new_value: &AttrValue) -> Result<(), PlatformError> {
let path = self.base_path.join("current_value");