Merging feature/rigcontrol

This commit is contained in:
Gaston Gonzalez
2024-10-11 14:49:53 -07:00
20 changed files with 388 additions and 36 deletions
+4 -3
View File
@@ -7,7 +7,7 @@
# The DSHELL variable specifies the default login shell on your
# system.
#DSHELL=/bin/bash
DSHELL=/bin/bash
# The DHOME variable specifies the directory containing users' home
# directories.
@@ -49,11 +49,12 @@
# created user will be given their own group to use as a default. If
# "no", each created user will be placed in the group whose gid is
# USERS_GID (see below).
#USERGROUPS=yes
USERGROUPS=no
# If USERGROUPS is "no", then USERS_GID should be the GID of the group
# `users' (or the equivalent group) on your system.
#USERS_GID=100
# The et-data group should be set to 1981
USERS_GID=1981
# If DIR_MODE is set, directories will be created with the specified
# mode. Otherwise the default mode 0755 will be used.
+1 -2
View File
@@ -1,6 +1,5 @@
ET_HOME=/opt/emcomm-tools
ET_USER=games
ET_GROUP=games
ET_GROUP=et-data
ET_TEMP_DIR=/tmp/et
ET_LOG_FILE=$ET_TEMP_DIR/et.log
ET_DIST_DIR=/opt/dist
+6
View File
@@ -1,7 +1,13 @@
# Author : Gaston Gonzalez
# Date : 23 April 2024
# Updated : 9 October 2024
# Description : bash profile
# All user accounts should be in the 'et-data' group to allow data sharing with
# EmComm Tools. A umask of 002 is required to allow users and the system to
# read and write shared data files.
umask 002
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
+6 -4
View File
@@ -17,15 +17,17 @@ conky.config = {
};
conky.text = [[
${font DejaVu Sans Mono:size=14}${alignc}${time %A, %B %d %Y}
${font DejaVu Sans Mono:size=12}${alignc}${time %A, %B %d %Y}
Local: ${alignr}${time %H:%M:%S}
UTC: ${alignr}${tztime UTC %H:%M:%S}
Uptime: ${uptime}
IP: ${execpi 60 /opt/emcomm-tools/bin/et-system-info ip}
${execp /opt/emcomm-tools/bin/et-system-info release}
CAT: ${execpi 15 /opt/emcomm-tools/bin/et-system-info et-cat}
GPS: ${execpi 15 /opt/emcomm-tools/bin/et-system-info et-gps}
Radio: ${execpi 10 et-system-info active-radio}
CAT : ${execpi 10 et-system-info et-cat}
GPS : ${execpi 10 et-system-info et-gps}
${font DejaVu Sans Mono:size=10}${alignc}${execp /opt/emcomm-tools/bin/et-system-info release}
]];
+12 -2
View File
@@ -1,6 +1,6 @@
# Author : Gaston Gonzalez
# Date : 28 September 2024
# Updated : 5 October 2024
# Updated : 10 October 2024
# Purpose : udev rules for the Icom IC-705
#
# Preconditions:
@@ -9,6 +9,8 @@
# Postconditions:
# 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/
@@ -21,7 +23,8 @@ 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", \
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", \
@@ -29,4 +32,11 @@ 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
@@ -1,5 +1,6 @@
# Author : Gaston Gonzalez
# Date : 30 September 2024
# Updated : 11 October 2024
# Purpose : udev rules for the DigiRig Mobile v1.9
#
# Preconditions:
@@ -8,6 +9,7 @@
#
# Postconditions:
# 1. /dev/et-cat created
# 2. rigctld is started
#
# The IC-7200 uses the same chipsset. In order to avoid incorrect detection, we will check
@@ -16,7 +18,8 @@
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ET_DEVICE}=="", \
ACTION=="add", \
ENV{SYSTEMD_WANTS}="", \
ENV{ET_DEVICE}="DIGIRIG_MOBILE", ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat"
ENV{ET_DEVICE}="DIGIRIG_MOBILE", ENV{ET_SUBDEVICE}="CAT", GROUP="dialout", MODE="0660", SYMLINK+="et-cat", \
RUN+="/usr/bin/systemctl start rigctld"
# TODO: Add rules for earlier 1.9 release
# TODO: Add rules for sound card
@@ -0,0 +1,12 @@
[Unit]
Description=rigctld service
ConditionPathExists=/dev/et-cat
After=multi-user.target
[Service]
User=et
ExecStart=/opt/emcomm-tools/sbin/wrapper-rigctld.sh start
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
+4
View File
@@ -2,8 +2,12 @@
#
# Author : Gaston Gonzalez
# Date : 16 March 2024
# Updated : 9 October 2024
# Purpose : Log message to standard out and log file
ET_TEMP_DIR=/tmp/et
ET_LOG_FILE=$ET_TEMP_DIR/et.log
if [ ! -e $ET_TEMP_DIR ]; then
mkdir $ET_TEMP_DIR
chmod 755 $ET_TEMP_DIR
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 11 October 2024
# Purpose : A script for managaing plug-and-play radios
set -e
function usage() {
echo "Usage: $(basename $0) <command>"
echo " active - show active radio"
echo " list - list supported radios by id"
echo " set <radio id> - set radio as active by id"
}
if [ $# -lt 1 ]; then
usage
exit 1
fi
ACTIVE_RADIO="${ET_HOME}/conf/radios.d/active-radio.json"
case $1 in
list)
printf "%-20s %-10s %-10s\n" "ID" "Vendor" "Model"
find ${ET_HOME}/conf/radios.d -type f -name \*.json | sort -n | while read radio; do
ID=$(cat $radio | jq -r .id)
VENDOR=$(cat $radio | jq -r .vendor)
MODEL=$(cat $radio | jq -r .model)
printf "%-20s %-10s %-10s\n" $ID $VENDOR $MODEL
done
;;
set)
if [ $# -ne 2 ]; then
echo "Radio ID required. Run '$(basename $0) list' to get list of radios"
usage
exit 1
fi
RADIO_CONF="${ET_HOME}/conf/radios.d/$2.json"
if [ ! -e ${RADIO_CONF} ]; then
echo "Radio configuration does not exist for radio ID: '$2'"
exit 1
fi
[ -e ${ACTIVE_RADIO} ] && rm ${ACTIVE_RADIO}
ln -s ${RADIO_CONF} ${ACTIVE_RADIO}
;;
active)
if [ ! -L "${ACTIVE_RADIO}" ]; then
echo "No active radio defined. Run: '$(basename $0) set <radio ID>'"
exit 1
fi
ID=$(cat ${ACTIVE_RADIO} | jq -r .id)
VENDOR=$(cat ${ACTIVE_RADIO} | jq -r .vendor)
MODEL=$(cat ${ACTIVE_RADIO} | jq -r .model)
printf "%-20s %-10s %-10s\n" "Radio ID" "Vendor" "Model"
printf "%-20s %-10s %-10s\n" $ID $VENDOR $MODEL
printf "\nConfiguration Notes\n"
cat ${ACTIVE_RADIO} | jq -r '.notes[] | "* \(.)"'
;;
*)
echo "Command not supported."
usage
exit 1
;;
esac
+81 -6
View File
@@ -2,14 +2,16 @@
#
# Author : Gaston Gonzalez
# Date : 6 October 2024
# Updated : 11 October 2024
# Purpose : Utility script for dumping system information
function usage() {
echo "Usage: $(basename $0) <command>"
echo " et-cat - Is CAT control connected"
echo " et-gps - Is the GPS connected"
echo " ip - System IP address"
echo " release - EmComm Tools Release"
echo " active-radio - Display model of active radio"
echo " et-cat - Is CAT control connected"
echo " et-gps - Is the GPS connected"
echo " ip - System IP address"
echo " release - EmComm Tools Release"
}
if [ $# -ne 1 ]; then
@@ -18,11 +20,84 @@ if [ $# -ne 1 ]; then
fi
case $1 in
active-radio)
if [ -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then
cat "${ET_HOME}/conf/radios.d/active-radio.json" | jq -r .model
else
echo "No radio selected"
fi
;;
et-cat)
if [ -e /dev/et-cat ]; then echo "Yes"; else echo "No"; fi
if [ ! -L "${ET_HOME}/conf/radios.d/active-radio.json" ]; then
echo "N/A"
exit 0
fi
# 1. Check if the symlink was created by the udev rules
if [ -e /dev/et-cat ]; then
# 2. Check if the rigctl systemd unit is running properly
systemctl status rigctld --no-pager > /dev/null
if [ $? -eq 0 ]; then
# 3. Grab and format frequency
FREQ=$(timeout 1 rigctl -m 2 f)
if [ $? -eq 0 ]; then
printf "%'d MHz\n" "$FREQ" | sed 's|,|.|g'
else
echo "Connected. Can't access VFO";
fi
else
echo "Connected. rigctld not running"
fi
else
echo "Not connected";
fi
;;
et-gps)
if [ -e /dev/et-gps ]; then echo "Yes"; else echo "No"; fi
# 1. Check if the symlink was created by the udev rules
if [ -e /dev/et-gps ]; then
# 2. Check if the gpsd systemd unit is running properly
systemctl status gpsd --no-pager > /dev/null
if [ $? -eq 0 ]; then
# 3. Obtain the current GPS mode
GPS_JSON=$(gpspipe -w -n 10 | grep -m 1 TPV)
if [ $? -eq 0 ]; then
GPS_MODE=$(echo $GPS_JSON | jq --exit-status -r .mode)
case $GPS_MODE in
1)
echo "No fix"
;;
2)
echo "2D fix"
;;
3)
LAT=$(echo $GPS_JSON | jq -r .lat)
LON=$(echo $GPS_JSON | jq -r .lon)
printf "%.5f,%.5f\n" $LAT $LON
;;
*)
echo "Unknown mode"
;;
esac
else
echo "Connected. Can't decode"
fi
else
echo "Connected. gpsd not running"
fi
else
echo "Not connected"
fi
;;
ip)
hostname -I
@@ -0,0 +1,13 @@
{
"id": "icom-ic705",
"vendor": "Icom",
"model": "IC-705",
"rigctrl": {
"id": "3085",
"baud": "9600",
"ptt": "RIG"
},
"notes": [
"Enable GPS: [MENU] > [SET] > [Connectors] > [USB (B) Function] > GPS Out = ON"
]
}
@@ -0,0 +1,23 @@
{
"id": "yaesu-ft818nd",
"vendor": "Yaesu",
"model": "FT-818ND",
"rigctrl": {
"id": "1041",
"baud": "38400",
"ptt": "RTS"
},
"notes": [
"Menu 007 ANTENNA = REAR",
"Menu 014 CAT RATE = 38400",
"Menu 024 DIG DISP = 0 Hz",
"Menu 025 DIG MIC = 75",
"Menu 026 DIG MODE = USER-U",
"Menu 027 DIG SHIFT = 0 Hz",
"Menu 039 PKT MIC = 50",
"Menu 040 PKT RATE = 1200",
"Set AGCfast",
"For VHF/UHF packet, set mode = PKT; Menu 045 = SQL",
"For HF, set mode = DIGI; Menu 045 = RF GAIN"
]
}
@@ -0,0 +1,23 @@
{
"id": "yaesu-ft857d",
"vendor": "Yaesu",
"model": "FT-857D",
"rigctrl": {
"id": "1022",
"baud": "38400",
"ptt": "RTS"
},
"notes": [
"Menu 019 CAT RATE = 38400",
"Menu 020 CAT = CAT",
"Menu 036 DIG DISP = 0 Hz",
"Menu 037 DIG GAIN = 50",
"Menu 088 DIG MODE = USB-U",
"Menu 039 DIG SHIFT = 0 Hz",
"Menu 040 DIG VOX = 0",
"Menu 071 PKT 1200 = 10",
"Menu 073 1200 RATE = 1200 bps",
"For VHF/UHF packet, set mode = PKT; Menu 080 = SQL",
"For HF, set mode = DIGI; Menu 080 = RF GAIN"
]
}
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 9 October 2024
# Purpose : Wrapper startup/shutdown script around systemd/rigctld
ET_HOME=/opt/emcomm-tools
ACTIVE_RADIO="${ET_HOME}/conf/radios.d/active-radio.json"
CAT_DEVICE=/dev/et-cat
do_full_auto() {
et-log "Found ET_DEVICE='${ET_DEVICE}'"
case "$1" in
IC-705)
echo "Automatically configuring $1..."
if [ -L ${ACTIVE_RADIO} ]; then
rm -v ${ACTIVE_RADIO}
fi
ln -v -s ${ET_HOME}/conf/radios.d/icom-ic705.json ${ACTIVE_RADIO}
;;
*)
et-log "Full auto configuration not available for ET_DEVICE=$1"
;;
esac
}
start() {
if [ ! -e ${CAT_DEVICE} ]; then
et-log "No CAT device found. ${CAT_DEVICE} symlink is missing."
exit 1
fi
if [ ! -L ${ACTIVE_RADIO} ]; then
et-log "No active radio defined. ${ACTIVE_RADIO} symlink is missing."
exit 1
fi
# Check if rigctld is already running
ps -ef | grep [r]igctld
if [ $? -eq 0 ]; then
PID=$(ps -ef | grep [r]igctld | awk '{print $2}')
et-log "Rig control is already running with process ID: ${PID}."
#kill -9 ${PID}
#sleep 1
fi
# Grab rigctld values from active radio configuration
ID=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.id)
BAUD=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.baud)
PTT=$(cat ${ET_HOME}/conf/radios.d/active-radio.json | jq -r .rigctrl.ptt)
# Generate command
CMD="rigctld -m ${ID} -r ${CAT_DEVICE} -s ${BAUD} -P ${PTT} "
et-log "Starting rigctld with: ${CMD}"
$CMD
}
stop() {
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() {
echo "usage: $(basename $0) <cmd>"
echo " <cmd> [start|stop]"
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
case $1 in
start)
start
;;
stop)
stop
;;
*)
usage
;;
esac
+12 -4
View File
@@ -2,14 +2,22 @@
#
# Author : Gaston Gonzalez
# Date : 16 March 2024
# Updated : 1 October 2024
# Purpose : Configure users
# Updated : 9 October 2024
# Purpose : Configure users and groups
set -e
et-log "Configuring users"
ET_GID=1981
et-log "Adding '${ET_GROUP}' group..."
groupadd -g ${ET_GID} ${ET_GROUP}
et-log "Configuring users..."
et-log "Adding et system user..."
useradd -m -s /bin/bash et
cp -r ../overlay/etc/skel /etc/
[ ! -e /etc/skel/Desktop ] && mkdir /etc/skel/Desktop
et-log "Add all users to dialout group"
et-log "Add all users to dialout group..."
cp -v -r ../overlay/etc/adduser.conf /etc/
+1 -2
View File
@@ -6,8 +6,7 @@
# Purpose : Global environment variables
export ET_HOME=/opt/emcomm-tools
export ET_USER=games
export ET_GROUP=games
export ET_GROUP=et-data
export ET_TEMP_DIR=/tmp/et
export ET_LOG_FILE=$ET_TEMP_DIR/et.log
+1 -10
View File
@@ -2,22 +2,13 @@
#
# Author : Gaston Gonzalez
# Date : 16 January 2023
# Updated : 16 March 2024
# Updated : 9 October 2024
# Purpose : Fix screen brightness on Panasonic hardware
et-log "Installing Panasonic brightness fix..."
apt install inotify-tools -y
if [ ! -e $ET_HOME/sbin ]; then
mkdir -v -p $ET_HOME/sbin
chown -v $ET_USER:$ET_GROUP $ET_HOME/sbin
fi
cp -v ../overlay/$ET_HOME/sbin/panasonic-set-brightness.sh $ET_HOME/sbin/
chmod -v 755 $ET_HOME/sbin/panasonic-set-brightness.sh
chown -v $ET_USER:$ET_GROUP $ET_HOME/sbin/*
cp -v ../overlay/lib/systemd/system/panasonic-brightness.service /lib/systemd/system/
systemctl daemon-reload
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
#
# Author : Gaston Gonzalez
# Date : 9 October 2024
# Purpose : Install script for CAT control
et-log "Updating CAT control systemd script..."
cp ../overlay/lib/systemd/system/rigctld.service /lib/systemd/system/
systemctl daemon-reload
et-log "Disable automatic start of rigctl..."
systemctl disable rigctld
+6 -1
View File
@@ -2,6 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 6 October 2024
# Updated : 9 October 2024
# Purpose : Install EmComm Tools applications
et-log "Installing EmComm Tools applications..."
@@ -11,4 +12,8 @@ if [ ! -e $ET_HOME ]; then
fi
cp -v -r ../overlay/$ET_HOME/* $ET_HOME
chown -v -R $ET_USER:$ET_GROUP $ET_HOME
et-log "Setting up permission for shared data access..."
chgrp -v -R $ET_GROUP $ET_HOME/conf/radios.d
chmod -v 775 $ET_HOME/conf/radios.d
chmod -v 664 $ET_HOME/conf/radios.d/*.json
+2 -1
View File
@@ -2,7 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 16 March 2024
# Updated : 6 October 2024
# Updated : 9 October 2024
# Purpose : Main installer for EmComm Tools OS Community
. ./env.sh
@@ -31,5 +31,6 @@ exitIfNotRoot
./install-udev.sh
./install-gps.sh
./install-navit.sh
./install-cat.sh
./install-conky.sh