Audio - Added initial support for dynamically determining the ALSA card number and device number

This commit is contained in:
Gaston Gonzalez
2024-10-21 16:20:42 -07:00
parent 9ed9b023db
commit 49b0d17c0f
2 changed files with 27 additions and 7 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ ${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}INTERFACES
${font DejaVu Sans Mono:size=11}${color yellow}Radio: ${execpi 10 et-system-info active-radio}
CAT : ${execpi 10 et-system-info et-cat}
GPS : ${execpi 10 et-system-info et-gps}
Audio: ${execpi 10 et-system-info et-audio}
Audio: ${execpi 10 et-system-info et-audio} ${execpi 10 et-system-info et-audio-card}
${font DejaVu Sans:bold:size=9}${color #805f4f}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release}
]];
+26 -6
View File
@@ -7,12 +7,13 @@
function usage() {
echo "Usage: $(basename $0) <command>"
echo " active-radio - Display model of active radio"
echo " et-audio - State of audio interface"
echo " et-cat - State of CAT control interface"
echo " et-gps - State of GPS interface"
echo " ip - System IP address"
echo " release - EmComm Tools release"
echo " active-radio - Display model of active radio"
echo " et-audio - Show state of audio interface"
echo " et-audio-card - Display audio card and device: <card>,<device>"
echo " et-cat - Show state of CAT control interface"
echo " et-gps - Show state of GPS interface"
echo " ip - System IP address"
echo " release - EmComm Tools release"
}
if [ $# -ne 1 ]; then
@@ -44,6 +45,25 @@ case $1 in
echo "Not connected"
fi
;;
et-audio-card)
# 1. Check if the symlink was created by the udev rules
if [ -e /dev/et-audio ]; then
# 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule
APLAY_OUT=$(arecord -l | grep ET_AUDIO)
if [ $? -eq 0 ]; then
AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}')
AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}')
echo $AUDIO_CARD,$AUDIO_DEVICE
else
exit 1
fi
else
exit 1
fi
;;
et-cat)