diff --git a/overlay/opt/emcomm-tools/bin/et-audio b/overlay/opt/emcomm-tools/bin/et-audio new file mode 100755 index 0000000..0850755 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-audio @@ -0,0 +1,102 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 31 October 2024 +# Purpose : Configures ET audio device with sane defaults +# +# Preconditions +# 1. Supported audio interface is connected and properly detected +# +# Postconditions +# 1. ASLA settings set on ET audio device + +usage() { + echo "usage: $(basename $0) " + echo " update-config - Update amixer config" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +start() { + update-config +} + +update-config () { + + # 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 + + # 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." + + 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 + # Unmute Mic + amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute + # Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls. + 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}" + ;; + "DIGIRIG_LITE") + # 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 + # Unmute Mic + amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute + # Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls. + 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." + ;; + esac + + else + et-log "No ET_AUDIO device detected. Can't change ALSA settings." + exit 1 + fi + else + et-log "No ET_AUDIO device plugged in. Can't change ALSA settings." + exit 1 + fi +} + +case $1 in + start) + start + ;; + update-config) + update-config + ;; + *) + echo "Invalid command." + usage + exit 1 + ;; +esac diff --git a/overlay/opt/emcomm-tools/bin/et-js8call b/overlay/opt/emcomm-tools/bin/et-js8call index dedad8d..4474709 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8call +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 24 October 2024 -# Updated : 28 October 2024 +# Updated : 31 October 2024 # Purpose : Wrapper script for starting JS8Call with PnP support # # Preconditions @@ -62,7 +62,15 @@ update-config () { APLAY_OUT=$(arecord -l | grep ET_AUDIO) if [ $? -eq 0 ]; then AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') - JS8_AUDIO_DEVICE="plughw:CARD=ET_AUDIO,DEV=${AUDIO_DEVICE}" + + # JS8Call has an issue decoding the received audio following a + # transmission when the device below is used. + # + #JS8_AUDIO_DEVICE="plughw:CARD=ET_AUDIO,DEV=${AUDIO_DEVICE}" + # + # Instead, the following device solves this issue: + JS8_AUDIO_DEVICE="sysdefault:CARD=ET_AUDIO" + et-log "Using '${JS8_AUDIO_DEVICE}' for JS8Call configuration." # 3. Check for existing JS8Call sound configuration @@ -83,6 +91,9 @@ update-config () { echo "SoundOutName=\"${JS8_AUDIO_DEVICE}\"" >> ${JS8CALL_CONF_FILE} fi + ## Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + else et-log "No ET_AUDIO device detected." notify_user "Can't start JS8Call. No ET_AUDIO device detected." diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index fcc9879..8dc6702 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 6 October 2024 -# Updated : 25 October 2024 +# Updated : 30 October 2024 # Purpose : Utility script for dumping system information function usage() { @@ -102,14 +102,21 @@ case $1 in # 2. Check if the rigctl systemd unit is running properly systemctl status rigctld --no-pager > /dev/null if [ $? -eq 0 ]; then - + + # Note: I am disabling the VFO read as it causes issues with serval Icom + # radios and results in the VFO changing momentarily during this client + # request. It causes issues during TX and RX. If it is not bulletproof, + # features like this will be turned off. This is a problem given that + # Conky calls this method every 10 seconds. + # # 3. Grab and format frequency - FREQ=$(timeout 1 rigctl -m 2 f) - if [ $? -eq 0 ]; then - printf "%'d MHz\n" "$FREQ" | sed 's|,|.|g' - else - echo "Connected. Can't access VFO"; - fi + #FREQ=$(timeout 1 rigctl -m 2 f) + #if [ $? -eq 0 ]; then + # printf "%'d MHz\n" "$FREQ" | sed 's|,|.|g' + #else + # echo "Connected. Can't access VFO"; + #fi + echo "Connected"; else echo "Connected. No rig control" fi diff --git a/scripts/install-audio-tools.sh b/scripts/install-audio-tools.sh new file mode 100755 index 0000000..7964376 --- /dev/null +++ b/scripts/install-audio-tools.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 30 October 2024 +# Purpose : Install audio tools +set -e + +et-log "Installing audio tools..." + +apt install \ + audacity \ + ffmpeg \ + sox \ + -y diff --git a/scripts/install.sh b/scripts/install.sh index 203ae9f..9f825a4 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 13 October 2024 +# Updated : 30 October 2024 # Purpose : Main installer for EmComm Tools OS Community . ./env.sh @@ -36,3 +36,5 @@ exitIfNotRoot ./install-conky.sh ./install-direwolf.sh + +./install-audio-tools.sh