From 5b151ed4f8f59884d3a74a9f819ecace5ac177c9 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Tue, 5 Nov 2024 15:58:48 -0700 Subject: [PATCH] ARDOP - Initial wrapper command for ARDOP modem --- overlay/opt/emcomm-tools/bin/et-ardop | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 overlay/opt/emcomm-tools/bin/et-ardop diff --git a/overlay/opt/emcomm-tools/bin/et-ardop b/overlay/opt/emcomm-tools/bin/et-ardop new file mode 100755 index 0000000..5d13111 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-ardop @@ -0,0 +1,46 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 5 November 2024 +# Purpose : Wrapper script for starting ARDOP +# +# Preconditions: +# 1. Supported radio and audio interface are connected and properly detected +# +# Postconditions: +# 1. Audio settings updated +# 2. ARDOP modem started +# +# Assumptions: +# 1. The application using the ARDOP modem is responsible for keying the PTT. + +ARDOP_PORT=8515 + +# 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}') + ARDOP_AUDIO_DEVICE="plughw:${AUDIO_CARD},${AUDIO_DEVICE}" + + # 3. Update audio device + et-log "Using '${ARDOP_AUDIO_DEVICE}' as audio device for ARDOP." + + # 4. Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + + else + et-log "Can't start ARDOP modem. No ET_AUDIO device detected." + exit 1 + fi +else + et-log "No ET_AUDIO device plugged in. No supported audio device plugged it." + exit 1 +fi + +CMD="ardopcf ${ARDOP_PORT} ${ARDOP_AUDIO_DEVICE} ${ARDOP_AUDIO_DEVICE}" +et-log "Starting ARDOP with: '${CMD}'" +${CMD}