AMPCTL(1)
π AMPCTL(1) Β· Hamlib Utilities π
β¨ NAME β¨
ampctl: control radio amplifiers π»π
π§ SYNOPSIS π§
ampctl [-hiIlLuV] [-m id] [-r device] [-s baud] [-t char] [-C parm=val]
[-v[-Z]] [command|-]
πΈ DESCRIPTION πΈ
Okay so, ampctl is the tool for controlling radio amplifiers β¨ It takes commands straight from the command line, but if you don't give it any there, it drops you into interactive mode instead π
Keep in mind that Hamlib is BETA level software π Lowkey, a lot of the backend libraries don't have complete amplifier support yet, but the basic functions are usually well supported π«Ά
Report bugs and share feedback at the e-mail address in the BUGS section below π Patches and code enhancements sent to that same address are super welcome π¦
π OPTIONS π
This program follows the usual GNU command line syntax π Short options that take an argument can have the value stuck right after them, or separated by a space. Long options that start with two dashes (-) need an = between the option and any argument π
Here's the summary of the supported options π
-m,--model=idβ pick the amplifier model number π§- See the model list (use
ampctl -l). - Note:
ampctl(or third party software using the C API) will use amplifier model 2 for NET ampctl (communicating with ampctld).
- See the model list (use
-r,--amp-file=deviceβ tell it the file name of the port that's plugged into the amplifier π- This is often a serial port, but it could also be a USB to serial adapter π Typical names are
/dev/ttyS0,/dev/ttyS1,/dev/ttyUSB0, etc. on Linux, andCOM1,COM2, etc. on MS Windows. The BSD flavors and Mac OS/X have their own designations, so check your system's documentation π
- This is often a serial port, but it could also be a USB to serial adapter π Typical names are
-s,--serial-speed=baudβ set the serial speed to the baud rate β‘- By default, it uses the maximum serial speed from the amplifier backend's capabilities (set by
-mabove) π
- By default, it uses the maximum serial speed from the amplifier backend's capabilities (set by
-t,--send-cmd-term=charβ change the termination char for the text protocol when you're using thesend_cmdcommand π¬- The default is ASCII CR (
0x0D). Non-printing ASCII characters can be given as their ASCII number in hexadecimal format, with0xin front. You can pass an empty string for no termination char. The string-1tellsampctlto switch to binary protocol. - For example, to set a command terminator for Kenwood style text commands, pass
-t ';'toampctl. See EXAMPLE below.
- The default is ASCII CR (
-L,--show-confβ list all the config parameters for the amplifier you set with-mabove π-C,--set-conf=parm=val[,parm=val]β set amplifier configuration parameter(s), likestop_bits=2βοΈ- Use the
-Loption above to see the list of configuration parameters for a given model number.
- Use the
-u,--dump-capsβ dump the capabilities for the amplifier you set with-mabove, then exit π«§-l,--listβ list every amplifier model number defined in Hamlib, then exit π-i,--read-historyβ read previously saved command and argument history from a file (default$HOME/.ampctl_history) for the current session π- This is only available when
ampctlis built with Readline support (see READLINE below). - Note: To read a history file stored in another directory, set the
AMPCTL_HIST_DIRenvironment variable, e.g.AMPCTL_HIST_DIR=~/tmp ampctl -i. WhenAMPCTL_HIST_DIRis not set, the value ofHOMEis used.
- This is only available when
-I,--save-historyβ write the current session's command and argument history (plus previous session(s), if the-ioption is given) to a file (default$HOME/.ampctl_history) at the end of the current session πΎ- Complete commands with arguments are saved as a single line, so you can recall them and use or edit them later. This is only available when
ampctlis built with Readline support (see READLINE below). - Note: To write a history file in another directory, set the
AMPCTL_HIST_DIRenvironment variable, e.g.AMPCTL_HIST_DIR=~/tmp ampctl -IRq. WhenAMPCTL_HIST_DIRis not set, the value ofHOMEis used.
- Complete commands with arguments are saved as a single line, so you can recall them and use or edit them later. This is only available when
β¨ COMMANDS β¨
Okay so commands can be typed as a single char or a full long name, and they don't get a dash like options do π«Ά. You can type them in interactive mode or pass them as argument(s) in command line interface mode. In interactive mode you can even slam a command and its args onto one line:
F 14250000
Most Hamlib operations come as a set/get pair, so an UPPERCASE letter is usually the set and the matching lowercase letter is the get π₯. Every operation also has a long name. In interactive mode, just prepend a backslash, \, to use it π
Example: type \dump_caps to see what capabilities this amplifier and its backend support π
Note: The backend for the amplifier you're controlling, or the amplifier itself, may not support some commands π If that happens, the operation fails with a Hamlib error message.
Here's a simple one using a commands file. (In the real manpage, the typed text is bold, so picture it bolded π)
$ cat <<.EOF. >cmds.txt
> # File of commands
> F 14250000
> f
> l PWRINPUT
> l PWRFORWARD
> l SWR
> \dump_caps
> .EOF.
$ ampctl -m1 - <cmds.txt
Amplifier command: # File of commands
Amplifier command: F 14250000
Amplifier command: f
Frequency(Hz): 14250000
Amplifier command: l PWRINPUT
Level Value: 0
Amplifier command: l PWRFORWARD
Level Value: 1499
Amplifier command: l SWR
Level Value: 1.000000
Amplifier command: \dump_caps
Caps dump for model: 1
Model name: Dummy
Mfg name: Hamlib
Backend version: 0.1
Backend copyright: LGPL
Backend status: Alpha
Amp type: Other
Port type: None
Write delay: 0mS, timeout 0mS, 0 retries
Post Write delay: 0mS
Has priv data: N
Get level: SWR NH PF PWRINPUT PWRFORWARD PWRREFLECTED PWRPEAK FAULT
Has Init: Y
Has Cleanup: Y
Has Open: Y
Has Close: Y
Can set Conf: N
Can get Conf: N
Can Reset: Y
Can get Info: Y
Overall backend warnings: 0
Amplifier command:
$
π ampctl Commands π
Here's the summary of commands. For set commands, the quoted italic bit gets swapped out for the value in the description. For get commands, the quoted italic bit is the key name of the value that comes back πΈ
β¨ Q|q, exit ampctl
Leaves ampctl when you're in interactive mode π¦
When ampctl is controlling the amplifier directly, this closes the amplifier backend and port. When ampctl is connected to ampctld (amplifier model 2), only the TCP/IP connection to ampctld gets closed. ampctld keeps running and stays available for another TCP/IP network connection π«Ά
β¨ F, set_freq 'Frequency'
Sets 'Frequency', in Hz.
Frequency can be a floating point or integer value.
β¨ f, get_freq
Gets 'Frequency', in Hz.
Returns an integer value.
β¨ l, get_level 'Level'
Gets 'Level Value' π
Returns the Level Value as a float or integer, depending on the Level token you gave it.
Note: Pass a ? (query) as the first argument instead of a Level token and you'll get back a space separated list of the get level tokens the amplifier backend supports. Use this to figure out which levels a given backend supports π§
β¨ w, send_cmd 'Cmd'
Sends a raw command string to the amplifier π§
This is super useful for testing and troubleshooting amplifier commands and responses when you're developing a backend.
For binary protocols, enter values as \0xAA\0xBB. You should get a 'Reply' from the amplifier, which will likely be a binary block or an ASCII string, depending on the amplifier's protocol (check your amplifier's computer control documentation).
The command terminator, set by the send-cmd-term option above, ends each command string sent to the amplifier. That character should not be part of the input string β οΈ
β¨ dump_state
Returns certain state information about the amplifier backend π
β¨ 1, dump_caps
Not a real amplifier remote command. It just dumps capabilities, aka what the backend knows about this model and what it can do π
TODO: Make sure this is in a consistent format so it can be read into a hash, dictionary, etc. Bug reports requested π
Note: This command spits out many lines of output, so be very careful if you're using a fixed length array! For example, running this command against the Dummy backend gives you a bunch of lines of text output π
β¨ _, get_info
Returns information from the amplifier backend β
β¨ R, reset 'Reset'
Performs amplifier 'Reset' π₯
Reset is an integer value:
0= None1= Memory reset2= Fault reset3= Amplifier reset
β¨ set_powerstat 'Power Status'
Sets 'Power Status' π
Power Status is an integer value:
0= Power Off1= Power On2= Power Standby (enter standby)4= Power Operate (leave standby)
β¨ get_powerstat
Gets 'Power Status', same as set_powerstat above π
β¨ Y, set_ant 'Antenna' 'Option'
Sets 'Antenna' and 'Option' π
Number is the 1-based antenna# (1, 2, 3, ...).
1 = A/1
2 = B/2
3 = C/3
π READLINE π
If the Readline library development files are found at configure time, ampctl gets built with Readline support for command and argument entry, and it's giving full main character energy π Readline command key bindings stay at their defaults, as described in the Readline manual. ampctl sets the name ampctl, which you can use in Conditional Init Constructs in the Readline Init File ($HOME/.inputrc by default) for custom keybindings that are unique to ampctl π¦
Command history is available with Readline support, as described in the Readline History manual. Command and argument strings are stored as single lines, even when arguments get prompted for one at a time. Commands and arguments aren't validated and are stored exactly as typed, with values separated by a single space π«Ά
Normally session history isn't saved. But if you use either -i/--read-history or -I/--save-history when starting ampctl, any previously saved history gets read in and/or the current and previous session history gets written out when ampctl closes. (If you give -i and -I together, you get both.) Each option is mutually exclusive, so you can use either one alone or both together. This is handy for saving a set of commands to read later without writing your modified history back out, which is great for keeping a consistent set of test commands in interactive mode π§
History is stored in $HOME/.ampctl_history by default, but you can change the destination directory by setting the AMPCTL_HIST_DIR environment variable. When AMPCTL_HIST_DIR is unset, the value of the HOME environment variable is used instead. Only the destination directory can be changed right now π
If Readline support isn't found at configure time, ampctl uses the original internal command handler. Readline is not used for ampctl commands entered on the command line, whether or not Readline support is built in πΈ
Note: Readline support is not included in the MS Windows 32 or 64 bit binary builds supplied by the Hamlib Project π Running ampctl on MS Windows in the cmd shell does give you session command line history, but it isn't saved to disk between sessions.
π DIAGNOSTICS π
The -v, --verbose option lets you pick different levels of diagnostics to output to stderr. They line up like this: -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE π
A given verbose level is super useful for giving the developers the debugging info they need. For example, TRACE output shows all of the values sent to and received from the amplifier. That's very useful for amplifier backend library development, and the developers may ask you for it π«Ά
π¦ EXIT STATUS π¦
ampctl exits with:
0β if all operations completed normally π1β if there was an invalid command line option or argument π2β if an error was returned by Hamlib π
π§ EXAMPLES π§
Start ampctl for an Elecraft KPA-1500 using a USB to serial adapter on Linux, in interactive mode:
$ ampctl -m 201 -r /dev/ttyUSB1
Start ampctl for an Elecraft KPA-1500 using COM1 on MS Windows while generating TRACE output to stderr:
> ampctl -m 201 -r COM1 -vvvvv
Connect to a running ampctld with amplifier model 2 (βNET ampctlβ) on the local host, specify the TCP port, and set frequency and mode:
$ ampctl -m 2 -r localhost:4531 F 7253500
π BUGS π
This almost empty section... π
Report bugs to:
Hamlib Developer mailing list π
π COPYING π
This file is part of Hamlib, a project to develop a library that simplifies radio, rotator, and amplifier control functions for developers of software primarily of interest to radio amateurs and those interested in radio communications π»
Copyright Β© 2000-2011 Stephane Fillod Copyright Β© 2000-2018 the Hamlib Group (various contributors) Copyright Β© 2010-2020 Nate Bargmann
This is free software; see the file COPYING for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
π SEE ALSO π
less(1), more(1), ampctld(1), hamlib(7) π
π COLOPHON π
Links to the Hamlib Wiki, Git repository, release archives, and daily snapshot archives are available via hamlib.org π
Bestie, that's the whole page π«Άβ¨ It's from the Hamlib project, version dated 2020-09-08, and it's literally the cutest manpage ππ
π¦ where this page comes from
- alpine 3.24: hamlib-doc 4.7.1-r0 Β· LGPL-2.0-or-later
- arch rolling: hamlib 4.7.2-2 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- debian trixie: libhamlib-utils 4.6.2-1+b1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- fedora 43: hamlib 4.6.5-2.fc43 Β· GPL-2.0-or-later and LGPL-2.0-or-later
- fedora 44: hamlib 4.6.5-3.fc44 Β· GPL-2.0-or-later and LGPL-2.0-or-later
- nixos 26.05: hamlib 4.7.2
- nixpkgs unstable: hamlib 4.7.2
- opensuse-leap 16.0: hamlib 4.7.2-bp160.1.1 Β· LGPL-2.1-only
- opensuse-leap 16.0: hamlib 4.7.2-bp160.1.1 Β· LGPL-2.1-only
- opensuse-leap 16.0: hamlib 4.7.2-bp160.1.1 Β· LGPL-2.1-only
- opensuse-leap 16.0: hamlib 4.7.2-bp160.1.1 Β· LGPL-2.1-only
- ubuntu questing: libhamlib-utils 4.6.2-1build1
- ubuntu resolute: libhamlib-utils 4.6.5-5build1 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- ubuntu stonking: libhamlib-utils 4.7.2-2 Β· LGPL-2.1-or-later AND GPL-2.0-or-later
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms