Fix incorrect stop/start order of nvidia-powerd on AC plug/unplug

This commit is contained in:
Luke D. Jones
2022-12-28 21:30:29 +13:00
parent c2aa81bfe3
commit 29b22cd18e
4 changed files with 16 additions and 12 deletions

View File

@@ -262,13 +262,13 @@ async fn do_nvidia_powerd_action(proxy: &SystemdProxy<'_>, ac_on: bool) {
if res == UnitFileState::Enabled {
if ac_on {
proxy
.stop_unit(NVIDIA_POWERD, Mode::Replace)
.start_unit(NVIDIA_POWERD, Mode::Replace)
.await
.map_err(|e| error!("Error stopping {NVIDIA_POWERD}, {e:?}"))
.ok();
} else {
proxy
.start_unit(NVIDIA_POWERD, Mode::Replace)
.stop_unit(NVIDIA_POWERD, Mode::Replace)
.await
.map_err(|e| error!("Error stopping {NVIDIA_POWERD}, {e:?}"))
.ok();