diff options
author | David Ward <david.ward@ll.mit.edu> | 2019-12-21 00:32:03 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-01-07 14:04:40 +0100 |
commit | 068dd55717d4e020849e4dd12610d16968cf49be (patch) | |
tree | b6d213da128888d9750f83cd1318f9455d2499ef /alsa-info | |
parent | 86b1f80e24b68ce8153874e6ac851fa2b90c43b5 (diff) | |
download | alsa-utils-068dd55717d4e020849e4dd12610d16968cf49be.tar.gz |
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>
Diffstat (limited to 'alsa-info')
-rwxr-xr-x | alsa-info/alsa-info.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh index ed1d9e2..e1067d4 100755 --- a/alsa-info/alsa-info.sh +++ b/alsa-info/alsa-info.sh @@ -144,12 +144,12 @@ withamixer() { echo "!!Amixer output" >> $FILE echo "!!-------------" >> $FILE echo "" >> $FILE - for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do - CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }') - echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE + for f in /proc/asound/card*/id; do + [ -f "$f" ] && read -r CARD_NAME < "$f" || continue + echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE echo "" >>$FILE - amixer -c$i info >> $FILE 2>&1 - amixer -c$i >> $FILE 2>&1 + amixer -c "$CARD_NAME" info >> $FILE 2>&1 + amixer -c "$CARD_NAME" >> $FILE 2>&1 echo "" >> $FILE done echo "" >> $FILE |