diff --git a/src/battery.rs b/src/battery.rs index f393f25..4c1f632 100644 --- a/src/battery.rs +++ b/src/battery.rs @@ -262,24 +262,3 @@ fn is_battery(path: &Path) -> Result { Ok(ps_type == "Battery") } - -/// Check if a directory is writable by attempting to open a temporary file for writing -fn is_path_writable(path: &Path) -> bool { - use std::fs::OpenOptions; - - // Try to create a temporary file to check write permissions - // If we're in a container with a read-only mount, this will fail - let temp_file_path = path.join(".superfreq_write_test"); - let result = OpenOptions::new() - .write(true) - .create(true) - .open(&temp_file_path); - - // Clean up the temporary file if we created it - if result.is_ok() { - let _ = fs::remove_file(temp_file_path); - true - } else { - false - } -} diff --git a/src/cpu.rs b/src/cpu.rs index df18e83..9f82f09 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -1,7 +1,6 @@ use crate::core::{GovernorOverrideMode, TurboSetting}; use crate::util::error::ControlError; use core::str; -use std::path::PathBuf; use std::{fs, io, path::Path, string::ToString}; pub type Result = std::result::Result; @@ -140,7 +139,6 @@ fn get_available_governors() -> Result> { let path = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"; if !Path::new(path).exists() { - return Err(ControlError::NotSupported( "Could not determine available governors".to_string(), )); diff --git a/src/util/error.rs b/src/util/error.rs index 6ba476f..b52480b 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -11,7 +11,6 @@ pub enum ControlError { InvalidProfile(String), InvalidGovernor(String), ParseError(String), - ReadError(String), PathMissing(String), } @@ -47,9 +46,6 @@ impl std::fmt::Display for ControlError { Self::ParseError(s) => { write!(f, "Failed to parse value: {s}") } - Self::ReadError(s) => { - write!(f, "Failed to read sysfs path: {s}") - } Self::PathMissing(s) => { write!(f, "Path missing: {s}") }