Merge branch 'release/r5' into feature/rtl-sdr-v4

This commit is contained in:
William McKeehan
2025-10-03 09:00:11 -04:00
21 changed files with 4162 additions and 9 deletions
+17 -2
View File
@@ -2,14 +2,14 @@
#
# Author : Gaston Gonzalez
# Date : 31 October 2024
# Updated : 31 May 2024
# Updated : 26 September 2025
# 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
# 1. ALSA settings set on ET audio device
usage() {
echo "usage: $(basename $0) <command>"
@@ -50,6 +50,8 @@ update-config () {
case ${ET_DEVICE_NAME} in
"DIGIRIG_MOBILE")
# TODO: 92% is needed for the TX-500MP. Revisit approach for setting speaker
# out differently across radios definitions.
# 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
@@ -97,6 +99,19 @@ update-config () {
et-log "Applied amixer settings for ${ET_DEVICE_NAME}"
;;
"FX-4CR")
# Unmute the PCM and set the volume to 21% to get the full output power. This value is
# dependent on the settings defined for the FX-4CR in the et-radio notes.
amixer -q -c ${AUDIO_CARD} sset 'PCM' 31% unmute
# Set "L/R Capture" to 55%. Adjust if you can't decode received audio.
amixer -q -c ${AUDIO_CARD} sset 'Mic' 67% unmute
# Disable Auto Gain Control
amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute
et-log "Applied amixer settings for ${ET_DEVICE_NAME}"
;;
*)
et-log "No ALSA configuration specified for this ET_DEVICE."
;;
+201
View File
@@ -0,0 +1,201 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 2 October 2025
# Purpose : Wrapper script for starting fldigi with PnP support
#
# Preconditions
# 1. Supported radio and audio interface are connected and properly detected
#
# Postconditions
# 1. Stop all running EmComm Tools modes
# 2. fldigi core settings updated (e.g., CAT, audio, user config and ETC defaults)
# 3. fldigi started
usage() {
echo "usage: $(basename $0) <command>"
echo " start - Update config and start fldigi"
echo " update-config - Update config"
}
if [[ $# -ne 1 ]]; then
usage
exit 1
fi
notify_user() {
notify-send \
-t 5000 \
--app-name="EmComm Tools" \
"$1"
}
start() {
/opt/emcomm-tools/bin/et-kill-all && update-config && /usr/local/bin/fldigi &
}
update-config () {
# 1. Check if the audio device 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
APLAY_OUT=$(arecord -l | grep ET_AUDIO)
if [[ $? -eq 0 ]]; then
## 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 fldigi. No ET_AUDIO device detected."
exit 1
fi
else
et-log "No ET_AUDIO device plugged in."
notify_user "Can't start fldigi. No supported audio device plugged in."
exit 1
fi
PORT_AUDIO_CONF=/tmp/conf.tmp
GEO_CONF=/tmp/geo.tmp
FLDIGI_CONF_DIR="${HOME}/.fldigi"
FLDIGI_CONF_FILE="${FLDIGI_CONF_DIR}/fldigi_def.xml"
if [[ ! -e ${FLDIGI_CONF_DIR} ]]; then
et-log "${FLDIGI_CONF_DIR} does not exist. Creating it from template."
mkdir -v ${FLDIGI_CONF_DIR}
cp -v /etc/skel/.fldigi/fldigi_def.xml ${FLDIGI_CONF_DIR}
fi
[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json"
# clean up temporary config that may exist
[[ -e ${PORT_AUDIO_CONF} ]] && rm ${PORT_AUDIO_CONF}
et-portaudio 2>/dev/null > ${PORT_AUDIO_CONF}
if [[ $? -ne 0 ]]; then
et-log "No supported ET_AUDIO device found"
exit 1
fi
DEVICE=$(jq -r -e '.device' ${PORT_AUDIO_CONF})
if [[ $? -ne 0 ]]; then
et-log "Error getting PulseAudio device name for ET_AUDIO device"
exit 1
fi
INDEX=$(jq -r -e '.index' ${PORT_AUDIO_CONF})
if [[ $? -ne 0 ]]; then
et-log "Error getting PulseAudio device index for ET_AUDIO device"
exit 1
fi
##############################################
# Map ALSA ET_AUDIO device to PortAudio device
##############################################
et-log "Updating PortAudio device configuration..."
sed -i "s|^<AUDIOIO>.*|<AUDIOIO>1</AUDIOIO>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<PORTINDEVICE>.*|<PORTINDEVICE>${DEVICE}</PORTINDEVICE>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<PORTININDEX>.*|<PORTININDEX>${INDEX}</PORTININDEX>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<PORTOUTDEVICE>.*|<PORTOUTDEVICE>${DEVICE}</PORTOUTDEVICE>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<PORTOUTINDEX>.*|<PORTOUTINDEX>${INDEX}</PORTOUTINDEX>|" ${FLDIGI_CONF_FILE}
et-log "Using device '${DEVICE}' and device index '${INDEX}' for PortAudio configuration"
#################
# Update callsign
#################
et-log "Updating callsign configuration..."
CALLSIGN=$(jq -r -e '.callsign' ${ET_USER_CONFIG})
if [[ "${CALLSIGN}" = "N0CALL" ]]; then
et-log "Exiting early. No callsign set. Run: et-user."
exit 1
fi
et-log "Using callsign '${CALLSIGN}'"
sed -i "s|^<MYCALL>.*|<MYCALL>${CALLSIGN}</MYCALL>|" ${FLDIGI_CONF_FILE}
###############################################
# Update grid based on ETC geolocation services
###############################################
et-log "Updating your grid square..."
curl -f -s "http://localhost:1981/api/geo/position" > ${GEO_CONF}
if [[ $? -eq 0 ]]; then
GRID=$(jq -r -e '.position.gridSquare' ${GEO_CONF})
if [[ $? -eq 0 ]]; then
et-log "Using grid square '${GRID}' for your location"
sed -i "s|^<MYLOC>.*|<MYLOC>${GRID}</MYLOC>|" ${FLDIGI_CONF_FILE}
fi
fi
[[ -e ${GEO_CONF} ]] && rm ${GEO_CONF}
#####################################################################
# Configure CAT interface using Hamlib's rig control daemon (rigctld)
#####################################################################
et-log "Updating CAT control configuration..."
sed -i "s|^<CHKUSEHAMLIBIS>.*|<CHKUSEHAMLIBIS>1</CHKUSEHAMLIBIS>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<HAMRIGMODEL>.*|<HAMRIGMODEL>2</HAMRIGMODEL>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<HAMLIBCMDPTT>.*|<HAMLIBCMDPTT>1</HAMLIBCMDPTT>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<HAMRIGDEVICE>.*|<HAMRIGDEVICE>localhost:4532</HAMRIGDEVICE>|" ${FLDIGI_CONF_FILE}
######################################
# Enable Reed Soloman ID for RX and TX
######################################
et-log "Enabling Reed Soloman ID for RX/TX..."
sed -i "s|^<RECEIVERSID>.*|<RECEIVERSID>1</RECEIVERSID>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<TRANSMITRSID>.*|<TRANSMITRSID>1</TRANSMITRSID>|" ${FLDIGI_CONF_FILE}
###########################
# Modem configuration: MT63
###########################
et-log "Updating MT63 modem configuration..."
sed -i "s|^<MT63INTEGRATION>.*|<MT63INTEGRATION>1</MT63INTEGRATION>|" ${FLDIGI_CONF_FILE}
########################
# Repeater configuration
########################
et-log "Updating settings for linked repeater systems..."
# Key up for 2 seconds before transmitting tone. Needed for linked repeater systems.
sed -i "s|^<PRETONE>.*|<PRETONE>2</PRETONE>|" ${FLDIGI_CONF_FILE}
#####################
# NBEMS configuration
#####################
et-log "Updating settings for NBEMS..."
sed -i "s|^<OPEN_NBEMS_FOLDER>.*|<OPEN_NBEMS_FOLDER>1</OPEN_NBEMS_FOLDER>|" ${FLDIGI_CONF_FILE}
sed -i "s|^<FLMSG_PATHNAME>.*|<FLMSG_PATHNAME>/usr/local/bin/flmsg</FLMSG_PATHNAME>|" ${FLDIGI_CONF_FILE}
}
case $1 in
start)
start
;;
update-config)
update-config
;;
*)
echo "Invalid command."
usage
exit 1
;;
esac
+1 -1
View File
@@ -2,7 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 12 November 2024
# Updated : 7 February 2025
# Updated : 2 October 2025
# Purpose : Stops all EmComm Tools sound-based services (i.e. modems) and
# amatuer radio applications to ensure a clean start for the next mode.
@@ -0,0 +1,28 @@
{
"id": "bg2fx-fx4cr",
"vendor": "BG2FX",
"model": "FX-4CR",
"rigctrl": {
"id": "2031",
"baud": "115200",
"ptt": "RIG",
"conf": "data_bits=8,serial_handshake=None,stop_bits=1,rts_state=OFF",
"pttOnly": "false"
},
"notes": [
"Short press [PWR], then rotate AF knob until POW = 5.0",
"Toggle [SSB] button until both USB and DIG appear",
"Short press [M. V] until VFOA is displayed",
"Long press [MENU], rotate AF to BLUETOOTH, rotate TUNE and set to 0",
"Set radio volume to 50",
"Set mic gain to 50",
"Set alsamixer PCM to 21",
"Set alsamixer Mic to 55",
"Set alsamixer AGC to mm"
],
"fieldNotes": [
"Tested with FX-4CR firmware version: 1.7.3 (2025/09/01)",
"You must force the RTS control line to low for audio output to work with the PTT",
"This is handled with rts_state=OFF using the --set-conf argument of rigctld"
]
}
@@ -0,0 +1,20 @@
{
"id": "lab599-tx500mp",
"vendor": "Lab599",
"model": "TX-500MP (DigiRig Mobile)",
"rigctrl": {
"id": "2014",
"baud": "9600",
"ptt": "RTS",
"pttOnly": "false"
},
"notes": [
"1. Set MENU 36 CAT PROTOCOL = TS2000",
"2. Set MODE = DIGI",
"",
"Do not enable VOX on radio"
],
"fieldNotes": [
]
}
+6 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# Author : Gaston Gonzalez
# Date : 11 October 2024
# Updated : 21 May 2025
# Updated : 13 September 2025
# Purpose : Perform tests that can be used by the udev subsystem to aid
# in rule development. This is intended to by used with the PROGRAM
# directive inside of a udev rule.
@@ -81,6 +81,11 @@ test_digirig_mobile() {
exit 0
fi
if [[ "$ID" == "lab599-tx500mp" ]]; then
et-log "Old DigiRig Mobile detected for TX-500MP"
exit 0
fi
fi
exit 1
@@ -2,13 +2,16 @@
#
# Author : Gaston Gonzalez
# Date : 9 October 2024
# Updated : 31 May 2025
# Updated : 26 September 2025
# Purpose : Wrapper startup/shutdown script around systemd/rigctld
ET_HOME=/opt/emcomm-tools
ACTIVE_RADIO="${ET_HOME}/conf/radios.d/active-radio.json"
CAT_DEVICE=/dev/et-cat
# Additional configuration to pass to rigctld
SET_CONF=""
do_full_auto() {
et-log "Found ET_DEVICE='${ET_DEVICE}'"
@@ -95,8 +98,14 @@ start() {
exit 0
fi
# Handle optional configuration settings
CONF=$(jq -e -r '.rigctrl.conf' "${ET_HOME}/conf/radios.d/active-radio.json")
if [[ $? -eq 0 ]]; then
SET_CONF="--set-conf=${CONF}"
fi
# Generate command
CMD="rigctld -m ${ID} -r ${CAT_DEVICE} -s ${BAUD} -P ${PTT} "
CMD="rigctld -m ${ID} -r ${CAT_DEVICE} -s ${BAUD} -P ${PTT} ${SET_CONF}"
et-log "Starting rigctld with: ${CMD}"
$CMD
}