Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
plu:example_config_files:systemd [2018/11/23 12:39]
gunn [systemd files in /etc/systemd/system]
plu:example_config_files:systemd [2018/11/23 15:41]
gunn [Files in /etc/ax25]
Line 10: Line 10:
 Requires=direwolf.service Requires=direwolf.service
 After=direwolf.service After=direwolf.service
-#​After=network-online.target 
  
 [Service] [Service]
Line 85: Line 84:
 DefaultInstance=1 DefaultInstance=1
 </​file>​ </​file>​
 +===== Files in /etc =====
 === direwolf.conf === === direwolf.conf ===
 <​file>​ <​file>​
Line 127: Line 127:
  
 CHANNEL 1 CHANNEL 1
-PTT GPIO 12+PTT GPIO 23
 MODEM 1200 MODEM 1200
 MYCALL N7NIX-2 MYCALL N7NIX-2
Line 139: Line 139:
 AGWPORT 8000 AGWPORT 8000
 KISSPORT 8001 KISSPORT 8001
 +</​file>​
 +===== Files in /etc/ax25 =====
 +=== ax25dev-parms ===
 +<​file>​
 +#!/bin/bash
 +
 +if [[ $# -gt 0 ]] ; then
 +   ​Device=$1
 +else
 +   awk '/​device/​ { print $7 }' /​tmp/​ax25-config.tmp > /​tmp/​ax25-config-tmp
 +   read Device < /​tmp/​ax25-config-tmp
 +
 +   if [[ -z "​$Device"​ ]] ; then
 +      Device="​ax0"​
 +      echo "Set Device to default: $Device"​
 +   fi
 +fi
 +
 +echo "Using Device = $Device"​
 +
 +if [ -d /​proc/​sys/​net/​ax25/​$Device ] ; then
 + ​PARMDIR="/​proc/​sys/​net/​ax25/​$Device"​
 +# Parms for a USER Port
 +echo 3000    > $PARMDIR/​t1_timeout #​ (Frack) /1000 = ? Sec
 +echo 1000    > $PARMDIR/​t2_timeout # (RESPtime) /1000 = ? sec
 +echo 300000 ​ > $PARMDIR/​t3_timeout # (Check) /6000 = ? Min
 +echo 900000 ​ > $PARMDIR/​idle_timeout #​ Idle Timer /6000 = ? min
 +echo 2       > $PARMDIR/​standard_window_size #​ Outstanding Frames
 +echo 12      > $PARMDIR/​maximum_retry_count #​ Max Retrys
 +echo 256     > $PARMDIR/​maximum_packet_length #​ Paclen
 +echo 0       > $PARMDIR/​ax25_default_mode
 +echo 0       > $PARMDIR/​ip_default_mode
 +echo 0       > $PARMDIR/​backoff_type
 +echo 2       > $PARMDIR/​connect_mode
 +#echo 180000 > $PARMDIR/​dama_slave_timeout
 +echo 32      > $PARMDIR/​extended_window_size
 +echo 0       > $PARMDIR/​protocol
 +
 +        ifconfig $Device netmask 255.255.255.255
 +        echo " Port ${PORTNAME} attached to ${Device} "
 +else
 +        echo "** Error setting Device: $Device parms**"​
 +fi
 +echo "​ax25dev-parms finished"​
 +exit 0
 +</​file>​
 +=== ax25-upd ===
 +<​file>​
 +#!/bin/bash
 +#
 +# ax25-upd for use with systemd & direwolf
 +# Ax25, rose, & mkiss - are pre-loaded via /​etc/​modules or built into kernel
 +#
 +# Uncomment this statement for debug echos
 +DEBUG=1
 +
 +SBINDIR=/​usr/​local/​sbin
 +BINDIR=/​usr/​local/​bin
 +UDRCII=false
 +
 +# portname set in /​etc/​ax25/​axports
 +PORTNAME_1="​udr0"​
 +PORTNAME_2="​udr1"​
 +SERIALPORT_DIREWOLF="/​tmp/​kisstnc"​
 +
 +firmware_prodfile="/​sys/​firmware/​devicetree/​base/​hat/​product"​
 +firmware_prod_idfile="/​sys/​firmware/​devicetree/​base/​hat/​product_id"​
 +firmware_vendorfile="/​sys/​firmware/​devicetree/​base/​hat/​vendor"​
 +
 +PROD_ID_NAMES=("​INVALID"​ "​INVALID"​ "​UDRC"​ "UDRC II" "​DRAWS"​ "​1WSpot"​)
 +NWDIG_VENDOR_NAME="​NW Digital Radio"
 +
 +function dbgecho { if [ ! -z "​$DEBUG"​ ] ; then echo "​$*";​ fi }
 +
 +# ===== function EEPROM id_check
 +
 +# Return code:
 +# 0 = no EEPROM or no device tree found
 +# 1 = HAT found but not a UDRC
 +# 2 = UDRC
 +# 3 = UDRC II
 +# 4 = DRAWS
 +# 5 = 1WSpot
 +
 +function id_check() {
 +# Initialize to EEPROM not found
 +udrc_prod_id=0
 +
 +# Does firmware file exist
 +if [ -f $firmware_prodfile ] ; then
 +   # Read product file
 +   ​UDRC_PROD="​$(tr -d '​\0'​ < $firmware_prodfile)"​
 +   # Read vendor file
 +   ​FIRM_VENDOR="​$(tr -d '​\0'​ < $firmware_vendorfile)"​
 +   # Read product id file
 +   ​UDRC_ID="​$(tr -d '​\0'​ < $firmware_prod_idfile)"​
 +   #get last character in product id file
 +   ​UDRC_ID=${UDRC_ID:​ -1}
 +
 +   ​dbgecho "​UDRC_PROD:​ $UDRC_PROD, ID: $UDRC_ID"​
 +
 +   if [[ "​$FIRM_VENDOR"​ == "​$NWDIG_VENDOR_NAME"​ ]] ; then
 +      case $UDRC_PROD in
 +         "​Universal Digital Radio Controller"​)
 +            udrc_prod_id=2
 +         ;;
 +         "​Universal Digital Radio Controller II")
 +            udrc_prod_id=3
 +         ;;
 +         "​Digital Radio Amateur Work Station"​)
 +            udrc_prod_id=4
 +         ;;
 +         "​1WSpot"​)
 +            udrc_prod_id=5
 +         ;;
 +         *)
 +            echo "Found something but not a UDRC: $UDRC_PROD"​
 +            udrc_prod_id=1
 +         ;;
 +      esac
 +   else
 +
 +      dbgecho "​Probably not a NW Digital Radio product: $FIRM_VENDOR"​
 +      udrc_prod_id=1
 +   fi
 +
 +   if [ udrc_prod_id != 0 ] && [ udrc_prod_id != 1 ] ; then
 +      if (( UDRC_ID == udrc_prod_id )) ; then
 +         ​dbgecho "​Product ID match: $udrc_prod_id"​
 +      else
 +         echo "​Product ID MISMATCH $UDRC_ID : $udrc_prod_id"​
 +         ​udrc_prod_id=1
 +      fi
 +   fi
 +   ​dbgecho "Found HAT for ${PROD_ID_NAMES[$UDRC_ID]} with product ID: $UDRC_ID"​
 +else
 +   # RPi HAT ID EEPROM may not have been programmed in engineering samples
 +   # or there is no RPi HAT installed.
 +   ​udrc_prod_id=0
 +fi
 +
 +return $udrc_prod_id
 +}
 +
 +# ===== main =====
 +
 +echo "​ax25-upd:​ Start Port ${PORTNAME_1} with device ${SERIALPORT_DIREWOLF}"​
 +
 +if [ -L $SERIALPORT_DIREWOLF ] ; then
 +    echo "​Direwolf serial port ready"
 +else
 +    echo "​Direwolf serial port NOT FOUND"
 +d    exit 1
 +fi
 +
 +# Check which UDRC product is found
 +id_check
 +id_check_ret="​$?"​
 +
 +# Initialize kissattach return code
 +kissattach_ret=-1
 +
 +case $id_check_ret in
 +0|1)
 +   echo "No UDRC found, exiting"​
 +   exit 1
 +;;
 +2)
 +   echo "​Original UDRC is installed."​
 +# use port 1 with mkiss
 +   ​pseudoterm=$($SBINDIR/​mkiss $SERIALPORT_DIREWOLF /dev/ptmx none | tail -1)
 +   echo "using mkiss with UDRC and pseudo term=$pseudoterm on port 1"
 +   ​$SBINDIR/​kissattach ​ ${pseudoterm} ${PORTNAME_1} 44.24.197.66 >/​tmp/​ax25-config.tmp
 +   ​kissattach_ret=$?​
 +   ​dbgecho "​kissattach return: $?"
 +   /​etc/​ax25/​ax25dev-parms ax0
 +;;
 +3|4)
 +   echo "UDRC II or DRAWS installed"​
 +# use port 2 with mkiss
 +   ​pseudoterm=$($SBINDIR/​mkiss $SERIALPORT_DIREWOLF /dev/ptmx /dev/ptmx | tail -1)
 +   echo "​$pseudoterm"​ > /​tmp/​ax25-config.tmp
 +   ​pseudoterm_1=$(echo $pseudoterm | cut -d ' ' -f1)
 +   ​pseudoterm_2=$(echo $pseudoterm | cut -d ' ' -f2)
 +   echo "using mkiss with UDRC II and pseudo term_1: $pseudoterm_1 pseudo term_2: $pseudoterm_2"​
 +   ​$SBINDIR/​kissattach ​ ${pseudoterm_1} ${PORTNAME_1} 44.24.197.66 >/​tmp/​ax25-config_1.tmp
 +   ​$SBINDIR/​kissattach ​ ${pseudoterm_2} ${PORTNAME_2} 44.24.197.67 >/​tmp/​ax25-config_2.tmp
 +   ​kissattach_ret=$?​
 +   ​dbgecho "​kissattach return: $?"
 +   /​etc/​ax25/​ax25dev-parms ax0
 +   /​etc/​ax25/​ax25dev-parms ax1
 +   echo " Port ${PORTNAME_1} attached to ax0"
 +   echo " Port ${PORTNAME_2} attached to ax1"
 +;;
 +5)
 +   echo "One Watt Spot installed"​
 +# use port 1 with mkiss
 +   ​pseudoterm=$($SBINDIR/​mkiss $SERIALPORT_DIREWOLF /dev/ptmx none | tail -1)
 +   echo "using mkiss with UDRC and pseudo term=$pseudoterm on port 1"
 +   ​$SBINDIR/​kissattach ​ ${pseudoterm} ${PORTNAME_1} 44.24.197.66 >/​tmp/​ax25-config.tmp
 +   ​kissattach_ret=$?​
 +   ​dbgecho "​kissattach return: $?"
 +   /​etc/​ax25/​ax25dev-parms ax0
 +;;
 +*)
 +   echo "​Invalid udrc id ... exiting"​
 +   exit 1
 +;;
 +esac
 +
 +# configure netrom
 +# Needs a callsign
 +# source /​home/​pi/​n7nix/​systemd/​ax25/​nr-up.sh
 +
 +# AX25-upd (End)
 +echo
 +echo "​ax25-upd script finished"​
 +exit 0
 +</​file>​
 +=== ax25-downd ===
 +<​file>​
 +#!/bin/bash
 +#
 +SBINPATH="/​usr/​local/​sbin"​
 +
 +echo "​ax25-downd start"
 +# Stop FPAC
 +#    /​usr/​local/​sbin/​myfpac.sh stop
 +
 +# Stop Ax25 support
 +#  for PROC_NAME in beacon ax25d ax25ipd ax25rtd mheardd listen saxIgate
 +  for PROC_NAME in beacon ax25d ax25ipd ax25rtd mheardd saxIgate
 +    do
 +      PID=`/​bin/​pidof -x $PROC_NAME`
 +      if [ -n "​$PID"​ ]; then
 +         kill -TERM $PID > /dev/null
 +         echo "​$PROC_NAME - $PID "
 +         sleep 1
 +      fi
 +    done
 +
 +# If netromd is running
 +  pidof netromd > /dev/null
 +  if [ $? -eq 0 ]; then
 +
 +# Save NetRom routes
 +   ​$SBINPATH/​nodesave -p $SBINPATH /​var/​ax25/​nrsave && echo "N/R routes saved"
 +
 +# Stop NetRom
 +    killall netromd > /dev/null
 +    echo "​Netrom Stopped"​
 +  else
 +    echo "​Netrom daemon not running"​
 +  fi
 +
 +# Close sockets
 +echo "​Detach Ax/Nr/Sp Devices"​
 +
 +ifconfig|grep AMPR > /​tmp/​ax25-config.tmp
 +
 +i=0
 +iface=$(awk ' NR == '​1'​ { print $1 }' /​tmp/​ax25-config.tmp)
 +
 +while [ "​$iface"​ != ""​ ] ; do
 +   let i=i+1
 +   ​iface=$(awk ' NR == '​$i'​ { print $1 }' /​tmp/​ax25-config.tmp)
 +   if [ "​$iface"​ != ""​ ] && [ "​${iface:​0:​2}"​ == "​nr"​ ] ; then
 +#      echo "​select:​ $iface, iface: ${iface:​0:​2}"​
 +      ifconfig "​$iface"​ down
 +      echo " $iface down"
 +  fi
 +done
 +
 +# Stop Kissattach
 +killall -KILL kissattach > /dev/null
 +# Empty Heard List
 +#cat /dev/null > /​var/​ax25/​mheard/​mheard.dat
 +
 +# End of ax25-down
 +echo "​ax25-downd finished"​
 +exit 0
 +</​file>​
 +=== axports ===
 +<​file>​
 +# /​usr/​local/​etc/​ax25/​axports
 +#
 +# Use simple descriptive names for the ports, to make debugging ​
 +# other associated software easier.
 +
 +#
 +# The format of this file is:
 +#​portname callsign speed paclen window description
 +udr0            N7NIX-10 ​       9600    255     ​2 ​      ​Winlink
 +</​file>​
 +=== ax25d.conf ===
 +<​file>​
 +# /​usr/​local/​etc/​ax25/​ax25d.conf
 +#
 +# ax25d Configuration File.
 +#
 +#
 +[N7NIX-10 VIA udr0]
 +NOCALL ​  * * * * * *  L
 +NOCALL ​  * * * * * *  L
 +default ​ * * * * * *  - rmsgw /​usr/​local/​bin/​rmsgw rmsgw -l debug -P %d %U
 +#
 +[N7NIX VIA udr0]
 +NOCALL ​  * * * * * *  L
 +default ​ * * * * * *  0  gunn  /​usr/​local/​bin/​wl2kax25d wl2kax25d -c %U -a %d
 +#
 </​file>​ </​file>​
plu/example_config_files/systemd.txt ยท Last modified: 2018/11/23 15:55 by gunn
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0