1. Prerequisites

This project supposes you have a working AX25 configuration on your linux system. Since this is about APRS, I suppose you have at least one ax25 interface running on the local APRS frequency.

Thus, when you type

axlisten -rat

on your linux system, you see output as

radio2: fm DB0RES to APJI22 via DB0KX-2* PD0OGY-2* WIDE3-1 ctl UI pid=F0(Text) len 16 11:30:56
>Op Egbert DD9QP
radio2: fm DB0RES to APJI22 via DB0KX-2* PD0OGY-2* WIDE3* ctl UI pid=F0(Text) len 16 11:30:57
>Op Egbert DD9QP
radio2: fm DB0RES to APJI22 via DB0KX-2* PD0OGY-2* WIDE3* ctl UI pid=F0(Text) len 16 11:30:59
>Op Egbert DD9QP
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* TRACE7-7 ctl UI pid=F0(Text) len 13 11:31:00
`z2Fl .>/"4H}
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* ON0DAS-4* TRACE7-6 ctl UI pid=F0(Text) len 13 11:31:01
`z2Fl .>/"4H}
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* ON0APR* TRACE7-6 ctl UI pid=F0(Text) len 13 11:31:02
`z2Fl .>/"4H}
radio2: fm DB0RES to APJI22 via DB0KX-2* PD0OGY-2* WIDE3 ctl UI pid=F0(Text) len 16 11:31:05
>Op Egbert DD9QP
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* ON0WTO-2* ON6YF-4* ON0LRG-2* TRACE7-4 ctl UI pid=F0(Text) len 13 11:31:05
`z2Fl .>/"4H}
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* TRACE7-7 ctl UI pid=F0(Text) len 42 11:31:09
`z2Fl .>/"4C}TinyTrak3 QRV 145225 Mhz
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* ON0APR* TRACE7-6 ctl UI pid=F0(Text) len 42 11:31:10
`z2Fl .>/"4C}TinyTrak3 QRV 145225 Mhz
radio2: fm ON4CCI-9 to UPUQY4 via ON4VDV-2* ON0APR* ON0BAF-2* TRACE7-5 ctl UI pid=F0(Text) len 42 11:31:12
`z2Fl .>/"4C}TinyTrak3 QRV 145225 Mhz


2. Aprsd

2.1 Warning

Before talking about aprsd, I have a warning : there is a bug in aprsd 2.2.5-13, placing german users among others in some cases in Russia. More precise :

  • the APRS sends a position in 9° or 99° E,
  • the system uses Mic-E
  • aprsd uses the kernel AX25

Due to the bug, the DEL character (ASCII 127) and some others are misinterpreted, faulty speed/direction is the result and for users mentioned above, faulty positions are given.
More can be found on sourceforge, thanks to dk7jan who told me about it.

So please, please check your aprsd. If you use debian, I made a .deb file ready for you (see download section).
This .deb is for libstdc++5. When you use Debian lenny or later, the patch schould already be applied.

My harddisk was getting problems, and I did a clean install on a new disk. When I installed the debian aprsd source, I noticed the patch is included in the debian diffs.

2.2 Configuration

The most simple solution for UI-View to talk with linux, is to install aprsd on the linux computer. You configure UI-View to talk with aprsd on the linux computer, and voilà, done.

Some of my settings are :

rf-allow yes
filterNoGate no
history-allow yes
Trace no
logAllRF no
aprsPass yes
TncPktSpacing 1500
igateMyCall no
ConvertMicE no
trust # <-- your local network !
gate2rf ON7LDS* # <-- your call

mainport 10151


These settings permit UI-View not only to display the packets heard, but also to send packets into the APRS network (use port 'I' in UI-View).

The big drawback, however, is that you cannot give a path for your packet. Also, packets do always pass the aprsd node (packets cannot be injected directly into the network, they always have at least the aprsd node call in their path).

3. The solution

Ok, how can we solve these problems ?

  • use a TNC directly connected to your PC.
    -> But hey, this is not the setup I want. I want my linux computer to control the TNC. With aprsd I can, if I want, inject the APRS packets into the internet APRS network 24h/24h.
  • use another 'server' : i.e. a windows computer with the agwpe.
    -> Sorry, again this is definitely not what I want.
  • use another connection method from UI-View to the linux computer.

Ok, the last solution seems to be the only acceptable solution. When I open the UI-View menu In setup/comms, I have different possibilities : WINPDDE, BPQ32, AGWPE, KISS, FLEXNET, WA8DED. From these only BPQ32 and AGWPE are 'remote' connection candidates.

Since I could not get BPQ32 running in an acceptable amount of time (and it seems rather complicated to get it running on my windows computer), the only remaining candidate is agwpe.


3.1 agwpe ?

Well, what is agwpe ? In fact, if you don't know, I suppose you weren't reading till here. But if you got here and does not know what it is, check out the writer's site.

I installed agwpe on a windows 98 computer, with a baycom modem and a portable. So I was able to experiment and watch with the linux/TNC combination what happened on the air and with wireshark what happened on the network.

UI-View seems only to use a very limited set of frames to talk to agwpe. Fine. Very fine. So maybe it would be worth to try to make a linux replacement.


3.2 ldsped !

The power of open source is, among other things, you don't have to reinvent the wheel.

Ok, sometimes ,sadly, you remake a program someone already has made. You can't know them all. And I hope I did not reinvent what already was made. But even then (I'm now convincing myself) it's a nice exercise.

Here's what I did :

At first, I studied the agwpe interface. SV2AGW has a TCP/IP API tutorial document (from SV2AGW's site, download develop.zip; in it is another archive sockif.zip where you will find the mentioned document). Ethereal helped me to combine the information I found there, with the knowledge of the packets flowing to and from agwpe.

As said before, UI-View only uses some frames :

P (if necessary) to login into the packet engine,
R to check the version,
G to get the port information,
k,K and m to get and put raw AX25 packets.
Since I'm not used to program under linux, I first studied some programs that process AX25 packets, and some that connect to other computers. Out of the ax25-tools and the ax25-apps, I took a look at :

  • listen: processes heard data on the AX25 sockets and puts it into 'human readable' content,
  • beacon: injects AX25 information in the radio network,
  • mheard: holds a list of heard calls,
  • ax25mond: provides sockets where one can get the AX25 traffic

... and some other ...

Then I started to check what was absolutely necessary. And I build ... ldsped !

4. How it all fits

The communication between agwpe and the application uses a TCP connection. The application sends what the agwpe author calls a frame to the packet engine, and the engine answers with one or more frames. The definition of the frames can be found in the already mentioned document. Let's see which frames we need to get UI-View running.


4.1 P frame

One can instruct agwpe to permit only clients who login. This is not an bad idea, so the login frame (P frame) is also implemented in ldsped. In the configuration files of ldsped, several login/password combinations can be given (ldsped.conf.5 and the ldsped config doc).


4.2 R and G frames

The communication starts with the version-query (R frame) and the ports-query (G frame). I managed to report a version (not very difficult, just some bytes to send) and the port info.
The port info frame reports all of the active ax25 interfaces : port name, call and descriptions as defined in the linux ax25 configuration files.
UI-View will report this, so one can see the connection is established successfully.


4.3 k frame

I came to speed, the program basics were made. Now it's just implementing some other frames.
The next thing UI-View does, is sending the frame to ask for the reception of AX25 data in raw format. This is not that hard, just taking the socket data and sending it to the application (well, with a little tweaking).

This is the point where we can do something usefully with ldsped. We can take UI-View and connect to ldsped, we get the port list and the raw data. Fine.


4.4 K frame

UI-View will send our position. And off course, we want to be able to send out data. Using the port we want. In fact, that's the reason I started all this !
To send data, UI-View will use the K frame. It took me more effort to accomplish this. It was not very easy to find the information about how the AX25 sockets work, what I have to send out, etc. (I already mentioned : I'm not used to programming under linux, using the OS' functions.)

When these frames were implemented, it was enough to work with UI-View !

But I wanted to do a little more, it would be nice if I could also run some other agwpe compatible programs, a monitor program for one.


4.5 m frame

I downloaded a monitor program from the SV2AGW website. This program does not use the raw frames when monitoring, but transmits the m frame to get readable monitor frames. As listen does.
So I used the listen code.

When I tried this, I got the result that the monitor program crashed ! OK, my output (in fact, listens's output) is not 100% identical to the agwpe m frames. But it seems the monitor program is not written very well to handle unexpected input. I had to cut out a space in the decoded string here and tweak a little bit there. Finally, the monitor program stopped crashing and did display nicely what was offered.


4.6 H frame

Processing the H frame was another thing I wanted to solve.
Again, not transmitting the exact data, made the monitor program behave strange. For this, I adapted the mheard code. ldsped checks if mheard data is present on your system. If there is, the H frames will be answered using the mheardd data (since the H frame question will be answered with 20 calls, best set mheardd to hold at least 20 calls).
The general begin and end date/time windows SYSTEMTIME structures are not send (nulls will be send).
agwpe will also send a T frame. ldsped will not.


4.7 M frame

Finally, trying to get AGWUIdigi to work, I had to process the M frame. The beacon code helped me here.


5. Extras

Having achieved this, the temptation to go a little bit further was rather big. So, I added ...


5.1 PHG probe

Following parameters activate the probe :

probestring PHG70302/lsdped probe
probeunproto RELAY WIDE
probesendport -1
probecall ON7LDS


Probesendport specifies the port(s) to use : -1 = send probe on all ports; a number >=0 specifies the port to use (only on that port the probe will be sent)
Probecall specifies the originating call of the probe. When not specified, the port's call will be used.

When I finished this part of the code, I was realising myself such a probe could easily have been implemented with the beacon command :

beacon -c ON7LDS -d "APRS VIA RELAY WIDE" radio1 PHG50304/probe -t 15

nevertheless I let the PHGR probe code in ldsped.


5.2 TRAFFIC object

What I really wanted to implement is a TRAFFIC object. Following parameters activate this :

traffic 5
trafficname LDSPED
trafficpos 5059.39N\00453.90E?
trafficsendport -1
trafficcall ON7LDS

Traffic specifies the number of object-updates an hour. The object will send out

xxx packets in xx minutes (= xx/min)

The trafficname is used to specify the object name. When not present, the default name 'TRAFFIC' is used.
The trafficpos is used to specify the position of the object and the icon. Do not forget to include the icon modifiers !
Trafficsendport specifies the port(s) to use : -1 = send probe on all ports; a number >=0 specifies the port to use (only on that port the probe will be sent)
Trafficcall specifies the owner call of the TRAFFIC object. When not specified, the port's call will be used.


5.3 MRTG connection

I like MRTG as a graphical representation of things. I use it not only for routers, ethernet interfaces and the like but also for processor load, # of active hosts, UPS battery load, in and out voltage, temperatures, ...
So, I wanted to monitor the packet traffic with MRTG.

When specifying

trafficport *:8005

the total packet traffic can be monitored.

Note :

the TRAFFIC object has not to be active to make this work !
the counters are zeroed upon reading !
A working MRTG configuration can be found here.


6. Conclusion / download

OK, I got where I wanted to be : UI-View on my laptop and on my desktop do work fine in conjunction with my linux computer. As an extra, some simple other agwpe compatible programs seem to work.

You are welcome, to use/experiment with it. If you have some more questions/remarks/corrections/ ... , please tell me about it.

If you want to try ldsped, go to the download page