alsa-info.sh: Simplify iteration over cards when calling amixer

Read card names directly from individual procfs files, and pass them
to amixer using the '-c' option.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
David Ward 2019-12-21 00:32:03 -05:00 committed by Takashi Iwai
parent 86b1f80e24
commit 068dd55717

View file

@ -144,12 +144,12 @@ withamixer() {
echo "!!Amixer output" >> $FILE echo "!!Amixer output" >> $FILE
echo "!!-------------" >> $FILE echo "!!-------------" >> $FILE
echo "" >> $FILE echo "" >> $FILE
for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do for f in /proc/asound/card*/id; do
CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }') [ -f "$f" ] && read -r CARD_NAME < "$f" || continue
echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE
echo "" >>$FILE echo "" >>$FILE
amixer -c$i info >> $FILE 2>&1 amixer -c "$CARD_NAME" info >> $FILE 2>&1
amixer -c$i >> $FILE 2>&1 amixer -c "$CARD_NAME" >> $FILE 2>&1
echo "" >> $FILE echo "" >> $FILE
done done
echo "" >> $FILE echo "" >> $FILE