fix(audio): validate saved device exists in current enumeration

- Clear stale device IDs from DB when they don't exist in enumeration
- Add warning when device lookup fails in handleBackendDeviceChange
- Add logging to set_audio_output_device command for debugging

ALSA card numbers (hw:X,0) can change between boots when USB devices
are connected/disconnected. This fix prevents using invalid device IDs
that cause playback failures.

cc
This commit is contained in:
vicrodh committed 2026-02-02 21:32:01 -06:00
1 parent 1e3aa7b0df
commit 67895aaa9b
2 files changed
+16

No files matched your search

+1
View File
@@ -292,6 +292,7 @@ pub fn set_audio_output_device(
state: tauri::State<'_, AudioSettingsState>,
device: Option<String>,
) -> Result<(), String> {
log::info!("Command: set_audio_output_device {:?}", device);
let store = state.store.lock().map_err(|e| format!("Lock error: {}", e))?;
store.set_output_device(device.as_deref())
}