From 66051d66611df72399733dcb0fb89108cdca0721 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Thu, 10 Oct 2024 07:10:46 -0700 Subject: [PATCH] PnP - Corrected multiple issues preventing the IC-705 from going through multiple un-plug and plug-in events: 1) Replaced add event with systemd rigcltd start; 2) Fixed incorrect wrapper script call to the GPS add rule; 3) Replaced the remove event script the rigctld wrapper' 4) Implemented the remove function in the rigctld wrapper --- overlay/etc/udev/rules.d/80-et-ic705.rules | 13 +++++++++---- overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh | 8 +++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/overlay/etc/udev/rules.d/80-et-ic705.rules b/overlay/etc/udev/rules.d/80-et-ic705.rules index 1cf4aa5..4420090 100644 --- a/overlay/etc/udev/rules.d/80-et-ic705.rules +++ b/overlay/etc/udev/rules.d/80-et-ic705.rules @@ -10,6 +10,7 @@ # 1. /dev/et-cat created # 2. /dev/et-gps created # 3. rigctld is started +# 4. gpsd is started # # Resources # - https://www.florian-wolters.de/posts/ic705-serial-device-symlinks/ @@ -23,15 +24,19 @@ KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{product}=="IC-705", \ ENV{ET_DEVICE}=="IC-705", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="00", \ ACTION=="add", \ ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \ - RUN+="/opt/emcomm-tools/sbin/wrapper-rigtctld.sh start" + RUN+="/usr/bin/systemctl start rigctld" # Create consistent device name/path for the GPS serial device ENV{ET_DEVICE}=="IC-705", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="02", \ ACTION=="add", \ ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ - RUN+="/usr/bin/systemctl start rigctld" + RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" -# TODO make more specific -SUBSYSTEM=="tty", ACTION=="remove", RUN+="/usr/bin/systemctl stop rigctld" +# TODO: Make this rule more specific +# +# If we do not stop rigctld, the rigctl progress will continue to run and maintain +# a stale reference to /dev/et-cat. This condition will prevent subsequent attach +# and detatch events of the radio from working. +SUBSYSTEM=="tty", ACTION=="remove", RUN+="/opt/emcomm-tools/sbin/wrapper-rigctld.sh stop" # TODO: Add rules for sound card diff --git a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh index b4507a8..50eea1b 100755 --- a/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh +++ b/overlay/opt/emcomm-tools/sbin/wrapper-rigctld.sh @@ -58,7 +58,13 @@ start() { } stop() { - et-log "Not implemented yet" + et-log "Stopping rigctld service..." + systemctl stop rigctld + + if [ -L /dev/et-cat ]; then + et-log "Removing stale /dev/et-cat symlink" + rm -f /dev/et-cat + fi } usage() {