Skip to content

Commit

Permalink
fix(CompositeDevice): clear state for target devices on profile change
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Nov 22, 2024
1 parent b399900 commit 48480c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/input/composite_device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,17 @@ impl CompositeDevice {
});
}

// Clear the state from all target devices
let target_devices = self.target_devices.clone();
tokio::task::spawn(async move {
for (path, device) in target_devices.iter() {
log::debug!("Clearing state on device: {path}");
if let Err(e) = device.clear_state().await {
log::error!("Failed to clear state on target device {path}: {e:?}");
}
}
});

log::debug!("Successfully loaded device profile: {}", profile.name);
Ok(())
}
Expand Down

0 comments on commit 48480c8

Please sign in to comment.