From f7234e472bdb10b7f7813b68f94556eb0118745d Mon Sep 17 00:00:00 2001 From: Steve Magnuson Date: Sun, 22 Sep 2019 19:27:50 -0700 Subject: [PATCH] Added check for call in tnc.conf --- hampi-utilities.version | 2 +- tnc-left.conf | 208 ++++++++++++++++++++++++++++++++++++++++ tnc-right.conf | 208 ++++++++++++++++++++++++++++++++++++++++ tnc.sh | 7 +- 4 files changed, 423 insertions(+), 2 deletions(-) create mode 100644 tnc-left.conf create mode 100644 tnc-right.conf diff --git a/hampi-utilities.version b/hampi-utilities.version index be77070..874a64e 100644 --- a/hampi-utilities.version +++ b/hampi-utilities.version @@ -1 +1 @@ -VERSION="1.0.2" \ No newline at end of file +VERSION="1.0.3" \ No newline at end of file diff --git a/tnc-left.conf b/tnc-left.conf new file mode 100644 index 0000000..a967b2b --- /dev/null +++ b/tnc-left.conf @@ -0,0 +1,208 @@ +# Configuration file for the tnc.sh script. Place this file in your home directory. + +# BEGINNING OF USER CONFIGURATION SECTION ######################################################## + +# These MUST be changed before starting the script! + +#-------------- Direwolf Parameters -------------------------------------------- +# You may use a tactical call sign for MYCALL for APRS. If you do, you MUST set a valid call sign +# in COMMENTCALL so that a call sign is included in the APRS text. Otherwise, COMMENTCALL +# may be left empty. +MYCALL="N0CALL-10" +COMMENTCALL="" +LOC="Bellingham, WA" +GRID="CN88ss" + +# Direwolf supports both decimal degrees (e.g. -71.34717) format using the "." +# character (and negative values) as well as the degrees.minutes.seconds (e.g. 71^20.83W) +# format using the "^" character (and the E/W indicator) +LAT="48.753318" +LONG="-122.472632" + +# Rig power in watts +POWER=10 +# Antenna height in feet from average terrain (not feet above sea level) +HEIGHT=40 +# Antenna gain in dBi +GAIN=2 + +# Direwolf Audio sample rate in bits/second. Depends on your soundcard - usually 44100 or 48000. +# Fe-Pi and DRAWS audio cards can use 96000: +ARATE="96000" +# Signalink: +#ARATE="48000" + +#--------------- Direwolf Sound Card, PTT and rig control settings -------------------------------------------- + +# There are 2 ways to select the sound card. The first way is to explicitly select the +# card by assigning it to the AUDIO_DEV variable below: +#AUDIO_DEV="" +AUDIO_DEV="fepi-capture-left fepi-playback-left" + +# The second way is to set the following variable, which this script will use as a +# case-insensitive string to grep for (uniquely identify) the soundcard in "arecord -l" +# output. Typically, "USB AUDIO" works for USB sound cards like Signalink. +# For Fe-Pi sound card, use "Fe-Pi". +AUDIO_DEV_SEARCH_STRING="Fe-Pi" + +# If you set AUDIO_DEV="", then AUDIO_DEV_SEARCH_STRING will be used to find the audio card. +# Set AUDIO_DEV if you want to use a virtual sound card. AUDIO_DEV_SEARCH_STRING is ignored +# if AUDIO_DEV is set. + +# PTT Options and Examples: +# 1. The sound card handles PTT via VOX (e.g. SignalLink), so set to empty string. +# PTT0="" +# 2. Use General Purpose I/O (GPIO) BCM pin (not the physical pin number) and potentially a +# relay/transistor (e.g. UDRC/DRAWS/DigiLink) +# PTT0="PTT GPIO 12" +# 3. Use USB serial port adapter and control RS-232 signal lines (DTR, RTS) +# PTT0="PTT /dev/ttyUSB0 RTS" +# 4. Use the HamLib rig control library (open source) using a serial port or rigctld server +# See the HamLib and Direwolf documentation for details +# PTT0="RIG 120 /dev/ttyUSB0" +# PTT0="RIG 7 localhost:4532" + +# DEVSTRING is the case-insensitve string to search for in /dev/serial/byid that +# is the serial port used for rig control (if rig control is used) + +## DigiLink or UDRC/DRAWS. PTT0 is for left audio channel and PTT1 for right. +## If using a single audio channel, set PTT0 +PTT0="PTT GPIO 12" +#PTT1="PTT GPIO 23" +DEVSTRING="" + +## Signalink (Signalink uses VOX between computer and Signalink) +#PTT0="" +#PTT1="$PTT0" +#DEVSTRING="" + +## USB/Serial interface for radio rig control +## Kenwood TM-D710G +#DEVSTRING="USB-Serial" +#RIGCTL_RADIO=234 +#RIGCTL_SPEED=57600 +#PTT0="" + +## USB/Serial interface for radio rig control +## Icom IC-7100 +#DEVSTRING="_A-if00-port0" +#RIGCTL_RADIO=370 +#RIGCTL_SPEED=19200 +#PTT0="PTT RIG 2 localhost:4532" +#PTT1="$PTT0" + +#----- ARDOP (piardop2) Sound Card and PTT settings --------------------------------------------- + +ARDOP_PORT=8515 + +## I haven't tested PulseAudio devices defined in PulseAudio, but they should work. +## Or, to use the plughw device, run 'arecord -L' to get the device name. +ARDOP_DEV="fepi-capture-right fepi-playback-right" +#ARDOP_DEV="plughw:CARD=Audio,DEV=0 plughw:CARD=Audio,DEV=0" + +## Pick ONE of the following three PTT types (GPIO, CAT, or Serical) for ARDOP: + +## GPIO PTT... +## For DigiLink/UDRC/DRAWS: Left radio is GPIO (BCM) 12, right radio is 23 +ARDOP_PTT="-p gpio=12" +#ARDOP_PTT="-p gpio=23" + +## ...or CAT Commands for rigs that support CAT... +## ARDOP requires specific CAT commands to key/unkey the radio via CAT. It can't +## use rigctld. These are the key/unkey CAT commands for most ICOM radios: +#ARDOP_DEVICE="/dev/ttyUSB0" +#ARDOP_KEY="-k FEFE88E01C0001FD" +#ARDOP_UNKEY="-u FEFE88E01C0000FD" +#ARDOP_CAT_PORT_SPEED=19200 +#ARDOP_PTT="-c $ARDOP_DEVICE:$ARDOP_CAT_PORT_SPEED $ARDOP_KEY $ARDOP_UNKEY" + +## ...or RTS serial PTT control for rigs that support it. +#ARDOP_DEVICE="/dev/ttyUSB0" +#ARDOP_CAT_PORT_SPEED=19200 +#ARDOP_PTT="-c $ARDOP_DEVICE:$ARDOP_CAT_PORT_SPEED" + +#------------------------------------------------------------------------------------- + +# Change the following as needed. These settings should work in most cases. ----- + +# Should Direwolf print color text? 0=no, 1=yes +COLORS="0" + +# Direwolf can print audio stats every n seconds (0 to disable) +AUDIOSTATS=60 + +#---- Direwolf KISS parameters ------------------------------------------------------ + +AGWPORT="AGWPORT 8000" +KISSPORT="KISSPORT 8001" +## These 1200 baud kissparms are the same as the ones in RMS Express Packet Winlink +#TXDelay=400 +#TXTail=50 +#Persist=160 +#Slottime=30 + +## These 1200 baud kissparms are from https://andrewmemory.wordpress.com/tag/direwolf/ +#TXDelay=200 +#TXTail=50 +#Persist=64 +#Slottime=20 + +## These 1200 baud kissparm recommendations are from http://www.choisser.com/packet/part14.html +TXDelay=200 +TXTail=50 +Persist=64 +Slottime=20 + +# Must match entry in /etc/ax25/axports. This script will create the entry if not present. +AX25PORT="wl2k" +AX25PORTFILE="/etc/ax25/axports" + +#---- Direwolf APRS Parameters ------------------------------------------------------ + +# APRS transmit channel (not used for ax25) +CHANNEL="0" + +# Transmit no more than 6 packets/minute and 10 packets/5 minutes +IGTXLIMIT="IGTXLIMIT 6 10" + +# Filter traffic coming from the iGate server for TX out our radio. This is a +# Client Side filter. Filtering takes place within Direwolf. +# See https://github.com/wb2osz/direwolf/blob/master/doc/Successful-APRS-IGate-Operation.pdf +# Filter below says: Transmit only messages destined for stations within 16KM (10 miles) +# of this station's LAT/LONG, or anyone we've heard in the last hour [i/60/0] AND the addressee +# must have a callsign that starts with W,K,A, or N. +# Individual message filter format is: i/time/hops/lat/lon/km +# Allow “messages” for a station heard over the radio in the last ‘time’ minutes +# within the specified distance. Distance can be digipeater hops and/or geographical distance. +# Typical time limits might be 30 or 60 minutes. If we haven’t heard from a station for that +# long, it’s probably no longer hearing us. ‘hops’ is the number of digipeater hops necessary +# to hear the message addressee. If hops is not specified, the maximum transmit +# digipeater hop count, from the IGTXVIA configuration will be used. +FILTER="FILTER IG $CHANNEL ( i/30/8/$LAT/$LONG/16 | i/60/0 ) & g/W*/K*/A*/N*" + +# iGate server to use +IGSERVER="IGSERVER noam.aprs2.net" + +# Only transmit messages received from the iGate server to stations within 16 Km (10 miles) +# of my location. This is a Server Side filter. Direwolf sends this filter specification +# to the iGate server and the iGate server does the filtering. +IGFILTER="IGFILTER m/16" + +# Number of hops +HOPS="WIDE1-1,WIDE2-1" +# For digipeat + igate only. This tells Direwolf what path to use when TX out the radio +# for data received from the iGate server. +IGTXVIA="IGTXVIA $CHANNEL $HOPS" + +# Wait $IGDELAY after direwolf starts, then send a position +# beacon to iGate server and send one every $IGEVERY after that (MM:SS) +IGDELAY="00:30" +IGEVERY="15:00" + +# Wait $DIGIPEATDELAY after direwolf starts, then TX a position +# beacon and send one every $DIGIPEATEVERY after that (MM:SS) +DIGIPEATDELAY="00:30" +DIGIPEATEVERY="10:00" +#------------------------------------------------------------------------------------ + +# END OF USER CONFIGURATION SECTION ######################################################## diff --git a/tnc-right.conf b/tnc-right.conf new file mode 100644 index 0000000..dda2150 --- /dev/null +++ b/tnc-right.conf @@ -0,0 +1,208 @@ +# Configuration file for the tnc.sh script. Place this file in your home directory. + +# BEGINNING OF USER CONFIGURATION SECTION ######################################################## + +# These MUST be changed before starting the script! + +#-------------- Direwolf Parameters -------------------------------------------- +# You may use a tactical call sign for MYCALL for APRS. If you do, you MUST set a valid call sign +# in COMMENTCALL so that a call sign is included in the APRS text. Otherwise, COMMENTCALL +# may be left empty. +MYCALL="N0CALL-10" +COMMENTCALL="" +LOC="Bellingham, WA" +GRID="CN88ss" + +# Direwolf supports both decimal degrees (e.g. -71.34717) format using the "." +# character (and negative values) as well as the degrees.minutes.seconds (e.g. 71^20.83W) +# format using the "^" character (and the E/W indicator) +LAT="48.753318" +LONG="-122.472632" + +# Rig power in watts +POWER=10 +# Antenna height in feet from average terrain (not feet above sea level) +HEIGHT=40 +# Antenna gain in dBi +GAIN=2 + +# Direwolf Audio sample rate in bits/second. Depends on your soundcard - usually 44100 or 48000. +# Fe-Pi and DRAWS audio cards can use 96000: +ARATE="96000" +# Signalink: +#ARATE="48000" + +#--------------- Direwolf Sound Card, PTT and rig control settings -------------------------------------------- + +# There are 2 ways to select the sound card. The first way is to explicitly select the +# card by assigning it to the AUDIO_DEV variable below: +#AUDIO_DEV="" +AUDIO_DEV="fepi-capture-right fepi-playback-right" + +# The second way is to set the following variable, which this script will use as a +# case-insensitive string to grep for (uniquely identify) the soundcard in "arecord -l" +# output. Typically, "USB AUDIO" works for USB sound cards like Signalink. +# For Fe-Pi sound card, use "Fe-Pi". +AUDIO_DEV_SEARCH_STRING="Fe-Pi" + +# If you set AUDIO_DEV="", then AUDIO_DEV_SEARCH_STRING will be used to find the audio card. +# Set AUDIO_DEV if you want to use a virtual sound card. AUDIO_DEV_SEARCH_STRING is ignored +# if AUDIO_DEV is set. + +# PTT Options and Examples: +# 1. The sound card handles PTT via VOX (e.g. SignalLink), so set to empty string. +# PTT0="" +# 2. Use General Purpose I/O (GPIO) BCM pin (not the physical pin number) and potentially a +# relay/transistor (e.g. UDRC/DRAWS/DigiLink) +# PTT0="PTT GPIO 12" +# 3. Use USB serial port adapter and control RS-232 signal lines (DTR, RTS) +# PTT0="PTT /dev/ttyUSB0 RTS" +# 4. Use the HamLib rig control library (open source) using a serial port or rigctld server +# See the HamLib and Direwolf documentation for details +# PTT0="RIG 120 /dev/ttyUSB0" +# PTT0="RIG 7 localhost:4532" + +# DEVSTRING is the case-insensitve string to search for in /dev/serial/byid that +# is the serial port used for rig control (if rig control is used) + +## DigiLink or UDRC/DRAWS. PTT0 is for left audio channel and PTT1 for right. +## If using a single audio channel, set PTT0 +PTT0="PTT GPIO 23" +#PTT1="PTT GPIO 12" +DEVSTRING="" + +## Signalink (Signalink uses VOX between computer and Signalink) +#PTT0="" +#PTT1="$PTT0" +#DEVSTRING="" + +## USB/Serial interface for radio rig control +## Kenwood TM-D710G +#DEVSTRING="USB-Serial" +#RIGCTL_RADIO=234 +#RIGCTL_SPEED=57600 +#PTT0="" + +## USB/Serial interface for radio rig control +## Icom IC-7100 +#DEVSTRING="_A-if00-port0" +#RIGCTL_RADIO=370 +#RIGCTL_SPEED=19200 +#PTT0="PTT RIG 2 localhost:4532" +#PTT1="$PTT0" + +#----- ARDOP (piardop2) Sound Card and PTT settings --------------------------------------------- + +ARDOP_PORT=8515 + +## I haven't tested PulseAudio devices defined in PulseAudio, but they should work. +## Or, to use the plughw device, run 'arecord -L' to get the device name. +ARDOP_DEV="fepi-capture-right fepi-playback-right" +#ARDOP_DEV="plughw:CARD=Audio,DEV=0 plughw:CARD=Audio,DEV=0" + +## Pick ONE of the following three PTT types (GPIO, CAT, or Serical) for ARDOP: + +## GPIO PTT... +## For DigiLink/UDRC/DRAWS: Left radio is GPIO (BCM) 12, right radio is 23 +#ARDOP_PTT="-p gpio=12" +ARDOP_PTT="-p gpio=23" + +## ...or CAT Commands for rigs that support CAT... +## ARDOP requires specific CAT commands to key/unkey the radio via CAT. It can't +## use rigctld. These are the key/unkey CAT commands for most ICOM radios: +#ARDOP_DEVICE="/dev/ttyUSB0" +#ARDOP_KEY="-k FEFE88E01C0001FD" +#ARDOP_UNKEY="-u FEFE88E01C0000FD" +#ARDOP_CAT_PORT_SPEED=19200 +#ARDOP_PTT="-c $ARDOP_DEVICE:$ARDOP_CAT_PORT_SPEED $ARDOP_KEY $ARDOP_UNKEY" + +## ...or RTS serial PTT control for rigs that support it. +#ARDOP_DEVICE="/dev/ttyUSB0" +#ARDOP_CAT_PORT_SPEED=19200 +#ARDOP_PTT="-c $ARDOP_DEVICE:$ARDOP_CAT_PORT_SPEED" + +#------------------------------------------------------------------------------------- + +# Change the following as needed. These settings should work in most cases. ----- + +# Should Direwolf print color text? 0=no, 1=yes +COLORS="0" + +# Direwolf can print audio stats every n seconds (0 to disable) +AUDIOSTATS=60 + +#---- Direwolf KISS parameters ------------------------------------------------------ + +AGWPORT="AGWPORT 8010" +KISSPORT="KISSPORT 8011" +## These 1200 baud kissparms are the same as the ones in RMS Express Packet Winlink +#TXDelay=400 +#TXTail=50 +#Persist=160 +#Slottime=30 + +## These 1200 baud kissparms are from https://andrewmemory.wordpress.com/tag/direwolf/ +#TXDelay=200 +#TXTail=50 +#Persist=64 +#Slottime=20 + +## These 1200 baud kissparm recommendations are from http://www.choisser.com/packet/part14.html +TXDelay=200 +TXTail=50 +Persist=64 +Slottime=20 + +# Must match entry in /etc/ax25/axports. This script will create the entry if not present. +AX25PORT="wl2k" +AX25PORTFILE="/etc/ax25/axports" + +#---- Direwolf APRS Parameters ------------------------------------------------------ + +# APRS transmit channel (not used for ax25) +CHANNEL="0" + +# Transmit no more than 6 packets/minute and 10 packets/5 minutes +IGTXLIMIT="IGTXLIMIT 6 10" + +# Filter traffic coming from the iGate server for TX out our radio. This is a +# Client Side filter. Filtering takes place within Direwolf. +# See https://github.com/wb2osz/direwolf/blob/master/doc/Successful-APRS-IGate-Operation.pdf +# Filter below says: Transmit only messages destined for stations within 16KM (10 miles) +# of this station's LAT/LONG, or anyone we've heard in the last hour [i/60/0] AND the addressee +# must have a callsign that starts with W,K,A, or N. +# Individual message filter format is: i/time/hops/lat/lon/km +# Allow “messages” for a station heard over the radio in the last ‘time’ minutes +# within the specified distance. Distance can be digipeater hops and/or geographical distance. +# Typical time limits might be 30 or 60 minutes. If we haven’t heard from a station for that +# long, it’s probably no longer hearing us. ‘hops’ is the number of digipeater hops necessary +# to hear the message addressee. If hops is not specified, the maximum transmit +# digipeater hop count, from the IGTXVIA configuration will be used. +FILTER="FILTER IG $CHANNEL ( i/30/8/$LAT/$LONG/16 | i/60/0 ) & g/W*/K*/A*/N*" + +# iGate server to use +IGSERVER="IGSERVER noam.aprs2.net" + +# Only transmit messages received from the iGate server to stations within 16 Km (10 miles) +# of my location. This is a Server Side filter. Direwolf sends this filter specification +# to the iGate server and the iGate server does the filtering. +IGFILTER="IGFILTER m/16" + +# Number of hops +HOPS="WIDE1-1,WIDE2-1" +# For digipeat + igate only. This tells Direwolf what path to use when TX out the radio +# for data received from the iGate server. +IGTXVIA="IGTXVIA $CHANNEL $HOPS" + +# Wait $IGDELAY after direwolf starts, then send a position +# beacon to iGate server and send one every $IGEVERY after that (MM:SS) +IGDELAY="00:30" +IGEVERY="15:00" + +# Wait $DIGIPEATDELAY after direwolf starts, then TX a position +# beacon and send one every $DIGIPEATEVERY after that (MM:SS) +DIGIPEATDELAY="00:30" +DIGIPEATEVERY="10:00" +#------------------------------------------------------------------------------------ + +# END OF USER CONFIGURATION SECTION ######################################################## diff --git a/tnc.sh b/tnc.sh index 6a28e00..65861d8 100755 --- a/tnc.sh +++ b/tnc.sh @@ -15,7 +15,7 @@ # to keep it running. # #=========================================================================================== -VERSION="3.0.2" +VERSION="3.1.0" # BEGINNING OF USER CONFIGURATION SECTION ######################################################## @@ -24,6 +24,11 @@ TNC_CONFIG_FILE="$HOME/tnc.conf" if [ -s "$TNC_CONFIG_FILE" ] then source $HOME/tnc.conf + if [[ $MYCALL =~ "N0ONE" ]] + then + echo >&2 "Error: You must set the MYCALL variable in $TNC_CONFIG_FILE." + exit 1 + fi else echo >&2 "Error: Configuration file $TNC_CONFIG_FILE is missing or empty." exit 1