From 0b90236e6d11f48a1ea767828f1ed383a7da78d2 Mon Sep 17 00:00:00 2001 From: Sebastian Czapla Date: Mon, 16 Dec 2024 16:50:44 +0100 Subject: [PATCH] keywords.robot: Add filtering to windows audio detection Signed-off-by: Sebastian Czapla --- keywords.robot | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/keywords.robot b/keywords.robot index 27d7aade9..b978b0f58 100644 --- a/keywords.robot +++ b/keywords.robot @@ -752,11 +752,20 @@ Get Power Supply State RETURN ${state} Get Sound Devices Windows - [Documentation] Get and return all sound devices in Windows OS using - ... PowerShell - ${out}= Execute Command In Terminal - ... Get-PnpDevice -PresentOnly | Where-Object {$_.Class -match "Audio" -or $_.Name -match "Audio"} | Select-Object Name, Status - RETURN ${out} + [Documentation] Get and return sound devices via PowerShell + ... filtered as all devices, audio-sink only, or microphones only + [Arguments] ${filter} + IF '${filer}' == 'all' + ${out}= Execute Command In Terminal + ... Get-PnpDevice -PresentOnly | Where-Object {$_.Class -match "Audio" -or $_.Name -match "Audio"} | Select-Object Name, Status + ELSE IF '${filter}' == 'sink' + ${out}= Execute Command In Terminal + ... Get-PnpDevice -PresentOnly | Where-Object {($_.Class -match "Audio") -and ($_.Name -match "Speaker" -or $_.Name -match "HDMI" -or $_.Name -match "Output")} | Select-Object Name, Status + ELSE IF '${filter}' == 'microphone' + ${out}= Execute Command In Terminal + ... Get-PnpDevice -PresentOnly | Where-Object {$_.Class -match "Audio" -and $_.Name -match "Microphone"} | Select-Object Name, Status + END + RETURN ${out} Get USB Devices Windows [Documentation] Get and return all USB devices in Windows OS using