Skip to content

Commit 48480c8

Browse files
committed
fix(CompositeDevice): clear state for target devices on profile change
1 parent b399900 commit 48480c8

File tree

1 file changed

+11
-0
lines changed
  • src/input/composite_device

1 file changed

+11
-0
lines changed

src/input/composite_device/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,17 @@ impl CompositeDevice {
15281528
});
15291529
}
15301530

1531+
// Clear the state from all target devices
1532+
let target_devices = self.target_devices.clone();
1533+
tokio::task::spawn(async move {
1534+
for (path, device) in target_devices.iter() {
1535+
log::debug!("Clearing state on device: {path}");
1536+
if let Err(e) = device.clear_state().await {
1537+
log::error!("Failed to clear state on target device {path}: {e:?}");
1538+
}
1539+
}
1540+
});
1541+
15311542
log::debug!("Successfully loaded device profile: {}", profile.name);
15321543
Ok(())
15331544
}

0 commit comments

Comments
 (0)