Skip to content

Instantly share code, notes, and snippets.

@toomanycats
Last active March 5, 2024 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toomanycats/b5c1d829f7be70b13ba0ce0ca8164312 to your computer and use it in GitHub Desktop.
Save toomanycats/b5c1d829f7be70b13ba0ce0ca8164312 to your computer and use it in GitHub Desktop.
Ubuntu Winlink using PAT, VARA and (tr)uSDX with one USB cable

Linux Winlink via VARA and PAT

installing VARA via WINE

apt install -y wine winetricks
dpkg --add-architecture i386
apt-get update

old way:

from https://forum.winehq.org/viewtopic.php?t=35865

wget http://download.microsoft.com/download/winntsrv40/update/5.0.2195.2668/nt4/en-us/nt4pdhdll.exe
# unzip into .wine/drive_c/VARA
unzip nt4pdhdll.exe

probably better way:

winetricks vb6run
winetricks nt4phd

Get VARA executable and Install VIA Wine

wget https://mega.nz/file/rbQyGKyT#Iozk2snFU95hijjNkLtgvXrvwkp4F1j5LHtmuB1-OIA
unzip 'VARA HF v4.7.7 Setup.zip'
export WINEARCH=w32
wine 'VARA setup (Run as Administrator).exe'

Get new Audio Driver for One USB Cable operation

When you connect the rig to your USB port, the kernel will load the UART driver, Ch341 I think. You can confirm with dmesg where you shold see it loaded.

The driver will connect to this port, and split the stream into an audio stream going to the sink and the CAT command stream going to /dev/pts/x.

Be sure to install libraries first.

sudo apt install pulseaudio pavucontrol portaudio19-dev python3 python3-pip libasound2-plugins:i386

git clone https://github.com/threeme3/trusdx-audio.git
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install pyserial pyaudio

Setup new pseudo tty's

This is a temporary change. Need to lookup how to make this permanent.

sudo modprobe snd-aloop
pactl load-module module-null-sink sink_name=TRUSDX sink_properties=device.description="TRUSDX"

NOTE It's helpful to use pavcontrol to assign the new dummy audio sink, TRUSDX as the default.

NOTE You MUST assign the TRUSDX virtual input and virtual outputs as DEFAULT. PyAudio cannot interrogate these loop back devices and they must always be indexed as -1.

You can also check with:

pactl list | grep 'Monitor of Sink'

Start trusdx-audio.py

source venv/bin/activate
python trusdx-audio-1.01/trusdx-txrx.py

Note the output from trusdx-txrx.py it will be something like /dev/pts/1. Use that port as the connection for the radio. The audio will routed to the new sink created above.

rigctld

apt-get install libhamlib-utils

Start rigctld

https://github.com/la5nta/pat/wiki/Rig-control

The (tr)uSDX uses the CAT commands for the Kenwood TS-480. The integer code for that rig is 202 taken from:

rigctl -l | grep Kenwood
rigctld -m 202 r /dev/pts/1 -s 115200 &

start vara

wine ~/.wine/drive_c/VARA/VARA.exe &

Get PAT

https://github.com/la5nta/pat/releases/download/v0.15.0/pat_0.15.0_linux_amd64.deb

Edit the config file for Pat with your call sign and a few other details.`

Start Pat Web Interface

 pat http 

Changing (tr)uSDX Firmware

If you need the Serial Number

To get the (tr)uSDX serial number, you'll need to flash the boot loader.

Upload Boot Loader Using Arduino UNO as a Programmer

Get Arduino IDE

https://www.arduino.cc/en/software

Use the example code as-is to flash the Uno as an ISP programmer. Use the 6 pin programming connector on the (tr)uSDX. I take VCC from the Uno.

Install AVRDudess, avrdude and mono

apt install -y libmono-system-windows-forms4.0-cil avrdude binutils-avr 
wget https://github.com/ZakKemble/AVRDUDESS/releases/download/v2.14/AVRDUDESS-2.14-portable.zip

Use AVRDudess and USB connection to load firmware 2.00u onto (tr)uSDX.

(tr)uSDX 2.00u Firmware

DL2MAN web page with instructions for getting your (tr)uSDX serial number and bootloader.

https://dl2man.de/3b-trusdx-firmware/

Get the 2.00u firmware:

https://dl2man.de/wp-content/uploads/2022/01/wp.php/beta.html

Order of Programs to use WinLink

These commands need to be tested, then can be made into a start script. You'll want to parse out the exact port that the audio driver connects to.

In general it will look something like this. I assume you have already created the new dummy audio sinks that the driver uses. You may also want to capture the PID of each daemonized program so you can kill it later on exit.

# Plug rig USB cable into computer USB port.
python trusdx-audio-1.01/trusdx-txrx.py &
rigctld -m 202 -r /dev/pts/1 -s 115200 &
wine ~/.wine/drive_c/VARA/VARA.exe &
pat http

Ideas for Script

Get the PIDS and using a trap kill the PIDS on exit signal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment