sxmo-utils/scripts/core/sxmo_audioout.sh
Clayton Craft 2d9740f252 sxmo_audio*: properly set vars with default values if they are unset
A mistake from implementing this resulted in the shell trying to expand
the 'word' part (e.g. "Line Out"), when the var was unset or null.
Obviously those are are strings and not expandable.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-04-24 01:14:55 -04:00

24 lines
558 B
Bash
Executable file

#!/usr/bin/env sh
ARG="$1"
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
SPEAKER="${SPEAKER:-"Line Out"}"
HEADPHONE="${HEADPHONE:-"Headphone"}"
EARPIECE="${EARPIECE:-"Earpiece"}"
amixer set "$SPEAKER" mute
amixer set "$HEADPHONE" mute
amixer set "$EARPIECE" mute
if [ "$ARG" = "Speaker" ]; then
amixer set "$SPEAKER" unmute
elif [ "$ARG" = "Headphones" ]; then
amixer set "$HEADPHONE" unmute
elif [ "$ARG" = "Earpiece" ]; then
amixer set "$EARPIECE" unmute
fi
sxmo_statusbarupdate.sh