Direwolf soundcard packet on Linux, with ax25 and LinPac

I’ve been playing around with Direwolf soundcard packet radio decoder on Linux. On Windows I use the packet terminal app that comes with the UZ7 soundcard modem, which you can connect to Direwolf’s AGW port over a network. The only comparable app on Linux that I’ve found seems to be LinPac.

Linpac connects over an ax25 port. To get LinPac to connect to Direwolf there’s a few steps to jump through.

Install Direwolf

Download the source from: https://home.comcast.net/~wb2osz/site/?/home/

(or after Oct 8 2015, https://github.com/wb2osz/direwolf)

Install libasound2-dev:

sudo apt-get install libasound2-dev

Compile Direwolf:

sudo make install

If you get this error when compiling Direwolf then you missed the libasound-dev step:

audio.c:80:28: fatal error: alsa/asoundlib.h: No such file or directory
#include <alsa/asoundlib.h>

Copy the supplied direwolf.conf file (from the downloaded source) to your home dir. To find out what input and output sound devices you have, run

aplay - l


arecord -l

You’ll see something like this:

**** List of CAPTURE Hardware Devices ****

card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 0: NVidia [HDA NVidia], device 2: ALC1200 Alt Analog [ALC1200 Alt Analog]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

Get the device numbers for the soundcard you are using and edit direwolf.conf. For device 0 subdevice 0, edit this line and set 0,0:

ADEVICE  plughw:0,0

Using a Rigblaster Plug and Play on Ubuntu 14.04, it was automatically recognized and showed up per the docs on /dev/ttyUSB0. Direwolf will use this for PTT on your radio. I uncommented this line to enable this:

PTT /dev/ttyUSB0 RTS

To give my current user access to ttyUSB0 (and avoid running with sudo) I had to add my user to the dialout group (per post here):

sudo usermod -a -G dialout $USER

Start up alsamixer and make sure the mic inputs and outputs are not muted (M), and the volume levels are around 3/4.

Install the ax25 network suport:

sudo apt-get install libax25 ax25-apps ax25-tools

To enable an ax25port, edit /etc/ax25/axports, I added a line like this:

1 KK6DCT-1 1200 255 2 2m packet

The first column is the port name. Start up direwolf with the -p option to enable a KISS port, you’ll see something like this (-t 0 t0 suppress the colors):

kev@kevs-ubuntu:~$ direwolf -t 0 -p
Dire Wolf version 1.2
Audio device for both receive and transmit: plughw:0,0  (channel 0)
Channel 0: 1200 baud, AFSK 1200 & 2200 Hz, E+, 44100 sample rate.
Ready to accept AGW client application 0 on port 8000 ...
Ready to accept KISS client application on port 8001 ...
Virtual KISS TNC is available on /dev/pts/0
WARNING - Dire Wolf will hang eventually if nothing is reading from it.
Created symlink /tmp/kisstnc -> /dev/pts/0

Note the /dev/pts/X value, and use this with a kissattach command to connect Direwolf to ax25:

sudo /usr/sbin/kissattach /dev/pts/0 1

The 1 value following /dev/pts/0 is the port number from the axports file.

Per the Direwolf PDF doc, if you see this error:

kissattach: Error setting line discipline: TIOCSETD: Device or resource busy
Are you sure you have enabled MKISS support in the kernel
or, if you made it a module, that the module is loaded?

Then try this instead:

sudo /usr/sbin/kissattach /dev/pts/ptmx 1

Install LinPac

Download the LinPac source. Build and install:

make install

The first time you startup LinPac it creates a LinPac dir in your home folder. Edit macro/init.mac in this folder and change the port value to match the port name from your axports change (1 in the above example):

;; Default port
port 1

Start LinPac with:

linpac -m

(I’m not sure what the -m option is for, I found this in a post online, but without it I get errors on startup about ax25 port not found).

Connect to a node with :c nodename


Running headless WSPR on the Raspberry Pi

I’ve tried a few times to compile and run WSJT on the Pi in order to decode JT65 mode transmissions – I think I got close, but I ran into other issues with the soundcard configuration that has tripped me up, like configuring WSJT to listen and transmit to my soundcard’s inputs and outputs.

I’ve seen some other posts on getting WSPR running, so this looks like it’s more possible.

From going through the WSJT dependencies, I’d already installed all the libportaudio and python-* dependencies. If you’re following this from scratch through, I’d start with George Smart’s article here. To get a working config I followed George’s article first and then picked up LX3KR’s article here to get the soundcard config working – I also wanted to run WSPR in headless mode, so I picked up the steps at this point:

cp WsprMod/w.so WsprModNoGui/

I’m not sure the suggestion for the .asoundrc file worked for me, as referencing the input as 2#audio and output as 3#radioconv in the WSPR.INI didn’t work.

At this point I did some guessing. When wspr starts up, it writes a list of audio devices to audio_caps file in your wspr dir. Here’s what mine looks like with my Rigblaster Advantage attached:

pi@raspberrypi ~/amateur_radio/wspr $ cat audio_caps
0    1    2       0       0  RIGblaster Advantage Audio: USB Audio (hw:0,0)
1  128  128       0       0  sysdefault
2    0    2       1       0  front
3    0    2       1       0  surround40
4    0    2       1       0  iec958
5    1    2       0       0  spdif
6  128  128       0       0  default
7    0    2       1       0  dmix

So I’m guessing the Rigblaster is device 0 and sysdefault is 1.

From the suggested config in WSPR.INI, it configures the in and out like this:

AudioIn 2#radio
AudioOut 3#radioconv

2 and 3 don’t seem to match up with anything I’m seeing, but since the other earlier step changed the USB sound card devices to be default, I set these instead:

AudioIn 1
AudioOut 1

Before starting up wspr I also ran alsamixer and set the vol and mic levels to be roughly 3/4 volume.
Now when starting up it looks like wspr sees my devices and off it goes:

pi@raspberrypi ~/amateur_radio/wspr $ python wspr_nogui.py 
WSPR Version 3.00_r2326, by K1JT
Run date:   Thu Apr 17 05:14:05 2014 UTC
setting g.Win32
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Audio config ok
2014 Apr 17
Rx Noise: -30  dB

The last few lines repeat for a minute or so then it starts reporting the actual volume level. You want to adjust the radio volume or volume on the Rigblaster so that the level is close to 0db. +/- a few doesn’t seem to make much difference.

The other values I changed are:

PctTx 0

This is percent tx time. Leave it at 0 for rx only, otherwise change to a %age of time value that you want to send your own transmissions. I changed it to 5.

iband 2

This represents the band you’re listening to, counted from the list of freq values. 600m is 1, 160m is 2 and so on.

Start it up and off you go!

python wspr_nogui.py