Linux and Amateur Radio
The hamlib libraries allow command-line control of the transceiver via the rigctl programme. Not all of the CAT controls for the FT-991(A) are available via rigctl, so you will find applications such as WSJT-X relying on their own internal libraries. You can still have some fun with the commands. Here is a non-exhaustive list of some of the commands I have played with:
rigctl -m 135 -r /dev/ttyUSB0 set_powerstat 1
rigctl -m 135 -r /dev/ttyUSB0 set_powerstat 0
Check Power Status
rigctl -m 135 -r /dev/ttyUSB0 get_powerstat
Set: Upper Side Band; 2400 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked
rigctl -m 135 -r /dev/ttyUSB0 M USB 2400 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.000000 L PREAMP 10 U LOCK 1
Set: Lower Side Band; 2400 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked
rigctl -m 135 -r /dev/ttyUSB0 M LSB 2400 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.000000 L PREAMP 10 U LOCK 1
Set: Amplitude Modulation; 6000 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked
rigctl -m 135 -r /dev/ttyUSB0 M AM 6000 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.039216 L PREAMP 10 U LOCK 1
Set: Frequency Modulation; +/- 2.5 kHz deviation; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked
(FM mode throws an error and will not currently set the bandwidth. It can be read from the radio, but not set correctly.)
rigctl -m 135 -r /dev/ttyUSB0 M FM 9000 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.117647 L SQL 0.039216 L PREAMP 10 U LOCK 1
Enable Noise Blanker
rigctl -m 135 -r /dev/ttyUSB0 U NB 1
Disable Noise Blanker
rigctl -m 135 -r /dev/ttyUSB0 U NB 0
Enable VFO dial-lock
rigctl -m 135 -r /dev/ttyUSB0 U LOCK 1
Disable VFO dial-lock
rigctl -m 135 -r /dev/ttyUSB0 U LOCK 0
Intercept Point Optimization
rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 0
AMP 1 (10 dB)
rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 10
AMP 2 (20 dB)
rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 20
It is possible to create desktop shortcuts (or shortcuts as icons in a folder) to send some of the above commands to the FT-991(A). I use the MATE desktop on CentOS 7. You may need to vary the details below according to your Linux desktop environment. This example uses the grig application (or just the png file in the right path) to create an icon shortcut to set CEPT Citizens' Band channel 1:
Exec=rigctl -m 135 -r /dev/ttyUSB0 M FM 9000 F 26965000 L RFPOWER 0.019608 L MICGAIN 0.117647 L SQL 0.039216 L PREAMP 10 U LOCK 1
The above sits in a files called CEPT01.desktop with 755 permissions.
Scripting for fun
After some research and investigation, I found the correct device details to route the output of aplay to the FT-991(A). So here, just for fun, is an example script that can key the transmitter (in various modes) and play a sound.
# Script to transmit audio with the FT-991A
# Last updated: 1st September 2019
# DATA-FM, 2.5 kHz deviation, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 077 to USB.
rigctl -m 135 -r /dev/ttyUSB0 M PKTFM 9000 F 145212500 L RFPOWER 0.019608 L SQL 0.039216 U LOCK 1
# DATA-FM, 2.5 kHz deviation, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 077 to USB.
#rigctl -m 135 -r /dev/ttyUSB0 M PKTFM 9000 F 29150000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1
# DATA-USB, 2.4 kHz bandwidth, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 072 to USB.
#rigctl -m 135 -r /dev/ttyUSB0 M PKTUSB 2400 F 28500000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1
# AM, 6 kHz bandwidth, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 045 to REAR and 048 to USB
#rigctl -m 135 -r /dev/ttyUSB0 M AM 6000 F 28500000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1
# Enable PTT
rigctl -m 135 -r /dev/ttyUSB0 T 1
# Play audio
aplay -q -Dplughw:2 pips.wav
# Disable PTT
rigctl -m 135 -r /dev/ttyUSB0 T 0
What does the script do? The commented-out sleep command allows the script to be called from the at scheduler, and is only there as part of my experimentation to play out the Greenwich style "pips" as heard on BBC Radio. at cannot handle seconds, so you call the script at, say 11:59, and the pips.wav file should be played out with the final long pip signalling 12:00. Timing may vary based on your computer's clock and the serial speed set in your radio (I use 38400 bps).
Each of the four rigctl examples offer a range of modes and the necessary settings in the FT-991(A). Only one rigctl line needs to be un-commented, else your radio will change modes four times whilst the script runs! The AM mode completely disables the front-panel microphone input. AM is not intended for data-modes, hence the lack of options.
The next line enables the PTT. aplay now plays the selected WAV file through the USB CODEC device found in the FT-991(A). You may have to run aplay -l to see the number your USB CODEC interface and adjust the plughw: accordingly. Multiple aplay lines can be added to play an array of WAV files (for example, presenting a news bulletin).
The final lines disable the PTT and exits the script.
What are those odd RF and SQL numbers?
At present, hamlib appears to be offering integer values for many of the settings instead of the simplified values present on the front panel of the radio. I am open to suggestions if anyone has found a work-around. I really do not want to have to create a look-up table to convert the front panel figures!
Before I describe how to use the Yaesu FT-991(A) with Linux, there is one gotcha to be aware of. In most Linux installations that use a GUI and NetworkManager, there is a little background application called modem-manager. It is started whenever a modem-type device is detected so NetworkManager can see if it can/needs to control it, and offer it as a means of communication. modem-manager scans serial ports, such as the one found inside the FT-991(A), with commands that will cause the radio to lock into transmit mode. When this happens, you have no choice but to power off the radio.
To avoid the trap of modem-manager ruining the party, you should always plug the USB port in to your Linux computer whilst the radio is powered off. The d.c. power supply can be on, or you can power it on after plugging in the USB port. Either way, wait at least 15 seconds before powering the radio on. This should have given modem-manager enough time to realise it cannot control the FT-991(A) and go away. One way to check how long this takes is to open a terminal window and run the command: sudo tail -f /var/log/messages Tail-ing the syslog messages before you plug-in the radio will give you and idea of how long it takes to detect the devices, and for modem-manager to let go.
Caveat Emptor: If you follow this and it borks your machine, it is not my fault! You have a back-up, right? If you have a desktop and no use for modem-manager, you can disable it by removing the file: /usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service. NetworkManager will complain in /var/log/messages that it cannot start modem-manager. Shame!
In order to run some of the commands featured on this website, you will need to give yourself sudo access, and add yourself to the dialout group. This applies to the primary machine, and any virtual machines running CentOS / Fedora. If you install VirtualBox to run virtualised images, you will also need to add your uid to the vboxusers group.
Open a terminal window and enter: su - to become super-user. You will be prompted for your root password.
Add yourself to the wheel and dialout groups with the following command: usermod -G wheel,dialout uid
- where uid is your id as found from the command: whoami.
In the same terminal window as above, edit /etc/sudoers and un-comment either of the %wheel options, depending on whether you want to input your password each time you run a sudo command, or not. I prefer not, so I un-comment: %wheel ALL=(ALL) NOPASSWD: ALL
You will need to log-out and log-in again for the above changes to take effect.
Is out of support. This section is left here for historical reference and will be removed in the future.
The 2.6 kernel that drives CentOS 6 only contains the most basic code needed to support the USB interface of the Yaesu FT-991(A). If you wish to use the default kernel, you will need to patch it with the drivers for the USB serial-port and sound-card used inside the FT-991(A).
In order to make the driver, you will need to: sudo yum install gcc automake kernel-devel kernel-headers. This process will load any other dependencies needed.
Download the driver pack from the Silicon Labs website: http://www.silabs.com/documents/login/software/Linux_2.6.x_VCP_Driver_Source.zip and unpack it into your /home drive.
In order to patch your kernel, you will need to run a series of commands to make and install the modules. Or you can copy my handy script:
# Script to make and install CP210x drivers
# What version of kernel do we have here?
# cd to the driver directory
# Clean and make the driver
# Set the required permissions
chmod 755 cp210x.ko
sudo chown root:root cp210x.ko
# Copy the driver to its new home
sudo cp cp210x.ko /lib/modules/$UNAME/kernel/drivers/usb/serial/
# Load the modules
sudo insmod /lib/modules/$UNAME/kernel/drivers/usb/serial/usbserial.ko
sudo insmod cp210x.ko
I have a ~/scripts directory for all of my scripts, and I saved the above as CP210x-driver-insmod. Remember to chmod 755 CP210x-driver-insmod so you can execute it.
Run the script from a terminal window with: ./scripts/CP210x-driver-insmod. You will need to do this each time you update the kernel, and/or if the drivers appear not to be working.
The alternative to the above is to install kernel-lt from the ELrepo project. kernel-lt and kernel-ml are branches of the 4.x kernel, which has full support for the USB interface. I will leave the installation to the reader with a tip: remember to modify /etc/grub.conf and set the default=0 so your system boots kernel-lt.
At the time of writing, kernel-3.10.0-514.16.1.el7.x86_64 appears to have back-ported drivers for the CP210x USB chip. You may still want to run kernel-lt or kernel-ml from ELrepo to ensure you are using the latest and greatest drivers.
I prefer to use the long-term supported clone of Red Hat Enterprise Linux known as CentOS for its stability, especially on production systems. The downside of being super-safe is a lack of Amateur Radio software and toys. Those toys are present in Fedora - the bleeding-edge development version Red Hat use to test-bed their new ideas before rolling them into RHEL (and by extension, CentOS). Some are also available from Extra Packages for Linux (EPEL), but not as many as are available from Fedora. Whilst you can take packages from rawhide and rebuild them for CentOS using mock, they do not always work - especially if they rely on new features in libraries that you cannot rebuild and replace without breaking important things!
The answer to the conundrum is to install VirtualBox (plus the extension pack) and establish a virtualised Fedora This method allows you to play with xastir, wsjt-x, and others, without risking damage to your primary CentOS machine. You can also install VirtualBox on Microsoft Windows, then run Fedora as a virtual image.
Page updated: 3rd July 2021