[alsa-devel] [PATCH v2 alsa-utils 03/11] alsa-info.sh: Simplify iteration over cards when calling amixer
David Ward
david.ward at ll.mit.edu
Fri Jan 3 18:55:50 CET 2020
Read card names directly from individual procfs files, and pass them
to amixer using the '-c' option.
Signed-off-by: David Ward <david.ward at ll.mit.edu>
---
alsa-info/alsa-info.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
index d6d0935..ff3cf95 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
--
1.8.3.1
More information about the Alsa-devel
mailing list