From b9a212543ad7493bce479124b429393bd4b2f5a9 Mon Sep 17 00:00:00 2001 From: thetechprepper Date: Sat, 31 May 2025 04:20:21 -0700 Subject: [PATCH] FTX-1 - Added initial PNP support for the Yaesu FTX-1 Field; Disablled brltty udev rules --- overlay/etc/udev/rules.d/78-et-ftx1.rules | 38 +++++++++++++++++++ overlay/etc/udev/rules.d/85-brltty.rules | 5 +++ overlay/opt/emcomm-tools/bin/et-js8call | 28 +++++++++++++- .../conf/radios.d/yaesu-ftx1.json | 20 ++++++++++ overlay/opt/emcomm-tools/sbin/udev-tester.sh | 19 +++++++++- .../opt/emcomm-tools/sbin/wrapper-rigctld.sh | 17 +++++++-- 6 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 overlay/etc/udev/rules.d/78-et-ftx1.rules create mode 100644 overlay/etc/udev/rules.d/85-brltty.rules create mode 100644 overlay/opt/emcomm-tools/conf/radios.d/yaesu-ftx1.json diff --git a/overlay/etc/udev/rules.d/78-et-ftx1.rules b/overlay/etc/udev/rules.d/78-et-ftx1.rules new file mode 100644 index 0000000..b33cb23 --- /dev/null +++ b/overlay/etc/udev/rules.d/78-et-ftx1.rules @@ -0,0 +1,38 @@ +# Author : Gaston Gonzalez +# Date : 21 May 2025 +# Updated : 16 May 2025 +# Purpose : udev rules for the Yaesu FTX-1 via USB-C +# +# Preconditions: +# 1. Yaesu FTX-1 is selected via et-radio +# 2. Yaesu FTX-1 is connected via USB-C cable +# +# Postconditions: +# 1. /dev/et-cat created +# 2. /dev/et-audio created +# 3. rigctld is started +# +# Note: As of 05/21/25 Yaesu has not published their CAT control command specification. This is a +# temporary integration that does not include CAT control support. It will only key the PTT +# and provide audio in/out. You MUST set the frequency and mode yourself. + +# Special rule to ensure that the second serial interface (/dev/ttyUSB5) is tagged as ET_DEVICE=FTX-1 so +# that it can be used in the next CAT control rule. +KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty", PROGRAM="/opt/emcomm-tools/sbin/udev-tester.sh yaesu-ftx1", \ + ATTRS{bInterfaceNumber}=="01", \ + ENV{ET_DEVICE}="FTX-1" + +# CAT control device will only match if PROGRAM above matches (exit status=0) +SUBSYSTEM=="tty", ENV{ET_DEVICE}=="FTX-1", \ + ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea70",\ + ACTION=="add", \ + ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \ + RUN+="/usr/bin/systemctl start rigctld" + +# Audio device will only match if PROGRAM above matches (exit status=0) +SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="0016", \ + PROGRAM="/opt/emcomm-tools/sbin/udev-tester.sh yaesu-ftx1", \ + ACTION=="add", \ + ENV{ET_DEVICE}="FTX-1", \ + ATTR{id}="ET_AUDIO", \ + ENV{ET_SUBDEVICE}="AUDIO", GROUP="audio", MODE="0660", SYMLINK+="et-audio" diff --git a/overlay/etc/udev/rules.d/85-brltty.rules b/overlay/etc/udev/rules.d/85-brltty.rules new file mode 100644 index 0000000..043452d --- /dev/null +++ b/overlay/etc/udev/rules.d/85-brltty.rules @@ -0,0 +1,5 @@ +# Author : Gaston Gonzalez +# Date : 31 May 2025 +# Purpose : Empty udev rule to prevent the BRLTTY subsystem from +# invoking /lib/udev/rules.d/85-brltty.rules. These rules +# hijacking many USB devices used by ETC. diff --git a/overlay/opt/emcomm-tools/bin/et-js8call b/overlay/opt/emcomm-tools/bin/et-js8call index 9f5783b..d0d002f 100755 --- a/overlay/opt/emcomm-tools/bin/et-js8call +++ b/overlay/opt/emcomm-tools/bin/et-js8call @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 24 October 2024 -# Updated : 20 November 2024 +# Updated : 26 May 2025 # Purpose : Wrapper script for starting JS8Call with PnP support # # Preconditions @@ -13,6 +13,10 @@ # 2. JS8Call audio settings updated # 3. JS8Call started +ET_HOME=/opt/emcomm-tools +ACTIVE_RADIO="${ET_HOME}/conf/radios.d/active-radio.json" +CAT_DEVICE=/dev/et-cat + usage() { echo "usage: $(basename $0) " echo " start - Update config and start JS8Call" @@ -63,6 +67,28 @@ update-config () { ET_RELEASE=$(et-system-info release) sed -i "s|^MyInfo.*|MyInfo=${ET_RELEASE}|" ${JS8CALL_CONF_FILE} + + # Set PTT to use Hamlib for both CAT control and PTT (default) + sed -i "s|^PTTport.*|PTTport=localhost:4532|" ${JS8CALL_CONF_FILE} + sed -i "s|PTT_method_[A-Z][A-Z][A-Z]|PTT_method_CAT|" ${JS8CALL_CONF_FILE} + + # Special case for select radios that only need to key the PTT, but do not + # have CAT control support or VOX support. This edge case was added for + # radios like the Yaesu FTX-1 Field before Yaesu published their CAT commands. + if [ -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then + RIG_ID=$(cat "${ET_HOME}/conf/radios.d/active-radio.json" | jq -r .rigctrl.id) + + if [ "${RIG_ID}" = "1" ]; then + PTT_ONLY=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.pttOnly) + + if [ "${PTT_ONLY}" = "true" ]; then + et-log "Configued JS8Call for PTT-only mode" + sed -i "s|PTT_method_[A-Z][A-Z][A-Z]|PTT_method_RTS|" ${JS8CALL_CONF_FILE} + sed -i "s|^PTTport.*|PTTport=/dev/et-cat|" ${JS8CALL_CONF_FILE} + fi + fi + fi + et-log "Updated JS8Call configuration with user callsign '${CALLSIGN}' and grid: '${GRID}'" # 1. Check if the symlink was created by the udev rules diff --git a/overlay/opt/emcomm-tools/conf/radios.d/yaesu-ftx1.json b/overlay/opt/emcomm-tools/conf/radios.d/yaesu-ftx1.json new file mode 100644 index 0000000..9fb516b --- /dev/null +++ b/overlay/opt/emcomm-tools/conf/radios.d/yaesu-ftx1.json @@ -0,0 +1,20 @@ +{ + "id": "yaesu-ftx1", + "vendor": "Yaesu", + "model": "FTX-1 (No CAT)", + "rigctrl": { + "id": "1", + "baud": "38400", + "ptt": "RTS", + "pttOnly": "true" + }, + "notes": [ + "Tune radio to desired frequency.", + "Long press [MODE] and set desired mode.", + "Use 'DATA-U' for most HF operation", + "Use 'TODO' for FM packet operation", + "Under MODE, long press 'PRESET' and select FT8" + ], + "fieldNotes": [ + ] +} diff --git a/overlay/opt/emcomm-tools/sbin/udev-tester.sh b/overlay/opt/emcomm-tools/sbin/udev-tester.sh index 28565b4..9f60211 100755 --- a/overlay/opt/emcomm-tools/sbin/udev-tester.sh +++ b/overlay/opt/emcomm-tools/sbin/udev-tester.sh @@ -1,7 +1,7 @@ #!/bin/bash # Author : Gaston Gonzalez # Date : 11 October 2024 -# Updated : 8 December 2024 +# Updated : 21 May 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. @@ -13,6 +13,20 @@ ET_HOME=/opt/emcomm-tools ACTIVE_RADIO="${ET_HOME}/conf/radios.d/active-radio.json" +# Exit with a 0 exit status if, and only if, the currently selected radio is +# a Yaesu FTX-1. +test_yaesu_ftx1() { + 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" == "yaesu-ftx1" ]]; then + exit 0 + fi + fi + + exit 1 +} + # Exit with a 0 exit status if, and only if, the currently selected radio is # a Yaesu FT-891. test_yaesu_ft891() { @@ -82,6 +96,9 @@ if [ $# -ne 1 ]; then fi case $1 in + yaesu-ftx1) + test_yaesu_ftx1 + ;; yaesu-ft891) test_yaesu_ft891 ;; diff --git a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh index 165a638..1c1b9ab 100755 --- a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh +++ b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 9 October 2024 -# Updated : 28 October 2024 +# Updated : 31 May 2025 # Purpose : Wrapper startup/shutdown script around systemd/rigctld ET_HOME=/opt/emcomm-tools @@ -41,8 +41,19 @@ start() { 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 in VOX mode with: ${CMD}" + # Special case for select radios that only need to key the PTT, but do + # do not have CAT control support. This edge case was added for radios + # like the Yaesu FTX-1 Field before Yaesu published their CAT commands. + PTT_ONLY=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.pttOnly) + + if [ "${PTT_ONLY}" = "true" ]; then + CMD="rigctld -m ${ID} -p ${CAT_DEVICE} -P ${PTT} " + et-log "Starting rigctld in PTT-only mode with: ${CMD}" + else + CMD="rigctld -m ${ID} -P ${PTT} " + et-log "Starting rigctld in VOX mode with: ${CMD}" + fi + $CMD exit 0 fi