From 4c2f3a77a95a646385c90385dc673d1aa65e86c1 Mon Sep 17 00:00:00 2001 From: Gaston Gonzalez Date: Mon, 14 Oct 2024 09:06:37 -0700 Subject: [PATCH] PnP - Refactored CAT control remove eventing. A generic rule now is responsible for stopping rig control for all EmComm Tools CAT devices. --- overlay/etc/udev/rules.d/79-et-generic-remove.rules | 13 +++++++++++++ overlay/etc/udev/rules.d/80-et-ic705.rules | 9 +-------- overlay/etc/udev/rules.d/82-et-ic7100.rules | 5 ++--- overlay/lib/systemd/system/rigctld.service | 3 +-- 4 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 overlay/etc/udev/rules.d/79-et-generic-remove.rules diff --git a/overlay/etc/udev/rules.d/79-et-generic-remove.rules b/overlay/etc/udev/rules.d/79-et-generic-remove.rules new file mode 100644 index 0000000..d57933f --- /dev/null +++ b/overlay/etc/udev/rules.d/79-et-generic-remove.rules @@ -0,0 +1,13 @@ +# Author : Gaston Gonzalez +# Date : 14 October 2024 +# Purpose : udev rules for generic remove events +# +# Preconditions: +# 1. CAT control device is unplugged +# +# Postconditions: +# 1. rigctld is stopped + +SUBSYSTEM=="tty", ENV{ET_SUBDEVICE}=="CAT", \ + ACTION=="remove", \ + RUN+="/opt/emcomm-tools/sbin/wrapper-rigctld.sh stop" diff --git a/overlay/etc/udev/rules.d/80-et-ic705.rules b/overlay/etc/udev/rules.d/80-et-ic705.rules index 4420090..f24e1f7 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 : 10 October 2024 +# Updated : 14 October 2024 # Purpose : udev rules for the Icom IC-705 # # Preconditions: @@ -32,11 +32,4 @@ 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: 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/etc/udev/rules.d/82-et-ic7100.rules b/overlay/etc/udev/rules.d/82-et-ic7100.rules index 18ce013..04af20b 100644 --- a/overlay/etc/udev/rules.d/82-et-ic7100.rules +++ b/overlay/etc/udev/rules.d/82-et-ic7100.rules @@ -1,13 +1,13 @@ # Author : Gaston Gonzalez # Author : William McKeehan (https://github.com/mckeehan) # Date : 30 September 2024 -# Updated : 12 October 2024 +# Updated : 14 October 2024 # Purpose : udev rules for the Icom IC-7100 # # Preconditions: # 1. TODO: Document GPS settings for IC-7100 (Mike KC8OWL) # 2. GPS antenna connected to IC-7100 -# 3. IC-7200 connected via USB cable +# 3. IC-7100 connected via USB cable # # Postconditions: # 1. /dev/et-cat created @@ -31,5 +31,4 @@ ENV{ET_DEVICE}=="IC-7100", SUBSYSTEMS=="usb", ATTRS{serial}=="IC-7100*B", \ ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" -# TODO: Add rules for ACTION="remove" # TODO: Add rules for sound card diff --git a/overlay/lib/systemd/system/rigctld.service b/overlay/lib/systemd/system/rigctld.service index eae2844..dd81b8a 100644 --- a/overlay/lib/systemd/system/rigctld.service +++ b/overlay/lib/systemd/system/rigctld.service @@ -1,11 +1,10 @@ [Unit] -Description=rigctld service +Description=Rig Control Service ConditionPathExists=/dev/et-cat After=multi-user.target [Service] ExecStart=/opt/emcomm-tools/sbin/wrapper-rigctld.sh start -SuccessExitStatus=143 [Install] WantedBy=multi-user.target