diff --git a/overlay/etc/default/gpsd b/overlay/etc/default/gpsd index e1f6363..4c0d930 100644 --- a/overlay/etc/default/gpsd +++ b/overlay/etc/default/gpsd @@ -1,4 +1,16 @@ -START_DAEMON="true" +# Author : Gaston Gonzalez +# Date : 4 October +# Purpose : GPS configuration for EmComm Tools + +# Prevent starting automatically by systemd +START_DAEMON="false" + +# Prevent the default udev rules from starting gpsd. +# Custom ET udev rules trigger gpsd USBAUTO="false" + +# Always use DEVICES="/dev/et-gps" + +# -n should be used when using GPS as a reference clock GPSD_OPTIONS="-n" diff --git a/overlay/etc/udev/rules.d/80-et-ic705.rules b/overlay/etc/udev/rules.d/80-et-ic705.rules index b97f4e1..edfa36d 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 : 30 September 2024 +# Updated : 5 October 2024 # Purpose : udev rules for the Icom IC-705 # # Preconditions: @@ -21,11 +21,12 @@ KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{product}=="IC-705", \ # Create consistent device name/path for the CAT serial device ENV{ET_DEVICE}=="IC-705", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="00", \ ACTION=="add", \ - ENV{ET_SUBDEVICE}="CAT" GROUP="dialout", MODE="0660", SYMLINK+="et-cat" + ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat" # 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" + ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ + RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" # 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 4301b65..fd73b38 100644 --- a/overlay/etc/udev/rules.d/82-et-ic7100.rules +++ b/overlay/etc/udev/rules.d/82-et-ic7100.rules @@ -1,7 +1,7 @@ # Author : Gaston Gonzalez # Author : William McKeehan (https://github.com/mckeehan) # Date : 30 September 2024 -# Updated : 1 October 2024 +# Updated : 5 October 2024 # Purpose : udev rules for the Icom IC-7100 # # Preconditions: @@ -21,12 +21,13 @@ KERNEL=="ttyUSB[0-9]*", SUBSYSTEM=="tty", ATTRS{serial}=="IC-7100*", \ ENV{ET_DEVICE}=="IC-7100", SUBSYSTEMS=="usb", ATTRS{serial}=="IC-7100*A", \ ACTION=="add", \ ENV{SYSTEMD_WANTS}="", \ - ENV{ET_SUBDEVICE}="CAT" GROUP="dialout", MODE="0660", SYMLINK+="et-cat" + ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat" # Create consistent device name/path for the GPS serial device ENV{ET_DEVICE}=="IC-7100", SUBSYSTEMS=="usb", ATTRS{serial}=="IC-7100*B", \ ACTION=="add", \ - ENV{ET_SUBDEVICE}="GPS" GROUP="dialout", MODE="0660", SYMLINK+="et-gps" + ENV{ET_SUBDEVICE}="GPS", GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ + RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" # TODO: Add rules to trigger rigctld # TODO: Add rules for ACTION="remove" diff --git a/overlay/etc/udev/rules.d/91-et-u-blox.rules b/overlay/etc/udev/rules.d/91-et-u-blox.rules index a668aeb..05e6812 100644 --- a/overlay/etc/udev/rules.d/91-et-u-blox.rules +++ b/overlay/etc/udev/rules.d/91-et-u-blox.rules @@ -1,9 +1,12 @@ # Author : Gaston Gonzalez # Date : 30 September 2024 +# Updated : 5 October 2024 # Purpose : udev rules for U-blox GPS # # Supported Devices -# 1. VK-162 G-Mouse USB GPS Dongle - https://amzn.to/3XQqmYj +# 1. VK-162 G-Mouse USB GPS - https://amzn.to/3XQqmYj +# 2. VK-172 G-Mouse USB GPS - https://amzn.to/3Ya7Viu +# 3. VFAN UG-353 - https://amzn.to/3XL2lSo # # Preconditions: # 1. GPS connected via USB cable @@ -15,6 +18,6 @@ SUBSYSTEM=="tty", ATTRS{product}=="u-blox*" ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", \ ACTION=="add", \ ENV{ET_DEVICE}="UBLOX", ENV{ET_SUBDEVICE}="GPS", \ - GROUP="dialout", MODE="0660", SYMLINK+="et-gps" - + GROUP="dialout", MODE="0660", SYMLINK+="et-gps", \ + RUN+="/opt/emcomm-tools/sbin/wrapper-gpsd.sh start" diff --git a/overlay/opt/emcomm-tools/sbin/wrapper-gpsd.sh b/overlay/opt/emcomm-tools/sbin/wrapper-gpsd.sh new file mode 100755 index 0000000..47e217d --- /dev/null +++ b/overlay/opt/emcomm-tools/sbin/wrapper-gpsd.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 4 October 2024 +# Purpose : Wrapper startup/shutdown script around systemd/gpsd + +WAIT=5 + +start() { + et-log "Waiting to start gpsd for ${WAIT} seconds..." + sleep ${WAIT} + /usr/bin/systemctl restart gpsd +} + +stop() { + et-log "Waiting to stop gpsd for ${WAIT} seconds..." + sleep ${WAIT} + /usr/bin/systemctl stop gpsd +} + +usage() { + echo "usage: $(basename $0) " + echo " [start|stop]" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +case $1 in + start) + start + ;; + stop) + stop + ;; + *) + usage + ;; +esac diff --git a/scripts/install-base.sh b/scripts/install-base.sh index aee7dc7..2e53ace 100755 --- a/scripts/install-base.sh +++ b/scripts/install-base.sh @@ -2,11 +2,22 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 17 May 2024 +# Updated : 4 October 2024 # Purpose : Install base tools set -e -et-log "Installing message of the day" +et-log "Installing environment variables" +grep ET_TEMP_DIR /etc/environment +if [ $? -ne 0 ]; then + echo "ET_TEMP_DIR=/tmp/et" >> /etc/environment +fi + +grep ET_LOG_FILE /etc/environment +if [ $? -ne 0 ]; then + echo "ET_LOG_FILE=/tmp/et/et.log" >> /etc/environment +fi + +et-log "Installing message of the day cp -v ../overlay/etc/motd /etc/ et-log "Installing base packages" diff --git a/scripts/install-gps.sh b/scripts/install-gps.sh index 4261832..ede7e4c 100755 --- a/scripts/install-gps.sh +++ b/scripts/install-gps.sh @@ -22,8 +22,8 @@ et-log "Updating gpsd systemd script..." cp ../overlay/lib/systemd/system/gpsd.service /lib/systemd/system/ systemctl daemon-reload -et-log "Enabling gpsd..." -systemctl enable gpsd +et-log "Disable automatic start of gpsd..." +systemctl disable gpsd et-log "Updating chronyd to support GPS as a time source..." echo "# ET: Enable GPS as a time source" >> /etc/chrony/chrony.conf