BPQ32 Example Telnet port

Example for a Telnet port

PORT
 PORTNUM=2
 ID=Telnet
 DRIVER=Telnet
 QUALITY=0
CONFIG
 CMS=1
 CMSCALL=NOCALL
 CMSPASS=****************
 RELAYAPPL=BBS
 LOGGING=1
 DisconnectOnClose=1
 TCPPORT=8010
 FBBPORT=8011
 HTTPPORT=8012
 LOGINPROMPT=user:
 PASSWORDPROMPT=password:
 MAXSESSIONS=15
 CTEXT=Welcome to NOCALL's Telnet Server\nEnter ? for list of commands\n\n
 
 USER=user,passwd,CALL,"",sysop
ENDPORT

 

BPQ32 Example Direwolf port

Example for a Direwolf port

PORT
 PORTNUM=1                ; Optional but sets port number if stated
 ID=BPQ 144.850MHZ        ; 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=NOCALL           ; BTEXT broadcast addrs format:
                          ; DEST[,digi1[,digi2]]
 BCALL=NOCALL             ; 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

 

BPQ32 Example Kiss Port

Example for a Kiss port

PORT
 PORTNUM=1                ; Optional but sets port number if stated
 ID=BPQ 144.850MHZ        ; Displayed by PORTS command
 TYPE=ASYNC               ; Port is RS232 Com
 PROTOCOL=KISS            ; TNC is used in KISS,or BPQKISS mode
 COMPORT=/dev/ttyUSB0     ; Comport
 SPEED=9600               ; RS232 COM PORT SPEED
 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=NOCALL           ; BTEXT broadcast addrs format:
                          ; DEST[,digi1[,digi2]]
 BCALL=NOCALL             ; 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

 

Watchdog

I use watchdog to monitor my RPI. Do services go offline or the RPI is not responding, watchdog kicks in and restart the system. Now I also want watchdog to watch my Linbpq. This is possible with watchdog, watchdog looks at a PID file. As far as I know, no PID file is created when starting Linbpq.

Now there is a possibility that when starting Linbpq with systemd a command can be given so that a PID file is created.

This is my linbpq.service file from systemd

pd9q@packet:~ $ sudo cat /etc/systemd/system/linbpq.service
[Unit]
Description=Linbpq Daemon
After=network.target
After=direwolf.target
StartLimitInterval=0

[Service]
Type=simple
Restart=always
RestartSec=5
ExecStartPost=/bin/sh -c "echo $MAINPID > /home/pd9q/linbpq/run/linbpq.pid"
ExecStart=/bin/bash /home/pd9q/linbpq/linbpq.start
WorkingDirectory=/home/pd9q/linbpq

[Install]
WantedBy=multi-user.target
Alias=linbpq.service

This command creates a linbpq.pid file, now it is possible that watchdog monitors linbpq.

ExecStartPost=/bin/sh -c "echo $MAINPID > /home/pd9q/linbpq/run/linbpq.pid"
pd9q@packet:~ $ sudo ls -l /home/pd9q/linbpq/run
-rw-r--r-- 1 root root 4 Oct 14 18:36 linbpq.pid
pd9q@packet:~ $

At the end of my watchdog configuration file (/etc/watchdog.conf) I have added the following line.

# Check if Linbpq is running
pidfile         = /home/pd9q/linbpq/run/linbpq.pid

Take a look at what happens when you stop Linbpq.

sudo systemctl stop linbpq.service

Yes the system is ReBoOtInG (I hoop)

Xfbb interface with Linbpq

In bpq32.cfg add

TNCPORT
COMPORT=/home/pi/fbbded
TYPE=DED
STREAMS=1
APPLMASK=4
ENDPORT

This creates a DED Host mode TNC on device /home/pi/fbbded, accessible from the LinBPQ Node as Application 3. Change APPLMASK and APPLICATION line if you already use APPL 3

APPLICATION 3,FBB,,PI1LAP,LINBBS,255

This allows uses to connect to FBB. You can add the usual Call, Alias and Quality if you want to be able to access FBB directly instead of via the Node.

Change APPLMASK and APPLICATION line if you already use APPL 3

In /usr/local/etc/ax25/fbb/port.sys#

# FBB7.0.8-beta8
#
#Ports TNCs
1 1
#
#Com Interface Adress (Hex) Baud
1 9 /home/pi/fbbded 9600
#
#TNC NbCh Com MultCh Pacln Maxfr NbFwd MxBloc M/P-Fwd Mode Freq 0 0 0 0 0 0 0 0 00/01 —- File-fwd.
1 6 1 1 250 2 1 10 00/15 DUWYL 145
#
# End of file.
#

This tells fbb to use /home/pi/fbbded as a DED Mode TNC.

Installing Direwolf and LinBPQ on Raspian Stretch

Jeff KP3FT has written a nice document about the installation of Direwolf and Linbpq on a Raspberry with raspbian Stretch. Download the complet document here.

Dire Wolf

Installing Direwolf and linBPQ on a new Raspian Stretch installation.  It’s a combination from various websites and documentation, condensed down into a straightforward walkthrough.  This doesn’t include configuration of most BPQ settings, only enough to get it to use Direwolf as a modem.

Older Raspian versions like Jessie may require Pulse Audio removed first, prior to installing Direwolf.  Raspian Stretch by default does not have Pulse Audio installed.  My Raspian config settings have SSH and VNC enabled.

First:

sudo apt-get update
sudo apt-get upgrade
sudo reboot now

After it restarts, install libasound:

sudo apt-get install libasound2-dev

Optionally install the following if you want to enable Direwolf to use the GPIO pin on certain USB sound devices for PTT:

sudo apt-get install libudev-dev

Then install Direwolf (as of this writing, version 1.5 is the latest):

cd ~
git clone https://www.github.com/wb2osz/direwolf
cd ~/direwolf
git tag
git checkout 1.5
make -j 
sudo make install 
make install-rpi
make install-conf

Plug your USB sound device(s) into the RPi, open a terminal, and run the following to verify the system sees the USB sound device(s).

aplay -l (the smallcase letter "l", not the number "1")

If the Raspberry pi’s onboard audio is enabled, it will show up as Card 0, Device 0.  The USB sound device should show up as Card 1, Device 0.  A second USB sound device will show up as Card 2, Device 0, and so on.

Open the direwolf.conf file in a text-editor, scroll down, and enable the correct USB sound device by removing the # at the beginning of the appropriate line.  For example, on mine it is:

ADEVICE  plughw:1,0

Scroll down and change “N0CALL” to your callsign in the line:

MYCALL N0CALL

Enable the modem speed you want.  In my case, I enable 300-baud:

MODEM 300

Scroll down and enable the appropriate PTT option for your setup.
Further down, enable and change the AGWPORT and KISSPORT settings for your setup.
Optionally disable all the APRS-related lines if you don’t want to use those functions.

Save the file and run Direwolf by double-clicking the desktop icon, or test-run it from Terminal with:

cd ~
direwolf

You should see packet activity if the radio is tuned on the right frequency and audio level is good.

Close Direwolf for now (CTRL-C) and install pilinBPQ (skip down to the Direwolf port section if pilinBPQ is already installed):

sudo mkdir linbpq
cd linbpq
sudo wget http://www.cantab.net/users/john.wiseman/Downloads/Beta/pilinbpq
sudo mv pilinbpq linbpq
sudo chmod +x linbpq
sudo su
setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
su pi
sudo mkdir HTML
cd HTML
sudo wget http://www.cantab.net/users/john.wiseman/Downloads/Beta/HTMLPages.zip
sudo unzip HTMLPages.zip
cd ~/linbpq
sudo mkdir BPQAPRS
cd BPQAPRS
sudo wget http://www.cantab.net/users/john.wiseman/Documents/Samples/APRSHTML.zip
sudo unzip APRSHTML.zip
cd ~
sudo chown -R pi:pi linbpq

Copy an existing Linux bpq32.cfg from another source to /pi/linbpq. I have an old bpq32.cfg file here which would need some substantial editing for your own setup:

https://www.qsl.net/swlkp3/Packet/bpq32(Linux).cfg .

Be sure to rename it to bpq32.cfg .If you don’t use the above bpq32.cfg file, and add one or both of these Direwolf ports in the ports section of whatever copy of bpq32.cfg you have, depending on how many Direwolf modems you want to run.  Change the port numbers to whatever works with your particular setup.  The timing settings can also be changed; these are what worked with my setup for 300-baud HF packet and 1200-baud VHF packet.

;******PORT 1 Direwolf 300-baud*****
PORT
   PORTNUM=1                 ; Port number
   ID=HF Packet 300-baud     ; PORTS command text
   TYPE=ASYNC                ; RS232 connection
   IPADDR=127.0.0.1          ; DIREWOLF
   TCPPORT=8001              ; DIREWOLF
   SPEED=19200
   CHANNEL=A                 ; TNC channel
   MAXFRAME=1                ; Max outstanding frames
   FRACK=5000                ; Level 2 timeout (ms)
   RESPTIME=40               ; Level 2 delayed ACK (ms)
   RETRIES=10                ; Level 2 max retries
   PACLEN=40                 ; Max packet length (bytes)
   TXDELAY=100               ; Transmit keyup delay (ms)
   SLOTTIME=100            ; CMSA interval timer (ms)
   TXTAIL=30
   PERSIST=63     ; Persistence (256/(# transmissions-1)
   DIGIFLAG=1       ; Allow Digipeat on this port
ENDPORT
;****** PORT 2 Direwolf 1200-baud *****
PORT
   PORTNUM=2                 ; Port number
   ID=VHF Packet 1200-baud   ; PORTS command text
   TYPE=ASYNC                ; RS232 connection
   IPADDR=127.0.0.1          ; DIREWOLF
   TCPPORT=8003              ; DIREWOLF
   SPEED=19200
   CHANNEL=A                 ; TNC channel
   MAXFRAME=1                ; Max outstanding frames
   FRACK=5000                ; Level 2 timeout (ms)
   RESPTIME=40               ; Level 2 delayed ACK (ms)
   RETRIES=10                ; Level 2 max retries
   PACLEN=236                 ; Max packet length (bytes)
   TXDELAY=100               ; Transmit keyup delay (ms)
   SLOTTIME=100            ; CMSA interval timer (ms)
   TXTAIL=30
   PERSIST=63     ; Persistence (256/(# transmissions-1)
   DIGIFLAG=1       ; Allow Digipeat on this port
ENDPORT

Save the file.

Start Direwolf.

Open another Terminal and start linBPQ:

cd ~/linbpq
sudo -u pi ./linbpq

It should connect to Direwolf(s) on port 127.0.0.1:8001 or whatever port(s) you set up.

Notes:
——
Multiple instances of Direwolf can run at the same time.  Each instance has its own “.conf” file.  Each conf file needs to be edited to enable whatever port and USB sound device will be used.  To do that, just edit the original “direwolf.conf” file and save it under a new name, such as “direwolf_HF.conf”, etc.  Start each instance in Terminal using the “-c” switch to point Direwolf to the correct “.conf” file.  In my setup, I start the first Direwolf instance in Terminal with “direwolf -c direwolf.conf”.  The second instance is started in another Terminal with “direwolf -c direwolf_HF.conf”.

Direwolf has several options that can be used in the command line.  Three that I find particularly useful are the “-q”, -T”, and “-x” options.  By default, Direwolf shows audio in/out levels in its Terminal screen.  This can be turned off with “-q h”.  For example, when I run my HF 300-baud instance of Direwolf to disable audio reports, I run “direwolf -c direwolf_HF.conf -q h”

To show timestamps of sent and received packet frames, use the “-T” option with “%H:%M:%S”.  Example: “direwolf -c direwolf_HF.conf -q h -T %H:%M:%S” to disable audio reporting and show timestamds in hours-minutes-seconds format.

The “-x” option immediately starts Direwolf transmitting calibration tones, which I use mostly to key the transciever for tuning the antenna when I switch bands.  Example: “direwolf -c direwolf_HF.conf -q h -T %H:%M:%S -x”.  Enter CNTRL-C to stop the transmit.

The complete list of command-line options are in the Direwolf user guide, pages 126 through 128: https://github.com/wb2osz/direwolf/tree/master/doc

Fldigi and BPQ32

KP3FT post a example of how to setup FLdigi and BPQ32.

In the bpq.cfg driver settings, you will have to make changes for your own setup, but it does work.  For example, set the path to wherever your FLdigi executable is on your computer.  Also, set the default FLDigi mode to what you want.  In mine, the line “DEFAULTMODEM=PSK250R/1300” sets it to start FLDigi’s robust version of PSK-250 at 1300-hz waterfall frequency

bpq32.cfg

; FLDIGI KISS AX25
PORT
 PORTNUM=3
 ID=FLDigi
 DRIVER=fldigi
 KISSOPTIONS=FLDIGI
 PACLEN=30
 CONFIG
  ADDR 127.0.0.1 7342 PATH C:\fldigi4016-17\Fldigi-4.0.16.07\fldigi.exe
  TIMEOUT=10
  RETRIES=6
  WINDOW=16
  DEFAULTMODEM PSK250R/1300
  UPDATEMAP
ENDPORT

FLdigi Setup

 

Bpq32 Log options

John G8BPQ has made it possible to move the log dir of linbpq and pilinbpq. Nice

I’ve uploaded versions of linbpq and pilinbpq to my beta download site
that allow you to move the log directory. Start with a command line
parameter of logdir=directory, eg

../pilinbpq logdir=/dev/shm

 

You can download the new version here.

http://www.cantab.net/users/john.wiseman/Documents/Downloads.html

LinBPQ Applications Interface.

LinBPQ has a facility to make a tcp connection from the node to an application running on the same machine. This was originally intended to connect to a shell to enable basic configuration editing, but has been generalised to allow connects to other tcp ports, thus allowing you to write your own applications to be used with LinBPQ.

Edit
Henk, pointed out that there was something missing in this story. Nowadays we mainly work with Systemd in the newer version of Linux. So the inetd (internet super server) is no longer part of this. But you can still install it. “sudo apt-get install inetutils-inetd” or the successor to inetd the Xinetd “sudo apt-get install xinetd”
Thank you Henk…

Ok, that sounds nice. Let give it a try.

Fist setup Linbpq, add de “cmdport” to the telnet port section.

PORT
 PORTNUM=4                      ; Optional but sets port number if stated
 ID=Telnet
 DRIVER=Telnet

CONFIG
 CMS=1
 CMSCALL=PI1LAP
 CMSPASS=**********
 LOGGING=1
 DisconnectOnClose=1
 CMDPORT 63000
 TCPPORT=6309
 FBBPORT=6306
 HTTPPORT=****
 LOGINPROMPT=User:
 PASSWORDPROMPT=Password:
 MAXSESSIONS=10
 CTEXT=Welcome to PI1LAP`s Telnet Server.\nPress ? For list of commands \n\n
 USER=pd9q,pass,PD9Q,,SYSOP
ENDPORT

I have add “CMDPORT 63000” but it can by any number.

Now add a Application at the end of de bpq32.cfg

APPLICATION 7,APP,C 4 HOST 0 S

Now we have to add some stuff to /etc/services and /etc/inetd.conf

/etc/services

# Local services
bpqdemo        63000/tcp   # BPQ Demo App

/etc/inetd.conf

bpqdemo    stream    tcp    nowait    pd9q  /usr/local/linbpq/testapp.pl

Now restart inetd. sudo killall -1 inetd

I have found a small script on the internet and make some adjustments.
This script is using some perl modules that has to be installed.

cpanm Linux::SysInfo
cpanm Sys::Info
cpanm Sys::Load
cpanm Sys::MemInfo
cpanm Sys::CpuLoad

The testapp.pl script. /usr/local/linbpq/testapp.pl

#!/usr/bin/perl -w -T

# Simple information script 10/2018. PD9Q/PI1LAP

use strict;
use Sys::Info;
use Sys::Info::Constants qw( :device_cpu );
use Sys::Load qw/getload uptime/;
use Sys::MemInfo qw(totalmem freemem totalswap);
use Sys::CpuLoad;

   my $info = Sys::Info->new;
   my $cpu = $info->device('CPU');
   my $os  = $info->os;

   my $old_fh = select(STDOUT);
$| = 1;
select($old_fh);

my $line = <STDIN>;

   print "Hello " . $line . "Welcome to the LinBPQ System Info App of PI1LAP.\n";
   printf "\nWe have %s ", scalar $cpu->count;
   printf "%s-bit CPU", scalar $cpu->bitness;
   printf " %s\n", scalar $cpu->identify;
   printf "The CPU speed is: %s\n\n", scalar $cpu->speed;
   print "Operating System is\n", $os->name( long => 1 );

   print "\n\nSystem load: ", (getload())[0], "\n";
   print "System uptime: ", int uptime(), "\n\n";

   print 'load average: ',
       join(',', Sys::CpuLoad::load()), "\n\n";

   print "Total memory: ".(&totalmem / 1024)."\n";
   print "Free memory:  ".(&freemem / 1024)."\n";

   print "Total swap: ".(&totalswap / 1024)."\n";
   print "Free swap:  ".(Sys::MemInfo::get("freeswap") / 1024)."\n\n";
   print "Type exit to close\n";

while( my $line = <STDIN> )
{
    $line =~ s/\r?\n$//;
    if ($line =~ /exit/)
    {
                die "shutting down, bye,bye\n";
        }

        # do your processing here!

        print "  $line\n";
}

Now we can run the script from linbpq. Let give it a try.

root@gw:/usr/local/linbpq# telnet localhost 6309
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
User:pd9q
Password:

Welcome to PI1LAP`s Telnet Server.
Press ? For list of commands

app
Connected to APP
Hello PD9Q
Welcome to the LinBPQ System Info App of PI1LAP.

We have 1 32-bit CPU Intel(R) Pentium(R) 4 CPU 3.00GHz
The CPU speed is: 2992.432

Operating System is
Debian Linux 8.10 (kernel: 3.16.0-4-686-pae)

System load: 0.07
System uptime: 1211163

load average: 0.07,0.04,0.00

Total memory: 2062392
Free memory:  440452
Total swap: 2783228
Free swap:  2745472

Type exit to close
exit
shutting down, bye,bye
Returned to Node LAPBPQ:PI1LAP-9

http://www.cantab.net/users/john.wiseman/Documents/LinBPQ%20Applications%20Interface.html