Udev Rules in Linux

I became very frustrated with the fact that my USB ports kept changing. I have a TNC2S 1k2 for Aprs and an SCS Tracker for Robust Packet connected to my Pi. The Icom 7300 is controlled via HamLib on another Raspberry Pi. But once it was necessary to reboot the PI running Linbpq , the ttyUSB0 or the ttyUSB1 would keep changing places. Conclusion, I had to adjust the bpq32.cfg again before everything worked the way I wanted.

Now it is quite easy to do something about this. Call me Lazy because it took so long.

Udev rules look like this

SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303",
SYMLINK+="ttyTNC2S

Now, of course, we first have to find out what the “idVendor” and “idProduct” is.

With the command….

udevadm info -a -n /dev/ttyUSB0

We get a long list of data from usb to serial port ttyUSB0.

With this information we can create an udev rule.

sudo nano etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303",
SYMLINK+="ttyTNC2S
udevadm control --reload
reboot

This has been done for both sides. Both ttyUSB0 and ttyUSB1. And look there are the ttyTNC2S and ttySCS ports. Now you can restart Linux as often as you want and trust that the same USB port is always assigned to the right box.

Now my port config looks like this in bpq32.cfg.

PORT
 PORTNUM=3
 ID=14.1022 RPR ;(RPR)
 TYPE=EXTERNAL 
 COMPORT=/dev/ttySCS
 SPEED=38400
 DRIVER=SCSTracker
 CONFIG
RIGCONTROL
HAMLIB 44.137.31.76:4532
14.1022,USB,F1,H1
****
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 14102200, ROBUST, 25, 35, 3
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 14102200, PKT300, 25, 35, 3
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 144850000, PKT1200, 10, 20, 5, 0
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 430950000, PKT9600, 10, 20, 5, 0
;#
  M UISC
  O 4                   ; MAXFRAME
  F 190                 ; FRACK
  T 8                   ; TX Delay
  FORCE ROBUST
  USEAPPLCALLS          ; Accept connects to all APPLCALLS
  BEACONAFTERSESSION    ; Beacon after session
  %L 1500               ; Centre Freq for Normal Packet (Default is 1500)
  @I 64                 ; Paclen = 60
  %T 1                  ; TX Autotracking 1 = on
  %N 10
  %B 300
ENDPORT

Great…..

XRpi interfacing with LinFBB

Software is available on this link

Wow, found great software. Yes I know, it has been around for a while. I thought it would be nice to keep me busy on a rainy Saturday. So let’s interface it with LinFBB.

It actually works a bit like BPQ32 and LinFBB with WA8DED emulation. But for XRouter and LinFBB we need a virtual comport. We can make these easily with socat.

sudo apt install socat

Now lets create some comports

# Create pty pair
socat -d -d -ly PTY,link=/home/pi/xrpi/ttyq1 PTY,link=/home/pi/xrpi/ptyq1 &
sleep 2

I have chosen to create this as a normal user and put it in the directory /home/pi/xrpi/. Now as a normal user I can access and use them. I am never much of a fan of doing everything as a Root user.

Now lets configure XRouter.

INTERFACE=5
	TYPE=ASYNC
	COM=/home/pi/xrpi/ttyq1
	PROTOCOL=DEDHOST
	APPLNUM=1
	CHANNELS=4
	SPEED=57600
	FLOW=0
	MTU=256
ENDINTERFACE

APPL=1
	APPLNAME=FBB
	APPLCALL=PI8LAP-1
	APPLALIAS=LAPFBB
	APPLQUAL=254
	APPLFLAGS=4
ENDAPPL

Next is LinFBB… port.sys

# FBB7.0.8-beta8
#
#Ports TNCs
 1     1
#
#Com Interface Adress (Hex)       Baud
1  	 9        /home/pi/xrpi/ptyq1    57600
 
#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   4    1   1      236   4     1     10     00/15 DUWYL XRpi

Now fist create a start file for XRpi

# First kill running process of socat
sudo kill $(ps aux | grep '[s]ocat' | awk '{print $2}')
# Create pty pair
socat -d -d -ly PTY,link=/home/pi/xrpi/ttyq1 PTY,link=/home/pi/xrpi/ptyq1 &
sleep 2
# Start XRpi(1)
sudo setcap cap_net_raw,cap_net_bind_service=pe xrpi
./xrpi

1. As Normal user, it will need CAP_NET_RAW capability in order to use TCP/IP via the LAN, WiFi or localhost. And it will need CAP_NET_BIND_SERVICE if you wish to open any “service ports” on the linux TCP/IP stack whose numbers are below 1024.

First we have to start XRpi because of course the virtual comports have to be created. After this it is LinFBB’s turn. Now is the time to test.

The link with BPQ32 is also online. Also with virtual comports.

And yes, there is the old trusted LinFBB.

The possibilities are endless with this software. So there goes me free Saturday again.

MHSave and Python

Today I am playing with Python and Matplotlib. In BPQ32 you have the option to save the Most Heard list (MH) when you close BPQ32. This contains a lot of data that you can use. Above I made a plot of the received stations and the number of packets I received at 14.1022Mhz + 1000Hz at 300Baud. Now I am not a world programmer, so this could probably be easier or different. Below the script I have written and used.

#!/usr/bin/python3
import re, csv, zlib
import matplotlib.pyplot as plt
import numpy as np

#First get the data form the right port. 14.1022Mhz 300 Baud HF Packet

port4 = []

with open("MHSave.txt") as f:
        found_port4 = False

        for line in f:
                if line.startswith("Port:4"):

                        found_port4 = True

                if found_port4:
                        if line.startswith("Port:5"):
                                break
                        else:
                                mod_string = line.replace('||', '')
                                mod_strings = re.sub("via.*$", "", mod_string)
                                port4.append(mod_strings.rstrip('\n'))

with open('port4.txt', 'w') as fout:
        fout.writelines("\n".join(port4[1:]))

#print("\n".join(port4))

# Convert it to a csv file
with open('port4.txt', 'r') as in_file:
    lines = in_file.read().splitlines()
    stripped = [line.replace(","," ").split() for line in lines]
    grouped = zip(*[stripped]*1)
    with open('port4.csv', 'w') as out_file:
        writer = csv.writer(out_file)
        writer.writerow(('Epoch', 'Pack-rev', 'Call', 'Month', 'Day', 'Time'))
        for group in grouped:
            writer.writerows(group) 

# Matplotlib create a nice Plot of the received calls

filename = 'port4.csv'
with open(filename) as f:
    reader = csv.reader(f)
    header_row = next(reader)

    #Get Packets and Calls received
    packs, calls = [], []
    for row in reader:
        pack = int(row[1])
        call = str(row[2])
        packs.append(pack)
        calls.append(call)

x = np.arange(len(calls))

fig, ax = plt.subplots()

ax.barh(x, packs, align='center')
ax.set_title("Call and Packets received on PI1LAP")
ax.set_xlabel('Received Packets')
ax.set_ylabel('Station Callsigns')
ax.set_xticks(packs, minor=True)
ax.set_yticks(x)
ax.set_yticklabels(calls)
plt.tight_layout()
plt.show()

Kantronics KPC4

Today I have been working on a Kantronics KPC4 which I bought from PD4R. I am very happy that I can add it to the collection.

Kantronics KAM_KPC-1-2-4-2400_Installation Manual
Kantronics KAM_KPC-1-2-4-2400_Operations Manual

Kantronics KPC4 Firmware

The nice thing is that such modems can also be accessed from BPQ32. Here is a small example.

PORT
 ID=Serial TNC KPC4
 COMPORT=/dev/ttyUSB1
 SPEED=9600
 DRIVER=SERIAL
 QUALITY=0
 PORTCALL=PI1LAP
ENDPORT

Bpq32 with QtSoundModem and Hamlib

Yesterday I added 2 HF ports to my Bpq32 Node / BBS. I have chosen to use QtSoundModem and Hamlib. QtSoundModem is a Linux port or Soundmodem from UZ7HO. I use Hamlib/rigctld to take control of the Tranceiver. QtSoundmodem and Hamlib run on a different Raspberry than the BBS and Node.

After some testing I found out that I need Hamlib version 3.3 to control the icom 7300. The versions 4.0 and 4.1 do not work for me. Apparently the icom 7300 is not being initialized. Can’t actually find out why this is. With the command “rigctld -l” you get a list of which tranceivers are supported.

So I need number 373 for the Icom 7300.

/usr/local/bin/rigctld -m 373 -r /dev/ttyUSB0 -s 19200 -T 44.137.31.76 -t 4532 &

In the QtSoundModem.ini I have in the [Init] section.

HamLibHost=44.137.31.76
HamLibPort=4532
PTT=HAMLIB
PTTBAUD=19200
PTTMode=17

Now the bpq32.cfg

PORT
 PORTNUM=4
 ID=14.1022 +1100Hz
 DRIVER=UZ7HO
 CHANNEL=A
 PACLEN=80
 CONFIG
  ADDR 44.137.31.76 8101 ; AGW port of QtSoundModem
  BEACONAFTERSESSION
  MAXSESSIONS=5
ENDPORT

PORT
 PORTNUM=5
 ID=14.1022 +2000Hz
 DRIVER=UZ7HO
 CHANNEL=B
 PACLEN=80
 CONFIG
  ADDR 44.137.31.76 8101 ; AGW port of QtSoundModem
  BEACONAFTERSESSION
  MAXSESSIONS=5
ENDPORT

With Hamlib it is also possible to control the TRX from Bpq32. I immediately added a Robust 300 packet port to Bpq32 with rig control. Here is an example.

PORT
 PORTNUM=3
 ID=Robust 300 ;(RPR Packet)
 TYPE=EXTERNAL 
 COMPORT=/dev/ttyUSB0
 SPEED=38400
 DRIVER=SCSTracker
 INTERLOCK=3
 CONFIG
 RIGCONTROL
HAMLIB 44.137.31.76:4532
15,14.1022,USB,F1,R1,H1
15,7.04510,USB,F1,R1,H1
****
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 14102200, ROBUST, 25, 35, 3
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 14102200, PKT300, 25, 35, 3
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 144850000, PKT1200, 10, 20, 5, 0
WL2KREPORT PUBLIC, api.winlink.org, 80, PI8LAP-10, JO11VN, 00-23, 430950000, PKT9600, 10, 20, 5, 0
;#
  M UISC
  O 4                   ; MAXFRAME
  F 190                 ; FRACK
  T 8                   ; TX Delay
  FORCE ROBUST
  USEAPPLCALLS          ; Accept connects to all APPLCALLS
  BEACONAFTERSESSION    ; Beacon after session
  %L 1500               ; Centre Freq for Normal Packet (Default is 1500)
  @I 64                 ; Paclen = 60
  %T 1                  ; TX Autotracking 1 = on
  %N 10
  %B 300
ENDPORT

/var/log/syslog

Apr  4 16:34:41 pi1lap : Initialising Port 01     TCPKISS IP 127.0.0.1 Port 8001 Chan A
Apr  4 16:34:41 pi1lap : Initialising Port 02     TCPKISS IP 127.0.0.1 Port 8001 Chan B
Apr  4 16:34:41 pi1lap : Initialising Port 03     SCSTRK /dev/ttyUSB0
Apr  4 16:34:41 pi1lap : Initialising Port 04     UZ7HO Host 44.137.31.76 Port 8101 Chan A
Apr  4 16:34:41 pi1lap : Initialising Port 05     UZ7HO Host 44.137.31.76 Port 8101 Chan B
Apr  4 16:34:41 pi1lap : Initialising Port 06     ASYNC /dev/ttyUSB1 Chan A

 

PointoPoint link between two Ninotnc`s

Today I am playing with tncattach, I thought it would be fun to test this with the Ninotnc`s.

I have connect the first Ninotnc n9600A4 to my rpi 4 and install “tncattach” on it. The TNCs are connected with each other by means of a short cable.  Cross cable. The tnc are running 9600Baud

TNC1             TNC2
RX                   TX
TX                   RX

# If you don't already have a compiler installed
sudo apt install build-essential

# Clone repository from GitHub
git clone https://github.com/markqvist/tncattach.git

# Move into source directory
cd tncattach

# Make program
make

# Install to system
sudo make install

The next thing I did was setting up a pointopoint link. But first attach the modem.

sudo tncattach /dev/ttyACM0 57600 -d --noipv6 --noup --mtu 329
sudo ifconfig tnc0 10.0.0.1 pointopoint 10.0.0.2

The second Ninotnc n9600A3 I have connected to my rpi 3

sudo tncattach /dev/ttyACM0 57600 -d --noipv6 --noup --mtu 329 
sudo ifconfig tnc0 10.0.0.2 pointopoint 10.0.0.1

I made a short video of how it works.

That was Fun….

Kantronics KAM All Mode

Today I am the lucky one again. I have added a new modem to the collection. Namely the Kantronics KAM All Mode.

The KAM is using the oldest Firmware that I know of. Version 5.00. The newest is version 8.2. Have a look at this link
Here can you find the Kam Manual.
It is the third Kantronics modem I have. I have the KPC3 (non plus) and the KPC9612 + and now the Kantronics Kam All Mode. Now I am still looking for the KPC3+

Dx Cluster PI1LAP-1

PI1LAP is Running DXSpider as Cluster Software. With Postgresql as database backend for Web Cluster http://dx.packet-radio.nl

PI1LAP is also connected to the Reverse Beacon Network (RBN). Now it is possible to see (Live) Spots from CW, BEACON, RTTY, PSK, FT8 and FT4.
Connect to PI1LAP-1 (telnet dx.packet-radio.nl 7300) and give the command “help set/skimmer” to get help about the skimmer feed.

The skimmer feed from CW and FT8 / FT4 can be overwhelming. Now there are all kinds of possibilities to filter this to specific spots. Filter help use the command “help filter” on the cluster.

# Possible Filter
To only allow FT4 spots you can use a filter
set/skimmer ft
reject/rbn 1 info ft8
show/filter # Show the rules in the filter
clear/rbn 1 or all # Delete filter rule

If you like Dx spots (just like me) you can go to “telnet dx.packet-radio.nl 7300

See ya on the Cluster.

Website DxSpider http://www.dxcluster.org/

LinFBB 7.0.10 released

  Released version 7.0.10 of Linfbb. Great news……

Download it at https://ham.packet-radio.net/packet/f6fbb/linux/recent-version/fbb-7.0.10.tar.gz
Source Link  https://sourceforge.net/projects/linfbb/files/fbb-7.0.10.tar.gz/download

Some info from Dave.

Many thanks to Brian (N1URO) for his maintenance scripts contribution and to Paul (G4APL) for his extensive tests and feedback regarding some old bugs and their fixes. Also many thanks to all other sysops using and testing the development version in the SVN repo prior to this release.

Changslog

7.0.10 (Dave van der Locht) Add date 1 Nov 2020
[r187]
- Fixed gateway using wrong FROM callsign with outgoing socket connections.
- Fixed gateway could only use port 1 to 9.
- New 20_epurmess and 20_epurwp maintenance scripts (N1URO).
- Fixed pagination issue with ? command, C (remove paging) didn't work.
- Cleaned obsolete code, fast_fwd was hard set to 1 in init.c but only used 
  in some 'if' statements. 
- Corrected satdoc.c line 384 gcc compiler warning (-Wstringop-overflow)
- Corrected behaviour of /K and /L sysop commands
- Fixed buffer overflow possibility in ibm.c getcurdir()
- Corrected several misleading indentations
- Cleaned code and comments in xfbbd.c
[r188]
- Fixed problem where inbound connections were disconnected after connect.
  with some port types when port in port.sys was higher than 9.
- Commented debugging printf code in the call_nbdos() function.
- Changed version number to 7.0.10.
[r189]
- Set SVN file properties accordingly for executable files.
- Placed autogen.sh script back in the SVN repo.
[r190]
- Fixed gateway J command only could show port 1 to 9 heard lists.
- Fixed mailbox J# command only could handle J1 to J8 (numeric) ports.
- Extended mailbox J# command (letters) a bit.
[r191]
- Detected and corrected some character encoding problems in tnc.c file.
[r192]
- Removed autotool generated files from SVN repo.
[r193]
- Accidentally removed Makefile.am. Placed back into SVN repo.
[r194]
- Fixed filename not exists error when using YAPP download command (YD).
[r195]
- Fixed housekeeping routines crashing on several newer Linux distributions.
- Changed src/Makefile.am, the -fstack-check flag conflicts with
  -fstack-clash-protection which is included by default when GCC is built with
  stack smashing protection (SSP).
- Changed README to reflect correct mailing list e-mail address.
*******************************************************************************

BPQ32 Yapp file transfer

BPQ32 and QTermTCP support the Yapp Protocol. Let’s take a look at how that works.

First we have to great a Directory  ” Files”  in the root dir of Linbpq. The user Pi must be the owner of the Directory.

cd /home/pi/linbpq
mkdir Files
ls -l
drwxr-xr-x 2 pi pi    4096 nov  1 12:10 Files
* If the user Pi does not own the directory "Files", you can change that with.
sudo chown pi:pi Files

Now we can set QTermTCP to use the directory “Files” for uploads and downloads. In the top menu choose ” Yapp” , ” Set Receive Directory” and choose the correct directory (Files).

First we need to connect to a local BBS that supports the YAPP protocol. Now I have set up a BBS here for this test. As modems I use two Ninotnc`s connected with a null modem cable.
Now we are ready to send a file. Again choose in the top menu “Yapp” and “Send File” Now you can choose which file you want to send.

Here we go…..

Monitor screen from Linbpq BBS.

File compleet.

The same file but compressed.