diff --git a/overlay/opt/emcomm-tools/bin/et-linbpq b/overlay/opt/emcomm-tools/bin/et-linbpq new file mode 100755 index 0000000..41dfbfc --- /dev/null +++ b/overlay/opt/emcomm-tools/bin/et-linbpq @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Author : Gaston Gonzalez +# Date : 8 November 2024 +# Purpose : Wrapper script for starting Linbpq +# +# Preconditions: +# 1. Supported radio and audio interface are connected and properly detected +# 2. Dire Wolf is running +# +# Postconditions: +# 1. Audio settings updated +# 2. linbpq started +# + +notify_user() { + notify-send \ + -t 10000 \ + --app-name="EmComm Tools" \ + "$1" +} + + +[ -z ${ET_LOG_DIR} ] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools" +[ ! -e ${ET_LOG_DIR} ] && mkdir -p ${ET_LOG_DIR} + +# TODO: Check that Dire Wolf is running +# TODO: Rename Linbpq to LINBPQ + +# 1. Check if the symlink was created by the udev rules +if [ -e /dev/et-audio ]; then + + # 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule + APLAY_OUT=$(arecord -l | grep ET_AUDIO) + if [ $? -eq 0 ]; then + AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}') + AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}') + Linbpq_AUDIO_DEVICE="plughw:${AUDIO_CARD},${AUDIO_DEVICE}" + + # 3. Update audio device + et-log "Using '${Linbpq_AUDIO_DEVICE}' as audio device for Linbpq." + + # 4. Configure ALSA settings for sound card + /opt/emcomm-tools/bin/et-audio update-config + + else + et-log "Can't start linbpq. No ET_AUDIO device detected." + notify_user "Select radio and plug it in" + exit 1 + fi +else + et-log "No ET_AUDIO device plugged in. No supported audio device plugged in." + notify_user "Select radio and plug it in" + exit 1 +fi + +[ -z "$ET_USER_CONFIG" ] && ET_USER_CONFIG="${HOME}/.config/emcomm-tools/user.json" + +CALLSIGN=$(cat ${ET_USER_CONFIG} | jq -r .callsign) +GRID=$(cat ${ET_USER_CONFIG} | jq -r .grid) + +cp /opt/emcomm-tools/conf/template.d/packet/bpq32.digipeater.cfg bpq32.cfg +sed -i "s|{{ET_CALLSIGN}}|${CALLSIGN}|g" bpq32.cfg +sed -i "s|{{ET_GRID}}|${GRID}|g" bpq32.cfg + +CMD="linbpq" +et-log "Starting Linbpq with: '${CMD}'" +${CMD} diff --git a/overlay/opt/emcomm-tools/conf/template.d/packet/bpq32.digipeater.cfg b/overlay/opt/emcomm-tools/conf/template.d/packet/bpq32.digipeater.cfg new file mode 100644 index 0000000..11189b9 --- /dev/null +++ b/overlay/opt/emcomm-tools/conf/template.d/packet/bpq32.digipeater.cfg @@ -0,0 +1,58 @@ +SIMPLE +LOCATOR={{ET_GRID}} +NODECALL={{ET_CALLSIGN}}-4 + +CTEXT: +Welcome to the {{ET_CALLSIGN}}-4 LinBPQ Node. +*** + +FULL_CTEXT=0 + +BTEXT: +!3742.65N/08553.17W#{{ET_CALLSIGN}} LinBPQ on EmComm Tools. +*** + +IDMSG: +TMH LinBPQ Node {{ET_CALLSIGN}}-4 +*** + +INFOMSG: +Sysop {{ET_CALLSIGN}} +*** + +MAPCOMMENT=EmComm Tools LinBPQ Node + +IDINTERVAL=15 +BTINTERVAL=15 +NODESINTERVAL=25 + +PORT + PORTNUM=1 ; Optional but sets port number if stated + ID=BPQ 145.710MHZ ; Displayed by PORTS command + TYPE=ASYNC ; Port is RS232 Com + PROTOCOL=KISS ; TNC is used in KISS,or BPQKISS mode + IPADDR=127.0.0.1 + TCPPORT=8001 + CHANNEL=A ; A single channel TNC, A or B for multichannel + NOKEEPALIVES=0 + PERSIST=160 ; PERSIST=256/(# of transmitters-1) + SLOTTIME=180 ; CMSA interval timer in milliseconds + TXDELAY=270 ; Transmit keyup delay in milliseconds + TXTAIL=23 ; TX key down, in milliseconds, at packet end + QUALITY=203 ; Quality factor applied to node broadcasts + MINQUAL=201 ; Entries in the nodes table with qualities + ; greater or equal to MINQUAL will be sent on + ; this port. A value of 0 sends everything. + MAXFRAME=6 ; Max outstanding frames (1 thru 7) + FRACK=5000 ; Level 2 timout in milliseconds + RESPTIME=1000 ; Level 2 delayed ack timer in milliseconds + RETRIES=100 ; Level 2 maximum retry value + PACLEN=236 ; Default max packet length for this port + UNPROTO={{ET_CALLSIGN}}-4; BTEXT broadcast addrs format: + ; DEST[,digi1[,digi2]] + BCALL={{ET_CALLSIGN}}-4 ; BTEXT call. unstated defaults to APPL1CALL + L3ONLY=0 ; 1=No user downlink connects on this port + DIGIFLAG=1 ; Digipeat: 0=OFF, 1=ALL, 255=UI Only + DIGIPORT=0 ; Port on which to send digi'd frames + USERS=0 ; Maximum number of L2 sessions, 0 = no limit +ENDPORT