battery: Re-evaluate gpu state on udev change event
This commit is contained in:
parent
bbefdb8016
commit
6ce1a581c7
1 changed files with 7 additions and 0 deletions
|
|
@ -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 => {
|
EventType::Remove => {
|
||||||
if let Some(path) = event.devnode() {
|
if let Some(path) = event.devnode() {
|
||||||
monitor.gpus.retain(|gpu| gpu.path != path);
|
monitor.gpus.retain(|gpu| gpu.path != path);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue