armbian-audio-config: Fix muting and controls with spaces

In commit 0aa61abe7 (armbian-audio-config: Massively speed up script)
this script was changed to not call amixer for each control, but just
once for each card, feeding commands for many controls in one invocation
with the `--stdin` option.

In that commit, two errors were introduced:
 - Controls that were intended to be muted were turned on instead. This
   affects the "CD", "Mic" and "Internal Speaker" controls.

   This occured because there is a helper shell function whose arguments
   were renumbered, but the last argument kept the old numbering,
   keeping it always at the default value of "on", even when it should
   have been "mute".

 - Controls with a space in their name would be ignored. In the original
   script, arguments (including these names) were quoted and passed
   separately to the `amixer` command. Now, they are quoted when passed
   to `echo`, but that produces an unstructured line with the quoting
   removed that can no longer be correctly parsed by amixer for names
   with spaces.

This commit fixes both problems be correctly numbering the arguments and
adding an additional layer of quoting.
This commit is contained in:
Matthijs Kooijman
2023-04-16 20:36:03 +02:00
committed by Igor Pečovnik
parent a0f59bf914
commit da626d1502

View File

@@ -7,9 +7,9 @@
[[ -z $(command -v aplay) ]] && echo "Missing aplay; doing nothing." && exit 0
mixer_cmds() {
parm=${4:-on}
echo sset "$1" "$2" "$parm"
echo sset "$1" "$parm"
parm=${3:-on}
echo "sset '$1' '$2' '$parm'"
echo "sset '$1' '$parm'"
}
if [ -f "$HOME/.config/sound.conf" ]; then