DOKK / manpages / debian 12 / libhamlib-utils / ampctl.1.en
AMPCTL(1) Hamlib Utilities AMPCTL(1)

ampctl - control radio amplifiers

ampctl [-hiIlLuV] [-m id] [-r device] [-s baud] [-t char] [-C parm=val] [-v[-Z]] [command|-]

Control radio amplifiers. ampctl accepts commands from the command line as well as in interactive mode if none are provided on the command line.

Keep in mind that Hamlib is BETA level software. While a lot of backend libraries lack complete amplifier support, the basic functions are usually well supported.

Please report bugs and provide feedback at the e-mail address given in the BUGS section below. Patches and code enhancements sent to the same address are welcome.

This program follows the usual GNU command line syntax. Short options that take an argument may have the value follow immediately or be separated by a space. Long options starting with two dashes (‘-’) require an ‘=’ between the option and any argument.

Here is a summary of the supported options:

Select amplifier model number.
See 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).
Use device as the file name of the port connected to the amplifier.
Often a serial port, but could be a USB to serial adapter. Typically /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0, etc. on Linux, COM1, COM2, etc. on MS Windows. The BSD flavors and Mac OS/X have their own designations. See your system's documentation.
Set serial speed to baud rate.
Uses maximum serial speed from amplifier backend capabilities (set by -m above) as the default.
Change the termination char for text protocol when using the send_cmd command.
The default value is ASCII CR (‘0x0D’). ASCII non-printing characters can be given as the ASCII number in hexadecimal format prepended with “0x”. You may pass an empty string for no termination char. The string “-1” tells ampctl to switch to binary protocol.
For example, to specify a command terminator for Kenwood style text commands pass “-t ';'” to ampctl. See EXAMPLE below.
List all config parameters for the amplifier defined with -m above.
Set amplifier configuration parameter(s), e.g. stop_bits=2.
Use the -L option above for a list of configuration parameters for a given model number.
Dump capabilities for the amplifier defined with -m above and exit.
List all amplifier model numbers defined in Hamlib and exit.
The list is sorted by model number.
Note: In Linux the list can be scrolled back using Shift-PageUp/Shift-PageDown, or using the scrollbars of a virtual terminal in X or the cmd window in Windows. The output can be piped to more(1) or less(1), e.g. “ampctl -l | more”.
Read previously saved command and argument history from a file (default $HOME/.ampctl_history) for the current session.
Available when ampctl is built with Readline support (see READLINE below).
Note: To read a history file stored in another directory, set the AMPCTL_HIST_DIR environment variable, e.g. “AMPCTL_HIST_DIR=~/tmp ampctl -i”. When AMPCTL_HIST_DIR is not set, the value of HOME is used.
Write current session (and previous session(s), if -i option is given) command and argument history to a file (default $HOME/.ampctl_history) at the end of the current session.
Complete commands with arguments are saved as a single line to be recalled and used or edited. Available when ampctl is built with Readline support (see READLINE below).
Note: To write a history file in another directory, set the AMPCTL_HIST_DIR environment variable, e.g. “AMPCTL_HIST_DIR=~/tmp ampctl -IRq. When AMPCTL_HIST_DIR is not set, the value of HOME is used.
Set verbose mode, cumulative (see DIAGNOSTICS below).
Enable time stamps for the debug messages.
Use only in combination with the -v option as it generates no output on its own.
Show a summary of these options and exit.
Show version of ampctl and exit.
-
Stop option processing and read commands from standard input.
See Standard Input below.

Note: Some options may not be implemented by a given backend and will return an error. This is most likely to occur with the --set-conf and --show-conf options.

Please note that the backend for the amplifier to be controlled, or the amplifier itself may not support some commands. In that case, the operation will fail with a Hamlib error code.

Commands can be entered either as a single char, or as a long command name. The commands are not prefixed with a dash as the options are. They may be typed in when in interactive mode or provided as argument(s) in command line interface mode. In interactive mode commands and their arguments may be entered on a single line:


F 14250000

Since most of the Hamlib operations have a set and a get method, an upper case letter will often be used for a set method whereas the corresponding lower case letter refers to the get method. Each operation also has a long name; in interactive mode, prepend a backslash, ‘\’, to enter a long command name.

Example: Use “\dump_caps” to see what capabilities this amplifier and backend support.

Note: The backend for the amplifier to be controlled, or the amplifier itself may not support some commands. In that case, the operation will fail with a Hamlib error message.

A simple example using commands saved to a file (typed text shown in bold):


$ 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:
$

A summary of commands is included below (In the case of set commands the quoted italicized string is replaced by the value in the description. In the case of get commands the quoted italicized string is the key name of the value returned.):

Exit ampctl in interactive mode.
When ampctl is controlling the amplifier directly, will close the amplifier backend and port. When ampctl is connected to ampctld (amplifier model 2), the TCP/IP connection to ampctld is closed and ampctld remains running, available for another TCP/IP network connection.
Set 'Frequency', in Hz.
Frequency may be a floating point or integer value.
Get 'Frequency', in Hz.
Returns an integer value.
Get 'Level Value'.
Returns Level Value as a float or integer for the Level token given.
Note: Passing a ‘?’ (query) as the first argument instead of a Level token will return a space separated list of amplifier backend supported get level tokens. Use this to determine the supported levels of a given amplifier backend.
Send a raw command string to the amplifier.
This is useful for testing and troubleshooting amplifier commands and responses when developing a backend.
For binary protocols enter values as \0xAA\0xBB. Expect a 'Reply' from the amplifier which will likely be a binary block or an ASCII string depending on the amplifier's protocol (see your amplifier's computer control documentation).
The command terminator, set by the send-cmd-term option above, will terminate each command string sent to the amplifier. This character should not be a part of the input string.
Return certain state information about the amplifier backend.
1, dump_caps
Not a real amplifier remote command, it just dumps capabilities, i.e. what the backend knows about this model, and what it can do.
TODO: Ensure this is in a consistent format so it can be read into a hash, dictionary, etc. Bug reports requested.
Note: This command will produce many lines of output so be very careful if using a fixed length array! For example, running this command against the Dummy backend results in a number of lines of text output.
_, get_info
Return information from the amplifier backend.
Perform amplifier 'Reset'.
Reset is an integer value: ‘0’ = None, ‘1’ = Memory reset, ‘2’ = Fault reset, ‘3’ = Amplifier reset.
Set 'Power Status'.
Power Status is an integer value: ‘0’ = Power Off, ‘1’ = Power On, ‘2’ = Power Standby (enter standby), ‘4’ = Power Operate (leave standby).
Get 'Power Status' as in set_powerstat above.
Set 'Antenna' and 'Option'.
Number is 1-based antenna# (‘1’, ‘2’, ‘3’, ...).

1 = A/1
2 = B/2
3 = C/3
    

If Readline library development files are found at configure time, ampctl will be conditonally built with Readline support for command and argument entry. Readline command key bindings are at their defaults as described in the Readline manual. ampctl sets the name “ampctl” which can be used in Conditional Init Constructs in the Readline Init File ($HOME/.inputrc by default) for custom keybindings 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 are prompted for input individually. Commands and arguments are not validated and are stored as typed with values separated by a single space.

Normally session history is not saved, however, use of either of the -i/--read-history or -I/--save-history options when starting ampctl will cause any previously saved history to be read in and/or the current and any previous session history (assuming the -i and -I options are given together) will be written out when ampctl is closed. Each option is mutually exclusive, i.e. either may be given separately or in combination. This is useful to save a set of commands and then read them later but not write the modified history for a consistent set of test commands in interactive mode, for example.

History is stored in $HOME/.ampctl_history by default although the destination directory may be changed 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 may be changed at this time.

If Readline support is not found at configure time the original internal command handler is used. Readline is not used for ampctl commands entered on the command line regardless if Readline support is built in or not.

Note: Readline support is not included in the MS Windows 32 or 64 bit binary builds supplied by the Hamlib Project. Running ampctl on the MS Windows platform in the ‘cmd’ shell does give session command line history, however, it is not saved to disk between sessions.

The -v, --verbose option allows different levels of diagnostics to be output to stderr and correspond to -v for BUG, -vv for ERR, -vvv for WARN, -vvvv for VERBOSE, or -vvvvv for TRACE.

A given verbose level is useful for providing needed debugging information to the email address below. For example, TRACE output shows all of the values sent to and received from the amplifier which is very useful for amplifier backend library development and may be requested by the developers.

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.

Start ampctl for am 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 and specifying the TCP port, setting frequency and mode:


$ ampctl -m 2 -r localhost:4531 F 7253500

This almost empty section...

Report bugs to:


Hamlib Developer mailing list

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.

less(1), more(1), ampctld(1), hamlib(7)

Links to the Hamlib Wiki, Git repository, release archives, and daily snapshot archives are available via hamlib.org.

2020-09-08 Hamlib