diff --git a/overlay/opt/emcomm-tools/bin/et-audio b/overlay/opt/emcomm-tools/bin/et-audio index 2ec97f8..0850755 100755 --- a/overlay/opt/emcomm-tools/bin/et-audio +++ b/overlay/opt/emcomm-tools/bin/et-audio @@ -32,17 +32,22 @@ update-config () { # 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 + + # 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_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') 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 - 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 + case ${ET_DEVICE_NAME} in "DIGIRIG_MOBILE") # 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 @@ -53,7 +58,7 @@ update-config () { # Disable Auto Gain Control 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") # 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 # Disable Auto Gain Control 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."