fix: improve device lookup in get_device function and update daemon device name

This commit is contained in:
2026-01-28 22:30:33 +03:00
parent b0c670235e
commit ce5910b9a6
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ pub fn get_daemon_config() -> DaemonConfig {
pub async fn link_player_to_virtual_mic() -> Result<(), Box<dyn Error>> { pub async fn link_player_to_virtual_mic() -> Result<(), Box<dyn Error>> {
let pwsp_daemon_output; let pwsp_daemon_output;
if let Ok(device) = get_device("alsa_playback.pwsp-daemon").await { if let Ok(device) = get_device("pwsp-daemon").await {
pwsp_daemon_output = device; pwsp_daemon_output = device;
} else { } else {
eprintln!("Could not find alsa_playback.pwsp-daemon device, skipping device linking"); eprintln!("Could not find alsa_playback.pwsp-daemon device, skipping device linking");
+5 -1
View File
@@ -210,7 +210,11 @@ pub async fn get_device(device_name: &str) -> Result<AudioDevice, Box<dyn Error>
input_devices.extend(output_devices); input_devices.extend(output_devices);
for device in input_devices { for device in input_devices {
if device.name == device_name { if device.name == device_name
|| device.nick == device_name
|| device.name.contains(device_name)
|| device.nick.contains(device_name)
{
return Ok(device); return Ok(device);
} }
} }