Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
SmartSDR v3.2.39 and the SmartSDR v3.2.39 Release Notes | SmartSDR v2.7.6 and the SmartSDR v2.7.6 Release Notes
SmartSDR v1.12.1 and the SmartSDR v1.12.1 Release Notes | Power Genius XL Release Notes v3.6.21
Power Genius XL Utility v3.6.21 | Tuner Genius XL Utility v1.1.1
Serial Port CAT Control with Smart SDR for Mac
SDR for Mac doesn’t have the ability to emulate serial ports like the Windows counterpart does. This isn’t normally an issue since most respectable apps support either hamlib Net Rig Control or some other network based CAT control. There are however a few stragglers that still only support CAT control via serial ports. “Winlink Express” (my nemesis) is a fine example of ham radio software that only supports CAT control via serial ports. To be able to use Winlink Express with Smart SDR for Mac I needed a serial to TCP bridge to convert incoming “Serial” (tty in Mac / Linux) connections and redirect them to a TCP connection that Smart SDR for Mac was expecting.
Enter “socat” (Socket Cat). It has the ability to redirect all kinds of incoming connections and it supports both the ability to create a pseudo terminal (pty) for serial connections and a TCP connection.
To install socat you will either need to compile it from source or use a package manager like brew or mac ports:
Install Brew Package manager:
Install Mac Ports package manager
Once the brew or Mac Ports package manager is installed use the following to install socat from a standard terminal window (from the finder window click “Applications —> Utilities —> Terminal” to open Terminal):
brew install socat
via Mac Ports:
sudo port install socat
to run socat type the following in a terminal window:
"socat -d -d pty,cfmakeraw TCP4:localhost:4532"
You should see the following in your terminal window
The first line of the output indicates the serial port that socat is using, in the above example it’s “/dev/ttys007”
The second line show the TCP connection to Smart SDR for Mac being setup to 127.0.0.1:4532 (127.0.0.1 = localhost, port 4532)
From here you simply tell your application to use “/dev/ttys007” for the serial connection and all CAT Control commands sent to “/dev/ttys007” will be redirected to Smart SDR for Mac on what ever port you specified when you launched socat (port 4532 in the above example).
To verify the TCP connection to Smart SDR for Mac is working correctly you can check the CAT Control window in Smart SDR for Mac. In the example below the red box shows the port Smart SDR is expecting to receive CAT commands on and the green box shows the connected status after launching socat (The status will show “Connected if it worked, “Waiting” if the port was specified incorrectly or socat terminated).
Breaking down the socat command:
-d -d = this enables just enough debug messages to be able to determine the pty address. Without the “-d -d” socat will grab the first free pty (/dev/ttys007 in the examples above) but not tell you what pty it selected leaving you to guess.
pty,cfmakeraw = this tells so cat that one side of the connection should be a pty (Pseudo Terminal, fancy name for virtual Serial Port). The “cfmakeraw” option tells socat that you don’t want any processing on the pty, just take the data in and send it back out exactly like it came in. If you google socat examples most of them use “raw” which is the same as cfmakeraw or rawer. I stayed away from “raw” since the man pages say it’s been deprecated and replaced by rawer and cfmakeraw.
TCP4:localhost:4532 = TCP4 Tells socat to make a TCPv4 connection. localhost is your machine, 4532 is the TCP port
before you launch socat Smart SDR for Mac needs to have CAT Control enabled and the port needs to be correct or you will receive the following error:
2020/09/16 23:33:57 socat E connect(7, LEN=16 AF=2 127.0.0.1:4532, 16): Connection refused
If you see the above message check that the port is specified correctly in the Cat Control window and the socat command. Also verify that Cat Control is enabled. It doesn’t really matter what the port is, it just can’t be used by another application and it has to match in both socat and Smart SDR for Mac. Port “5001” or “4532” are used in many examples but they just need to be the same in Smart SDR for Mac and socat if you have to change it.
Additional useful socat options:
-v -d -d -d = enables additional debug messages and verbose messages
link=<filename> = since the pty option just grabs the next available pty it likely won’t always be “/dev/ttys007”. The link options allows you to specify a file name for the pty by automatically creating a link between the file you specify and whatever pty socat selects. Now you can tell your ham radio application to use the linked file “/Users/kwilliams/tty.v1” instead of whatever random pty socat assigns when you run the command.
Example of socat with the additional options:
socat -v -d -d -d pty,link=/Users/kwilliams/Downloads/tty.v2,cfmakeraw TCP4:localhost:4532
- 17.1K All Categories
- 99 Community Topics
- 2K New Ideas
- 211 The Flea Market
- 5.8K Software
- 5.1K SmartSDR for Windows
- 73 SmartSDR for Maestro and M models
- 153 SmartSDR for Mac
- 166 SmartSDR for iOS
- 166 SmartSDR CAT
- 88 DAX
- 298 SmartSDR API
- 7.5K Radios and Accessories
- 6.1K FLEX-6000 Signature Series
- 595 Maestro
- 20 FlexControl
- 756 FLEX Series (Legacy) Radios
- 275 Genius Products
- 193 Power Genius XL Amplifier
- 77 Tuner Genius XL
- 5 Antenna Genius
- 71 Shack Infrastructure
- 36 Networking
- 139 Remote Operation (SmartLink)
- 67 Contesting
- 208 Peripherals & Station Integration
- 73 Amateur Radio Interests
- 495 Third-Party Software