Hamlib rigcltd

Hamlib is a software library and was create to simplify computer control for amateur radio.

Hamlib architecture
Hamlib architecture

Hamlib serves as an abstraction layer. Software developers don't need to worry that you're running a particular model of radio, as long as you get your radio working with hamlib .

Daemons

Hamlib centers around two core daemons:

  • rigctld (rig control) on port 4532
  • rotctld (rotor control) on port 4533

The daemons receive commands from applications via TCP. One daemon can serve

If you have multiple rigs/rotors to control, start a deamon per rig/rotor. Each deamon on a separate port. E.a. 4534, 4536, ... (even) for rigctld and 4535, 4537, ... (odd) for rotctld.

This page will focus on rigctld.

Find your rig

To see if your rig is supported by rigctl open a terminal and type:

  • rigctl -l

Find your rig and remember the rig # (first column).

rigctl -l

This number will be needed as option in rigctl(d):

  • −m, --model=id
    select radio model number. See model list (use ’rigctl -l’)

Rig USB device

When plugging in your USB rig it will get mounted as /dev/ttyUSB0 or /dev/ttyUSB1 or ... The number depends on which other devices are plugged in and can vary after each reboot...

Udev gives a device a name based on it's manufacturer and device ID. In Ubuntu, these rules are specified in:

  • /etc/udev/rules.d/

For hamlib devices create a file 99-hamlib.rules file. Or 99-my_rig.rules (name doesn't matter).
Please note: 99- is the order of execution within the udev startup.

Find your rigs device:

  • lsusb

udev lsusb

In my case the third line is the FT-991A. 10c4:ea70 is the VendorId:DeviceId.

  • ls -al /dev/ttyUSB*

gives /dev/ttyUSB0 and /dev/ttyUSB1 as the mounted serial devices.

Now find some attribute info for the devices to filter on in the udev rule:

  • udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
  • udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB1)

Create and edit the rules file (instead of vi you can use your favorite editor):

  • sudo vi /etc/udev/rules.d/99-my_rig.rules

The .rules file looks like this (replace bold text with your rigs data)

# FT-991A CP210x UART Bridge
SUBSYSTEM=="tty", DRIVERS=="cp210x", ATTRS{interface}=="Standard*", SYMLINK+="rig1s"
SUBSYSTEM=="tty", DRIVERS=="cp210x", ATTRS{interface}=="Enhanced*", SYMLINK+="rig1e"

Save the file and restart the udev service:

  • sudo service udev restart

Load the new rule:

  • sudo udevadm trigger

Check:

  • ls -al /dev/rig*

udev rig symlinks

Now you can use /dev/rig1e (instead of /dev/ttyUSBx) as device in programs.

Test rigctld with telnet

Now that all is configured it's time to test the hamlib/rigctld connection to the rig.
Follow these steps:

  1. start rigctld (in background)
    $ rigctld -m 135 -r /dev/rig1e -t 4532 -s 4800 --set-conf=data_bits=8, stop_bits=2, serial_parity=None, serial_handshake=None, dtr_state=OFF, rts_state=ON &
  2. open a telnet session (localhost port 4532)
    $ telnet localhost 4532
    • fire a few CAT commands:
      • f (get rig frequency)
      • m (get rog mode)
    • CTRL+] (Escape to telnet prompt)
    • close (telnet session)
  3. jobs (check rigctld still running)

The above should look something like this:

rigctld test with telnet

Usage

When configuring a ham program for using hamlib, some programs (like CQRlog) has an option for automatic start the rigctld daemon.

cqrlog run rigctld

Other programs (fldigi) won't start a rigctld... There is no option to do this (at the moment). So you must run rigctld in background before starting fldigi, or use the RigCAT mode.

Tags:

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer