feat(commands): add cooling command implementation and status integration
- New Features - Implement fan_mode control for Ideapad laptops - Implement thermal policy control for ASUS laptops via WMI - Provide cooling command supporting performance, balanced, and quiet profiles - Enhancements - Display current cooling profile in `lapctl status` output - Bug Fixes - None
This commit is contained in:
3 files changed
+109
No files matched your search
@@ -1,5 +1,6 @@
|
||||
use crate::hardware::gpu;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn execute() {
|
||||
println!("--- lapctl status ---");
|
||||
@@ -54,4 +55,42 @@ pub fn execute() {
|
||||
} else {
|
||||
println!("Power Profile: Unknown");
|
||||
}
|
||||
|
||||
// Cooling / Thermal Status
|
||||
let mut thermal_found = false;
|
||||
if let Ok(ideapad_entries) = fs::read_dir("/sys/bus/platform/drivers/ideapad_acpi") {
|
||||
for ideapad_entry in ideapad_entries.flatten() {
|
||||
let fan_path = ideapad_entry.path().join("fan_mode");
|
||||
if fan_path.exists() {
|
||||
if let Ok(mode) = fs::read_to_string(&fan_path) {
|
||||
thermal_found = true;
|
||||
let desc = match mode.trim() {
|
||||
"1" => "Performance",
|
||||
"0" => "Balanced",
|
||||
"2" => "Quiet / Battery Saving",
|
||||
_ => mode.trim()
|
||||
};
|
||||
println!("Cooling Profile: {} (Ideapad)", desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let asus_path = Path::new("/sys/devices/platform/asus-nb-wmi/throttle_thermal_policy");
|
||||
if asus_path.exists() {
|
||||
if let Ok(mode) = fs::read_to_string(asus_path) {
|
||||
thermal_found = true;
|
||||
let desc = match mode.trim() {
|
||||
"1" => "Performance",
|
||||
"0" => "Balanced",
|
||||
"2" => "Quiet / Battery Saving",
|
||||
_ => mode.trim()
|
||||
};
|
||||
println!("Cooling Profile: {} (ASUS)", desc);
|
||||
}
|
||||
}
|
||||
|
||||
if !thermal_found {
|
||||
println!("Cooling Profile: Unknown / Firmware managed");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user