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 74a26ca..f36780e 100644 --- a/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules +++ b/overlay/etc/udev/rules.d/90-et-digirig-mobile.rules @@ -1,6 +1,6 @@ # Author : Gaston Gonzalez # Date : 30 September 2024 -# Updated : 23 October 2024 +# Updated : 21 November 2024 # Purpose : udev rules for the DigiRig Mobile v1.9 # # Preconditions: @@ -18,9 +18,18 @@ SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ET_DEVI ENV{ET_DEVICE}="DIGIRIG_MOBILE", ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \ RUN+="/usr/bin/systemctl start rigctld" +# The audio chipset changed for DigiRig v1.9. This rule handles the original revision. +# Audio device will only match if PROGRAM above matches (exit status=0) +SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0012", \ + PROGRAM="/opt/emcomm-tools/sbin/udev-tester.sh digirig-mobile", \ + ACTION=="add", \ + ENV{ET_DEVICE}="DIGIRIG_MOBILE", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" + + 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 diff --git a/overlay/opt/emcomm-tools/sbin/udev-tester.sh b/overlay/opt/emcomm-tools/sbin/udev-tester.sh index 781c92a..878ee0e 100755 --- a/overlay/opt/emcomm-tools/sbin/udev-tester.sh +++ b/overlay/opt/emcomm-tools/sbin/udev-tester.sh @@ -1,6 +1,7 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 11 October 2024 +# Updated : 21 November 2024 # 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. @@ -26,6 +27,37 @@ test_yaesu_ft891() { exit 1 } +# Exit with a 0 exit success if, and only if, the currently selected radio +# uses a DigiRig Mobile. +test_digirig_mobile() { + if [ -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then + ID=$(cat "${ET_HOME}/conf/radios.d/active-radio.json" | jq -r .id) + + if [[ "$ID" == "digirig-mobile-no-cat" ]]; then + et-log "Old DigiRig Mobile detected for no CAT device" + exit 0 + fi + + if [[ "$ID" == "yaesu-ft818nd" ]]; then + et-log "Old DigiRig Mobile detected for FT-818ND" + exit 0 + fi + + if [[ "$ID" == "yaesu-ft857d" ]]; then + et-log "Old DigiRig Mobile detected for FT-857D" + exit 0 + fi + + if [[ "$ID" == "yaesu-ft897d" ]]; then + et-log "Old DigiRig Mobile detected for FT-897D" + exit 0 + fi + + fi + + exit 1 +} + usage() { echo "usage: $(basename $0) " } @@ -39,6 +71,8 @@ case $1 in yaesu-ft891) test_yaesu_ft891 ;; + digirig-mobile) + test_digirig_mobile esac exit 1