feat(commands): add touchpad inhibition handling and status display
New Features - Implement touchpad enable/disable commands via /sys/class/input/inhibited. - Add permission adjustments for touchpad inhibition files. - Show touchpad status in `lapctl status`. Enhancements - Update install rules to manage touchpad inhibition permissions. - Expose new `touchpad` command module. Bug Fixes - Resolve missing permission errors for touchpad devices. - Handle missing /sys/class/input directory gracefully.
This commit is contained in:
4 files changed
+85
No files matched your search
@@ -153,4 +153,30 @@ pub fn execute() {
|
||||
if !tdp_found {
|
||||
println!("CPU TDP Limit: Hardware Managed");
|
||||
}
|
||||
|
||||
// Touchpad Status
|
||||
let sys_class_input = Path::new("/sys/class/input");
|
||||
if sys_class_input.exists()
|
||||
&& let Ok(entries) = fs::read_dir(sys_class_input)
|
||||
{
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
let name_path = path.join("name");
|
||||
let inhibited_path = path.join("inhibited");
|
||||
|
||||
if name_path.exists()
|
||||
&& inhibited_path.exists()
|
||||
&& let Ok(name) = fs::read_to_string(&name_path)
|
||||
&& name.to_lowercase().contains("touchpad")
|
||||
&& let Ok(val) = fs::read_to_string(&inhibited_path)
|
||||
{
|
||||
let status = if val.trim() == "1" {
|
||||
"Disabled"
|
||||
} else {
|
||||
"Enabled"
|
||||
};
|
||||
println!("Touchpad: {} ({})", status, name.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user