From 6abfc76bb700bc9f10774f0865b4725bf6557ef4 Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Fri, 23 Apr 2021 10:45:14 -0700 Subject: [PATCH] sxmo_audiocurrentdevice: use existing env vars for audio devices Signed-off-by: Anjandev Momi --- scripts/core/sxmo_audiocurrentdevice.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_audiocurrentdevice.sh b/scripts/core/sxmo_audiocurrentdevice.sh index 37a20aa..ddef734 100755 --- a/scripts/core/sxmo_audiocurrentdevice.sh +++ b/scripts/core/sxmo_audiocurrentdevice.sh @@ -1,8 +1,12 @@ #!/usr/bin/env sh +${SPEAKER:-"Line Out"} +${HEADPHONE:-"Headphone"} +${EARPIECE:-"Earpiece"} + audiodevice() { - amixer sget "Earpiece" | grep -qE '\[on\]' && echo Earpiece && return - amixer sget "Headphone" | grep -qE '\[on\]' && echo Headphone && return - amixer sget "Line Out" | grep -qE '\[on\]' && echo Line Out && return + amixer sget "$EARPIECE" | grep -qE '\[on\]' && echo "$EARPIECE" && return + amixer sget "$HEADPHONE" | grep -qE '\[on\]' && echo "$HEADPHONE" && return + amixer sget "$SPEAKER" | grep -qE '\[on\]' && echo "$SPEAKER" && return echo "None" }