From 0faa56fd3307e0858b4befd6b92dda80da71865b Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 21 Oct 2024 14:47:45 -0700 Subject: [PATCH 01/16] Conky - Added initial audio interface state; added headings; added system info section --- overlay/etc/skel/.conkyrc | 18 +++++++++++++----- overlay/opt/emcomm-tools/bin/et-system-info | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/overlay/etc/skel/.conkyrc b/overlay/etc/skel/.conkyrc index b22835a..5b979d3 100644 --- a/overlay/etc/skel/.conkyrc +++ b/overlay/etc/skel/.conkyrc @@ -17,17 +17,25 @@ conky.config = { }; conky.text = [[ -${font DejaVu Sans Mono:size=12}${alignc}${time %A, %B %d %Y} +${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}DATE/TIME +${font DejaVu Sans Mono:size=11}${color yellow}${alignc}${time %A, %B %d %Y} Local: ${alignr}${time %H:%M:%S} UTC: ${alignr}${tztime UTC %H:%M:%S} -Uptime: ${uptime} -IP: ${execpi 60 /opt/emcomm-tools/bin/et-system-info ip} +${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}SYSTEM +${font DejaVu Sans Mono:size=11}${color yellow}Uptime : ${uptime} +CPU Util : ${cpu}% +Disk Free: ${fs_free /} -Radio: ${execpi 10 et-system-info active-radio} +${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}NETWORK +${font DejaVu Sans Mono:size=11}${color yellow}IP: ${execpi 60 /opt/emcomm-tools/bin/et-system-info ip} + +${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}INTERFACES +${font DejaVu Sans Mono:size=11}${color yellow}Radio: ${execpi 10 et-system-info active-radio} CAT : ${execpi 10 et-system-info et-cat} GPS : ${execpi 10 et-system-info et-gps} +Audio: ${execpi 10 et-system-info et-audio} -${font DejaVu Sans Mono:size=10}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release} +${font DejaVu Sans Mono:size=9}${color #8d5133}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release} ]]; diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index 7109e34..95f625b 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -2,16 +2,17 @@ # # Author : Gaston Gonzalez # Date : 6 October 2024 -# Updated : 20 October 2024 +# Updated : 21 October 2024 # Purpose : Utility script for dumping system information function usage() { echo "Usage: $(basename $0) " echo " active-radio - Display model of active radio" - echo " et-cat - Is CAT control connected" - echo " et-gps - Is the GPS connected" + echo " et-audio - State of audio interface" + echo " et-cat - State of CAT control interface" + echo " et-gps - State of GPS interface" echo " ip - System IP address" - echo " release - EmComm Tools Release" + echo " release - EmComm Tools release" } if [ $# -ne 1 ]; then @@ -26,6 +27,16 @@ case $1 in else echo "No radio selected" fi + ;; + et-audio) + + # 1. Check if the symlink was created by the udev rules + if [ -e /dev/et-audio ]; then + echo "Connected" + else + echo "Not connected" + fi + ;; et-cat) From 4b0eb3f056824bd7de303748a6f852c01ebf823e Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 21 Oct 2024 15:17:34 -0700 Subject: [PATCH 02/16] Audio - Added initial support for DigiRig Lite audio device --- overlay/etc/udev/rules.d/90-et-digirig-lite.rules | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 overlay/etc/udev/rules.d/90-et-digirig-lite.rules diff --git a/overlay/etc/udev/rules.d/90-et-digirig-lite.rules b/overlay/etc/udev/rules.d/90-et-digirig-lite.rules new file mode 100644 index 0000000..7ef3a22 --- /dev/null +++ b/overlay/etc/udev/rules.d/90-et-digirig-lite.rules @@ -0,0 +1,13 @@ +# Author : Gaston Gonzalez +# Date : 17 October 2024 +# Purpose : udev rules for the DigiRig Lite +# +# Preconditions: +# 1. DigiRig Lite connected via USB cable +# +# Postconditions: + +SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0012", ENV{ET_DEVICE}=="", \ + ACTION=="add", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_DEVICE}="DIGIRIG_LITE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="dialout", MODE="0660", SYMLINK+="et-audio" From 524ffdd53160f1833fea461dc4934a4616e2766d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 21 Oct 2024 15:20:32 -0700 Subject: [PATCH 03/16] Conky - Adjusted color and font weight for release label --- overlay/etc/skel/.conkyrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/etc/skel/.conkyrc b/overlay/etc/skel/.conkyrc index 5b979d3..1173e7d 100644 --- a/overlay/etc/skel/.conkyrc +++ b/overlay/etc/skel/.conkyrc @@ -36,6 +36,6 @@ CAT : ${execpi 10 et-system-info et-cat} GPS : ${execpi 10 et-system-info et-gps} Audio: ${execpi 10 et-system-info et-audio} -${font DejaVu Sans Mono:size=9}${color #8d5133}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release} +${font DejaVu Sans:bold:size=9}${color #805f4f}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release} ]]; From 9ed9b023db4e87a966af089425743200e73c302a Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 21 Oct 2024 15:42:31 -0700 Subject: [PATCH 04/16] Audio - Updated et-system-info to output the audio ET_DEVICE --- overlay/opt/emcomm-tools/bin/et-system-info | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index 95f625b..a4be451 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -32,7 +32,14 @@ case $1 in # 1. Check if the symlink was created by the udev rules if [ -e /dev/et-audio ]; then - echo "Connected" + + UDEV_OUT=$(udevadm info /dev/et-audio | grep ET_DEVICE) + if [ $? -eq 0 ]; then + udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2 + else + echo "Connected" + fi + else echo "Not connected" fi From 49b0d17c0f2fab1a3eab887473778150085654ea Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 21 Oct 2024 16:20:42 -0700 Subject: [PATCH 05/16] Audio - Added initial support for dynamically determining the ALSA card number and device number --- overlay/etc/skel/.conkyrc | 2 +- overlay/opt/emcomm-tools/bin/et-system-info | 32 +++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/overlay/etc/skel/.conkyrc b/overlay/etc/skel/.conkyrc index 1173e7d..54f6fdb 100644 --- a/overlay/etc/skel/.conkyrc +++ b/overlay/etc/skel/.conkyrc @@ -34,7 +34,7 @@ ${font DejaVu Sans:bold:size=10}${color #8d5133}${alignc}INTERFACES ${font DejaVu Sans Mono:size=11}${color yellow}Radio: ${execpi 10 et-system-info active-radio} CAT : ${execpi 10 et-system-info et-cat} GPS : ${execpi 10 et-system-info et-gps} -Audio: ${execpi 10 et-system-info et-audio} +Audio: ${execpi 10 et-system-info et-audio} ${execpi 10 et-system-info et-audio-card} ${font DejaVu Sans:bold:size=9}${color #805f4f}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release} ]]; diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index a4be451..19d0157 100755 --- a/overlay/opt/emcomm-tools/bin/et-system-info +++ b/overlay/opt/emcomm-tools/bin/et-system-info @@ -7,12 +7,13 @@ function usage() { echo "Usage: $(basename $0) " - echo " active-radio - Display model of active radio" - echo " et-audio - State of audio interface" - echo " et-cat - State of CAT control interface" - echo " et-gps - State of GPS interface" - echo " ip - System IP address" - echo " release - EmComm Tools release" + echo " active-radio - Display model of active radio" + echo " et-audio - Show state of audio interface" + echo " et-audio-card - Display audio card and device: ," + echo " et-cat - Show state of CAT control interface" + echo " et-gps - Show state of GPS interface" + echo " ip - System IP address" + echo " release - EmComm Tools release" } if [ $# -ne 1 ]; then @@ -44,6 +45,25 @@ case $1 in echo "Not connected" fi + ;; + et-audio-card) + + # 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}') + echo $AUDIO_CARD,$AUDIO_DEVICE + else + exit 1 + fi + else + exit 1 + fi + ;; et-cat) From 536ea8352c3a821d53fc6aeed88eb5e9f3e5215e Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Wed, 23 Oct 2024 15:45:41 -0700 Subject: [PATCH 06/16] Audio - Added udev rules for DigiRig Mobile and DigiRig Lite --- .../etc/udev/rules.d/90-et-digirig-lite.rules | 10 ++++++---- .../udev/rules.d/90-et-digirig-mobile.rules | 15 ++++++++------- overlay/opt/emcomm-tools/bin/et-system-info | 18 ++++++++++++++++-- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/overlay/etc/udev/rules.d/90-et-digirig-lite.rules b/overlay/etc/udev/rules.d/90-et-digirig-lite.rules index 7ef3a22..c5630df 100644 --- a/overlay/etc/udev/rules.d/90-et-digirig-lite.rules +++ b/overlay/etc/udev/rules.d/90-et-digirig-lite.rules @@ -1,13 +1,15 @@ -# Author : Gaston Gonzalez -# Date : 17 October 2024 -# Purpose : udev rules for the DigiRig Lite +# Author : Gaston Gonzalez +# Date : 17 October 2024 +# Updated : 21 October 2024 +# Purpose : udev rules for the DigiRig Lite # # Preconditions: # 1. DigiRig Lite connected via USB cable # # Postconditions: +# 1. /dev/et-audio created SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0012", ENV{ET_DEVICE}=="", \ ACTION=="add", \ ATTR{id}="ET_AUDIO", \ - ENV{ET_DEVICE}="DIGIRIG_LITE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="dialout", MODE="0660", SYMLINK+="et-audio" + ENV{ET_DEVICE}="DIGIRIG_LITE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" diff --git a/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules b/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules index 7c35b11..74a26ca 100644 --- a/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules +++ b/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules @@ -1,25 +1,26 @@ # Author : Gaston Gonzalez # Date : 30 September 2024 -# Updated : 11 October 2024 +# Updated : 23 October 2024 # Purpose : udev rules for the DigiRig Mobile v1.9 # # Preconditions: -# 1. DigiRig Mobile connected via USB cable +# 1. DigiRig Mobile connected via USB cable # 2. This rule is processed after the IC-7200 # # Postconditions: # 1. /dev/et-cat created # 2. rigctld is started -# +# 3. /dev/et-audio created -# The IC-7200 uses the same chipsset. In order to avoid incorrect detection, we will check -# for the presence of ET_DEVICE as the IC-7200 will set it as an earlier rule. With this -# approach, the DigiRig Mobile rules must be processed later in the chain. SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ET_DEVICE}=="", \ ACTION=="add", \ ENV{SYSTEMD_WANTS}="", \ ENV{ET_DEVICE}="DIGIRIG_MOBILE", ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \ RUN+="/usr/bin/systemctl start rigctld" +SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="013c", ENV{ET_DEVICE}=="", \ + ACTION=="add", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_DEVICE}="DIGIRIG_MOBILE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" + # TODO: Add rules for earlier 1.9 release -# TODO: Add rules for sound card diff --git a/overlay/opt/emcomm-tools/bin/et-system-info b/overlay/opt/emcomm-tools/bin/et-system-info index 19d0157..329bc4e 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 : 21 October 2024 +# Updated : 23 October 2024 # Purpose : Utility script for dumping system information function usage() { @@ -36,7 +36,21 @@ case $1 in UDEV_OUT=$(udevadm info /dev/et-audio | grep ET_DEVICE) if [ $? -eq 0 ]; then - udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2 + + # Display friendly audio device name + ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2) + case $ET_DEVICE in + "DIGIRIG_LITE") + echo "DigiRig Lite" + ;; + "DIGIRIG_MOBILE") + echo "DigiRig Mobile" + ;; + *) + echo $ET_DEVICE + ;; + esac + else echo "Connected" fi From c8c8bde4adc51f3f64d7e7a938b4f5d8a853c070 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Wed, 23 Oct 2024 16:30:30 -0700 Subject: [PATCH 07/16] Audio - Added udev rules for IC-705 --- overlay/etc/udev/rules.d/80-et-ic705.rules | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/overlay/etc/udev/rules.d/80-et-ic705.rules b/overlay/etc/udev/rules.d/80-et-ic705.rules index f24e1f7..73d534d 100644 --- a/overlay/etc/udev/rules.d/80-et-ic705.rules +++ b/overlay/etc/udev/rules.d/80-et-ic705.rules @@ -1,6 +1,6 @@ # Author : Gaston Gonzalez # Date : 28 September 2024 -# Updated : 14 October 2024 +# Updated : 21 October 2024 # Purpose : udev rules for the Icom IC-705 # # Preconditions: @@ -9,6 +9,7 @@ # Postconditions: # 1. /dev/et-cat created # 2. /dev/et-gps created +# 3. /dev/et-audio created # 3. rigctld is started # 4. gpsd is started # @@ -32,4 +33,7 @@ ENV{ET_DEVICE}=="IC-705", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="02", \ ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" -# TODO: Add rules for sound card +SUBSYSTEM=="sound", ATTRS{idVendor}=="08bb", ATTRS{idProduct}=="2901", ENV{ET_DEVICE}=="", \ + ACTION=="add", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_DEVICE}="IC-705", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" From 53c3eea9ade9833850ec8f82ecc11aa75d532361 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Wed, 23 Oct 2024 18:52:01 -0700 Subject: [PATCH 08/16] Audio - Added udev rules for IC-7200. Standardized on audio label for Icom radios. Need to confirm if the IC-7100 has the same sound card. --- overlay/etc/udev/rules.d/80-et-ic705.rules | 5 ++++- overlay/etc/udev/rules.d/81-et-ic7200.rules | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/overlay/etc/udev/rules.d/80-et-ic705.rules b/overlay/etc/udev/rules.d/80-et-ic705.rules index 73d534d..bbcadcc 100644 --- a/overlay/etc/udev/rules.d/80-et-ic705.rules +++ b/overlay/etc/udev/rules.d/80-et-ic705.rules @@ -33,7 +33,10 @@ ENV{ET_DEVICE}=="IC-705", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="02", \ ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" +# This rule generically matches the following Icom radios: +# 1. IC-705 +# 2. IC-7200 SUBSYSTEM=="sound", ATTRS{idVendor}=="08bb", ATTRS{idProduct}=="2901", ENV{ET_DEVICE}=="", \ ACTION=="add", \ ATTR{id}="ET_AUDIO", \ - ENV{ET_DEVICE}="IC-705", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" + ENV{ET_DEVICE}="Icom generic", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" diff --git a/overlay/etc/udev/rules.d/81-et-ic7200.rules b/overlay/etc/udev/rules.d/81-et-ic7200.rules index 7669c9c..aa80239 100644 --- a/overlay/etc/udev/rules.d/81-et-ic7200.rules +++ b/overlay/etc/udev/rules.d/81-et-ic7200.rules @@ -1,6 +1,6 @@ # Author : Gaston Gonzalez # Date : 29 September 2024 -# Updated : 14 October 2024 +# Updated : 21 October 2024 # Purpose : udev rules for the Icom IC-7200 # # Preconditions: @@ -8,7 +8,8 @@ # # Postconditions: # 1. /dev/et-cat created -# 2. rigctld started +# 2. /dev/et-audio created +# 3. rigctld started KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty", ATTRS{serial}=="IC-7200*", \ ENV{ET_DEVICE}="IC-7200" @@ -21,4 +22,10 @@ ENV{ET_DEVICE}=="IC-7200", SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4" ATTRS{idPr ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \ RUN+="/usr/bin/systemctl start rigctld" -# TODO: Add rules for sound card +# This rule generically matches the following Icom radios: +# 1. IC-705 +# 2. IC-7200 +SUBSYSTEM=="sound", ATTRS{idVendor}=="08bb", ATTRS{idProduct}=="2901", ENV{ET_DEVICE}=="", \ + ACTION=="add", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_DEVICE}="Icom generic", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" From 2999053b808606d2bf685a8199b62c7114ed3d31 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 05:11:35 -0700 Subject: [PATCH 09/16] Updated license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index fe05cdf..abf30d6 100644 --- a/LICENSE +++ b/LICENSE @@ -29,7 +29,7 @@ you agree to the following terms and conditions: rights not expressly granted are reserved by The Tech Prepper LLC. For any inquiries regarding commercial use, modification, or other -permissions, please contact [Your Contact Information]. +permissions, please contact The Tech Prepper LLC. The Tech Prepper LLC info@thetechprepper.com From 15aae94fe846b6d45caa094bb0e742e57674be3d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 05:30:51 -0700 Subject: [PATCH 10/16] PnP - Updated et-radio to support a 'no radio' mode --- overlay/opt/emcomm-tools/bin/et-radio | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-radio b/overlay/opt/emcomm-tools/bin/et-radio index 6b03977..e8e10d1 100755 --- a/overlay/opt/emcomm-tools/bin/et-radio +++ b/overlay/opt/emcomm-tools/bin/et-radio @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 11 October 2024 -# Updated : 16 October 2024 +# Updated : 24 October 2024 # Purpose : A script for managaing plug-and-play radios set -e @@ -36,7 +36,10 @@ case $1 in ;; set) + NO_RADIO_ID="no-radio" + options=() + options+=("${NO_RADIO_ID}" "No radio") while IFS= read -r radio; do ID=$(cat $radio | jq -r .id) VENDOR=$(cat $radio | jq -r .vendor) @@ -45,17 +48,25 @@ case $1 in options+=("$ID" "$VENDOR $MODEL") done < <(find $ET_HOME/conf/radios.d -type f | sort) - selected_radio=$(dialog --clear --menu "Select a radio:" 15 50 10 "${options[@]}" 3>&1 1>&2 2>&3) + SELECTED_RADIO=$(dialog --clear --menu "Select a radio:" 15 50 10 "${options[@]}" 3>&1 1>&2 2>&3) exit_status=$? # Reset terminal to its original state - clear && tput sgr0 + clear && tput sgr0 if [ $exit_status -eq 0 ]; then - RADIO_CONF="${ET_HOME}/conf/radios.d/$selected_radio.json" + + # Special case to run without a radio configured + if [ ${SELECTED_RADIO} == ${NO_RADIO_ID} ]; then + [ -e ${ACTIVE_RADIO} ] && rm ${ACTIVE_RADIO} + echo "Set active radio to: $SELECTED_RADIO" + exit 0 + fi + + RADIO_CONF="${ET_HOME}/conf/radios.d/$SELECTED_RADIO.json" [ -e ${ACTIVE_RADIO} ] && rm ${ACTIVE_RADIO} ln -s ${RADIO_CONF} ${ACTIVE_RADIO} - echo "Set active radio to: $selected_radio" + echo "Set active radio to: $SELECTED_RADIO" else echo "No radio selected." fi @@ -64,7 +75,7 @@ case $1 in active) if [ ! -L "${ACTIVE_RADIO}" ]; then - echo "No active radio defined. Run: '$(basename $0) set '" + echo "No active radio defined. Run: '$(basename $0) set'" exit 1 fi From d831500c411e45fc119e1c02de0af92c25fd7d28 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 08:31:57 -0700 Subject: [PATCH 11/16] Audio - Added dummy rig control support for the DigiRig Lite to maintain the rigctl NET interface consistently for all radio-based applications --- .../udev/rules.d/79-et-generic-remove.rules | 8 ++++++- .../etc/udev/rules.d/90-et-digirig-lite.rules | 15 ------------- .../etc/udev/rules.d/91-et-digirig-lite.rules | 21 +++++++++++++++++++ ...{91-et-u-blox.rules => 92-et-u-blox.rules} | 0 overlay/lib/systemd/system/rigctld.service | 2 +- .../conf/radios.d/generic-vox.json | 11 ++++++++++ .../opt/emcomm-tools/sbin/wrapper-rigctld.sh | 21 ++++++++++++++++++- 7 files changed, 60 insertions(+), 18 deletions(-) delete mode 100644 overlay/etc/udev/rules.d/90-et-digirig-lite.rules create mode 100644 overlay/etc/udev/rules.d/91-et-digirig-lite.rules rename overlay/etc/udev/rules.d/{91-et-u-blox.rules => 92-et-u-blox.rules} (100%) create mode 100644 overlay/opt/emcomm-tools/conf/radios.d/generic-vox.json diff --git a/overlay/etc/udev/rules.d/79-et-generic-remove.rules b/overlay/etc/udev/rules.d/79-et-generic-remove.rules index d57933f..c9fa748 100644 --- a/overlay/etc/udev/rules.d/79-et-generic-remove.rules +++ b/overlay/etc/udev/rules.d/79-et-generic-remove.rules @@ -1,9 +1,10 @@ # Author : Gaston Gonzalez # Date : 14 October 2024 +# Updated : 24 October 2024 # Purpose : udev rules for generic remove events # # Preconditions: -# 1. CAT control device is unplugged +# 1. CAT control device (or DigiRig Lite) is unplugged # # Postconditions: # 1. rigctld is stopped @@ -11,3 +12,8 @@ SUBSYSTEM=="tty", ENV{ET_SUBDEVICE}=="CAT", \ ACTION=="remove", \ RUN+="/opt/emcomm-tools/sbin/wrapper-rigctld.sh stop" + + +SUBSYSTEM=="sound",ENV{ET_SUBDEVICE}=="AUDIO", \ + ACTION=="remove", \ + RUN+="/opt/emcomm-tools/sbin/wrapper-rigctld.sh stop" diff --git a/overlay/etc/udev/rules.d/90-et-digirig-lite.rules b/overlay/etc/udev/rules.d/90-et-digirig-lite.rules deleted file mode 100644 index c5630df..0000000 --- a/overlay/etc/udev/rules.d/90-et-digirig-lite.rules +++ /dev/null @@ -1,15 +0,0 @@ -# Author : Gaston Gonzalez -# Date : 17 October 2024 -# Updated : 21 October 2024 -# Purpose : udev rules for the DigiRig Lite -# -# Preconditions: -# 1. DigiRig Lite connected via USB cable -# -# Postconditions: -# 1. /dev/et-audio created - -SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0012", ENV{ET_DEVICE}=="", \ - ACTION=="add", \ - ATTR{id}="ET_AUDIO", \ - ENV{ET_DEVICE}="DIGIRIG_LITE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" diff --git a/overlay/etc/udev/rules.d/91-et-digirig-lite.rules b/overlay/etc/udev/rules.d/91-et-digirig-lite.rules new file mode 100644 index 0000000..75d61e5 --- /dev/null +++ b/overlay/etc/udev/rules.d/91-et-digirig-lite.rules @@ -0,0 +1,21 @@ +# Author : Gaston Gonzalez +# Date : 17 October 2024 +# Updated : 24 October 2024 +# Purpose : udev rules for the DigiRig Lite +# +# Preconditions: +# 1. The radio is set to 'generic-vox' using et-radio. +# 2. DigiRig Lite connected via USB cable +# +# Postconditions: +# 1. /dev/et-audio created +# 2. rigctld is started + +# The DigiRig Lite has no CAT control, but rigctld is started to minimize the configuration needed +# by the various amateur radio applications. EmComm Tools treats rigctl NET as its abstraction layer. +# A dummy rig control configuration is specifed in the 'generic-vox' radio configuration. +SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0012", ENV{ET_DEVICE}=="", \ + ACTION=="add", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_DEVICE}="DIGIRIG_LITE", ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" \ + RUN+="/usr/bin/systemctl start rigctld" diff --git a/overlay/etc/udev/rules.d/91-et-u-blox.rules b/overlay/etc/udev/rules.d/92-et-u-blox.rules similarity index 100% rename from overlay/etc/udev/rules.d/91-et-u-blox.rules rename to overlay/etc/udev/rules.d/92-et-u-blox.rules diff --git a/overlay/lib/systemd/system/rigctld.service b/overlay/lib/systemd/system/rigctld.service index dd81b8a..2c1ba9d 100644 --- a/overlay/lib/systemd/system/rigctld.service +++ b/overlay/lib/systemd/system/rigctld.service @@ -1,6 +1,6 @@ [Unit] Description=Rig Control Service -ConditionPathExists=/dev/et-cat +#ConditionPathExists=/dev/et-cat After=multi-user.target [Service] diff --git a/overlay/opt/emcomm-tools/conf/radios.d/generic-vox.json b/overlay/opt/emcomm-tools/conf/radios.d/generic-vox.json new file mode 100644 index 0000000..6869810 --- /dev/null +++ b/overlay/opt/emcomm-tools/conf/radios.d/generic-vox.json @@ -0,0 +1,11 @@ +{ + "id": "generic-vox", + "vendor": "Generic", + "model": "VOX", + "rigctrl": { + "id": "1", + "ptt": "NONE" + }, + "notes": [ + ] +} diff --git a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh index 50eea1b..d403f48 100755 --- a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh +++ b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh @@ -2,6 +2,7 @@ # # Author : Gaston Gonzalez # Date : 9 October 2024 +# Updated : 24 October 2024 # Purpose : Wrapper startup/shutdown script around systemd/rigctld ET_HOME=/opt/emcomm-tools @@ -27,6 +28,24 @@ do_full_auto() { } start() { + + # Special case for VOX devices like the DigiRig Lite. + if [ -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then + CUR_RADIO=$(cat "${ET_HOME}/conf/radios.d/active-radio.json" | jq -r .model) + if [ "${CUR_RADIO}" = "VOX" ]; then + et-log "Starting dummy rigctld service for VOX device." + + ID=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.id) + PTT=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.ptt) + + CMD="rigctld -m ${ID} -P ${PTT} " + et-log "Starting rigctld with: ${CMD}" + $CMD + + exit 0 + fi + fi + if [ ! -e ${CAT_DEVICE} ]; then et-log "No CAT device found. ${CAT_DEVICE} symlink is missing." exit 1 @@ -58,7 +77,7 @@ start() { } stop() { - et-log "Stopping rigctld service..." + et-log "Stopping rigctld service..." systemctl stop rigctld if [ -L /dev/et-cat ]; then From 2988c68daf480ea72c8676566dbc89c3f6685bab Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 11:20:50 -0700 Subject: [PATCH 12/16] Audio - Initial work on JS8Call audio PnP configuration --- overlay/opt/emcomm-tools/bin/et-js8 | 82 +++++++++++++++++++ .../usr/share/applications/js8call.desktop | 11 +++ scripts/install-js8call.sh | 5 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100755 overlay/opt/emcomm-tools/bin/et-js8 create mode 100644 overlay/usr/share/applications/js8call.desktop diff --git a/overlay/opt/emcomm-tools/bin/et-js8 b/overlay/opt/emcomm-tools/bin/et-js8 new file mode 100755 index 0000000..2f60ee9 --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-js8 @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 24 October 2024 +# Purpose : Wrapper script for starting JS8Call with PnP support +# +# Preconditions +# 1. Support radio and audio interface are connected and properly detected +# +# Postconditions +# 1. JS8Call is started with audio settings updated + +usage() { + echo "usage: $(basename $0) " + echo " start - Update config and start JS8Call" + echo " update-config - Update config" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +start() { + echo "Not yet implemented" +} + +update-config () { + + JS8CALL_CONF_FILE="${HOME}/.config/JS8Call.ini" + + # 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_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') + JS8_AUDIO_DEVICE="plughw:CARD=ET_AUDIO,DEV=${AUDIO_DEVICE}" + et-log "Using '${JS8_AUDIO_DEVICE}' for JS8Call configuration." + + # 3. Check for existing JS8Call sound configuration + + ## Update input + grep "^SoundInName" ${JS8CALL_CONF_FILE} + if [ $? -eq 0 ]; then + sed -i 's|^SoundInName.*|SoundInName=plughw:CARD=ET_AUDIO,DEV=0|' ${JS8CALL_CONF_FILE} + else + echo "SoundInName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} + fi + + ## Update output + grep "^SoundOutName" ${JS8CALL_CONF_FILE} + if [ $? -eq 0 ]; then + sed -i 's|^SoundOutName.*|SoundOutName=plughw:CARD=ET_AUDIO,DEV=0|' ${JS8CALL_CONF_FILE} + else + echo "SoundOutName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} + fi + + else + et-log "No ET_AUDIO device detected." + exit 1 + fi + else + et-log "No ET_AUDIO device plugged in." + exit 1 + fi +} + +case $1 in + start) + start + ;; + update-config) + update-config + ;; + *) + echo "Invalid command." + usage + exit 1 + ;; +esac diff --git a/overlay/usr/share/applications/js8call.desktop b/overlay/usr/share/applications/js8call.desktop new file mode 100644 index 0000000..09a7e82 --- /dev/null +++ b/overlay/usr/share/applications/js8call.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Name=js8call +Comment=Amateur Radio Weak Signal Operating +Exec=js8call +Icon=js8call_icon +Terminal=false +X-MultipleArgs=false +Type=Application +Categories=AudioVideo;Audio;HamRadio; +StartupNotify=true diff --git a/scripts/install-js8call.sh b/scripts/install-js8call.sh index d45f4b1..9bda5b1 100755 --- a/scripts/install-js8call.sh +++ b/scripts/install-js8call.sh @@ -1,7 +1,7 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 6 April 2023 -# Updated : 19 May 2024 +# Updated : 24 October 2024 # Purpose : Install JS8Call set -e trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG @@ -52,3 +52,6 @@ else fi dpkg -i $ET_DIST_DIR/$FILE + +et-log "Updating JS8Call launcher icon to support PNP..." +cp -v ../overlay/usr/share/applications/js8call.desktop /usr/share/applications/ From 29a1bf3ae17c55f2cbc1eb636b426b288a4b4de6 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 11:51:42 -0700 Subject: [PATCH 13/16] Audio - Updated et-js8 wrapper to replace audio properties with env var --- overlay/opt/emcomm-tools/bin/et-js8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-js8 b/overlay/opt/emcomm-tools/bin/et-js8 index 2f60ee9..296db9e 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8 +++ b/overlay/opt/emcomm-tools/bin/et-js8 @@ -44,7 +44,7 @@ update-config () { ## Update input grep "^SoundInName" ${JS8CALL_CONF_FILE} if [ $? -eq 0 ]; then - sed -i 's|^SoundInName.*|SoundInName=plughw:CARD=ET_AUDIO,DEV=0|' ${JS8CALL_CONF_FILE} + sed -i "s|^SoundInName.*|SoundInName=${JS8_AUDIO_DEVICE}|" ${JS8CALL_CONF_FILE} else echo "SoundInName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} fi @@ -52,7 +52,7 @@ update-config () { ## Update output grep "^SoundOutName" ${JS8CALL_CONF_FILE} if [ $? -eq 0 ]; then - sed -i 's|^SoundOutName.*|SoundOutName=plughw:CARD=ET_AUDIO,DEV=0|' ${JS8CALL_CONF_FILE} + sed -i "s|^SoundOutName.*|SoundOutName=${JS8_AUDIO_DEVICE}|" ${JS8CALL_CONF_FILE} else echo "SoundOutName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} fi From 411881a1cb89f35be84ad188eea0afb72477059d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 12:56:40 -0700 Subject: [PATCH 14/16] Audio - Fixed bug preventing JS8Call audio input and output devices from getting used following an update by et-js8call --- overlay/opt/emcomm-tools/bin/et-js8 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overlay/opt/emcomm-tools/bin/et-js8 b/overlay/opt/emcomm-tools/bin/et-js8 index 296db9e..4eb4eaa 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8 +++ b/overlay/opt/emcomm-tools/bin/et-js8 @@ -44,17 +44,17 @@ update-config () { ## Update input grep "^SoundInName" ${JS8CALL_CONF_FILE} if [ $? -eq 0 ]; then - sed -i "s|^SoundInName.*|SoundInName=${JS8_AUDIO_DEVICE}|" ${JS8CALL_CONF_FILE} + sed -i "s|^SoundInName.*|SoundInName=\"${JS8_AUDIO_DEVICE}\"|" ${JS8CALL_CONF_FILE} else - echo "SoundInName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} + echo "SoundInName=\"${JS8_AUDIO_DEVICE}\"" >> ${JS8CALL_CONF_FILE} fi ## Update output grep "^SoundOutName" ${JS8CALL_CONF_FILE} if [ $? -eq 0 ]; then - sed -i "s|^SoundOutName.*|SoundOutName=${JS8_AUDIO_DEVICE}|" ${JS8CALL_CONF_FILE} + sed -i "s|^SoundOutName.*|SoundOutName=\"${JS8_AUDIO_DEVICE}\"|" ${JS8CALL_CONF_FILE} else - echo "SoundOutName=${JS8_AUDIO_DEVICE}" >> ${JS8CALL_CONF_FILE} + echo "SoundOutName=\"${JS8_AUDIO_DEVICE}\"" >> ${JS8CALL_CONF_FILE} fi else From c9dc150e401629bc87dc07501d6111644116958d Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 13:00:37 -0700 Subject: [PATCH 15/16] JS8Call - Renamed et-js8 command to et-js8call and implemented start command --- overlay/opt/emcomm-tools/bin/{et-js8 => et-js8call} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename overlay/opt/emcomm-tools/bin/{et-js8 => et-js8call} (98%) diff --git a/overlay/opt/emcomm-tools/bin/et-js8 b/overlay/opt/emcomm-tools/bin/et-js8call similarity index 98% rename from overlay/opt/emcomm-tools/bin/et-js8 rename to overlay/opt/emcomm-tools/bin/et-js8call index 4eb4eaa..c784270 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8 +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -22,7 +22,7 @@ if [ $# -ne 1 ]; then fi start() { - echo "Not yet implemented" + update-config && /usr/bin/js8call & } update-config () { From 504780bcf825e8d77a0ed76b1d5dcf7b94f90739 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 13:08:06 -0700 Subject: [PATCH 16/16] JS8Call - Updated JS8Call launcher to use Emcomm Tools PnP wrapper (et-js8call) --- overlay/usr/share/applications/js8call.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/usr/share/applications/js8call.desktop b/overlay/usr/share/applications/js8call.desktop index 09a7e82..476608a 100644 --- a/overlay/usr/share/applications/js8call.desktop +++ b/overlay/usr/share/applications/js8call.desktop @@ -2,7 +2,7 @@ Version=1.0 Name=js8call Comment=Amateur Radio Weak Signal Operating -Exec=js8call +Exec=/opt/emcomm-tools/bin/et-js8call start Icon=js8call_icon Terminal=false X-MultipleArgs=false