battery: Re-evaluate gpu state on udev change event

This commit is contained in:
Victoria Brekenfeld 2024-02-07 20:44:50 +01:00
parent bbefdb8016
commit 6ce1a581c7

View file

@ -466,6 +466,13 @@ async fn start_listening(
});
}
},
EventType::Change => {
if let Some(path) = event.devnode() {
if let Some(gpu) = monitor.gpus.iter_mut().find(|gpu| gpu.path == path) {
gpu.interval.reset_immediately();
}
}
}
EventType::Remove => {
if let Some(path) = event.devnode() {
monitor.gpus.retain(|gpu| gpu.path != path);