Audio - Updates to et-audio to make it more robust following testing with udev triggers

This commit is contained in:
Gaston Gonzalez
2024-10-31 11:43:27 -07:00
parent ae84c03367
commit aee42cb457
+14 -7
View File
@@ -32,17 +32,22 @@ update-config () {
# 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule # 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) APLAY_OUT=$(arecord -l | grep ET_AUDIO)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
# Use device descriptor assigned by udev rules
ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE)
if [ $? -ne 0 ]; then
et-log "ET_DEVICE not set by udev rule. Can't set ALSA settings"
exit 1
fi
ET_DEVICE_NAME=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2)
AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}') 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}') AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}')
FULL_AUDIO_DEVICE="$AUDIO_CARD,$AUDIO_DEVICE" FULL_AUDIO_DEVICE="$AUDIO_CARD,$AUDIO_DEVICE"
et-log "Updating audio device: '${ET_DEVICE_NAME}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration."
# Use device descriptor assigned by udev rules case ${ET_DEVICE_NAME} in
ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2)
et-log "Updating audio device: '${ET_DEVICE}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration."
case ${ET_DEVICE} in
"DIGIRIG_MOBILE") "DIGIRIG_MOBILE")
# Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls.
amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute
@@ -53,7 +58,7 @@ update-config () {
# Disable Auto Gain Control # Disable Auto Gain Control
amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute
et-log "Applied amixer settings for ${ET_DEVICE}" et-log "Applied amixer settings for ${ET_DEVICE_NAME}"
;; ;;
"DIGIRIG_LITE") "DIGIRIG_LITE")
# Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls. # Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls.
@@ -64,6 +69,8 @@ update-config () {
amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute
# Disable Auto Gain Control # Disable Auto Gain Control
amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute
et-log "Applied amixer settings for ${ET_DEVICE_NAME}"
;; ;;
*) *)
el-log "No ALSA configuration specified for this ET_DEVICE." el-log "No ALSA configuration specified for this ET_DEVICE."