From d831500c411e45fc119e1c02de0af92c25fd7d28 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 24 Oct 2024 08:31:57 -0700 Subject: [PATCH] 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