Skip to content

Instantly share code, notes, and snippets.

@relistan
Last active February 17, 2024 17:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save relistan/bd9c4b8bab55b81c0374f30bf565bbe0 to your computer and use it in GitHub Desktop.
Save relistan/bd9c4b8bab55b81c0374f30bf565bbe0 to your computer and use it in GitHub Desktop.
Enable CAT control for WSJT-X on the (tr)uSDX on macOS

CAT Control on the (tr)uSDX for WSJT-X on macOS

This will enable CAT control on your Mac running WSJT-X with the (tr)uSDX and possibly other USDX rigs as well. WSJT-X uses Hamlib to connecto to and manage CAT on different radios. The problem (thanks to Guido PE1NNZ for identifying), is that Hamlib resets the port when it connects. This causes the radio to reset and then it's not yet available when Hamlib tries to connect. We can work around that by blocking the ability for Hamlib to reset the port. The simplest way to do that is to have the port already in use when Hamlib starts up.

I was not able to achieve that using the Hamlib built into WSJT-X. However, by installing Hamlib separately, and running it in TCP server mode (acts like a network server), I was able to get this all to work.

You need to install hamlib with brew install hamlib. If you don't have brew already, then you will need to either install it, or use a different method for installing hamlib. Once that is installed, you should be able to run rigtctld on its own.

Running It

  1. Connect the (tr)USDX to external power first
  2. Connect the USB cable to the rig
  3. Copy the shell script above into your path (e.g. /usr/local/bin)
  4. Run chmod 755 <where you put it> to make it executable
  5. Run the script with urig if it's in your path or ./urig if it's in the current directory

Once that says 'rigctld' running, you can start WSJT-X. Configure WSJT-X like the screenshot included in this gist.

#!/bin/sh
PORT=`ls -tr "/dev/tty.usbserial-[0-9]*" | tail -1`
if [ -z $PORT ]; then
echo "No suitable USB serial port found"
exit 1
else
echo "Found USB serial port named ${PORT}"
fi
cat $PORT &
CAT_PID=$!
echo "Starting 'rigctld'"
## NOTE! Some versions of the (tr)uSDX use 115200 and you may
## need to change this setting from 38400 -> 115200
rigctld --model=2028 --listen-addr=127.0.0.1 --port=7006 -s 38400 -r $PORT &
RIG_PID=$!
echo "Waiting for radio initialization to complete"
sleep 3
echo "Stopping 'cat' command"
kill $CAT_PID
echo "'rigctld' running"
wait $RIG_PID
@relistan
Copy link
Author

@madler gist updated with a comment in the script to call this out so people can set it appropriately. Thanks!

@madler
Copy link

madler commented Jun 10, 2023

Noticed another small variation. On my MacBook Pro, it connected to /dev/tty.usbserial-110, which was found by your script. However on my Mac Studio, my (tr)uSDX connected to /dev/tty.usbserial-410. No other usbserial's show up, so I removed the 1 that the script was looking for.

@relistan
Copy link
Author

That's fine @madler. A better solution is to use [0-9] instead of removing it. Because otherwise it can match other devices too easily. I have several other USB serial devices. I will updated the script.

@NavyMikeHam
Copy link

I have an M1 Mac Book Pro running mac OS 14.2.1. I am connected to my (tr)uSDX radio through an Apple USB-C to USB adaptor.

I don't know much about com ports or UNIX scripts but I determine that I needed to use "/dev/tty.usbserial-110" as my Serial Port setting in WSJT-X. I then had to modify the script a bit to PORT=ls -tr "/dev/tty.usbserial-110" | tail -1. Not sure if this is the correct syntax but it did allow the script to complete correctly. From there I upped the Baud Rate to 115200 per your note and Test CAT went green!

Thanks for this script and the helpful details, I would not have gotten up and running without it.

@relistan
Copy link
Author

Thanks for this script and the helpful details, I would not have gotten up and running without it.

Hey, glad it helped!

I then had to modify the script a bit to PORT=ls -tr "/dev/tty.usbserial-110" | tail -1. Not sure if this is the correct syntax but it did allow the script to complete correctly. From there I upped the Baud Rate to 115200 per your note and Test CAT went green!

The original script should work with that port. The [0-9]* is a pattern match for anything that starts with a digit. It only matters because if you were to plug the radio into a different port or via a USB hub you might find that it's no longer on -110. But as long as it works for you, it doesn't matter.

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