[go: up one dir, main page]

Menu

[55feb0]: / doc / man1 / ampctl.1  Maximize  Restore  History

Download this file

684 lines (671 with data), 16.0 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
.\" Hey, EMACS: -*- nroff -*-
.\"
.\" For layout and available macros, see man(7), man-pages(7), groff_man(7)
.\" Please adjust the date whenever revising the manpage.
.\"
.\" Note: Please keep this page in sync with the source, ampctl.c
.\"
.TH AMPCTL "1" "2020-09-08" "Hamlib" "Hamlib Utilities"
.
.
.SH NAME
.
ampctl \- control radio amplifiers
.
.SH SYNOPSIS
.
.
.SY ampctl
.OP \-hiIlLuV
.OP \-m id
.OP \-r device
.OP \-s baud
.OP \-t char
.OP \-C parm=val
.RB [ \-v [ \-Z ]]
.RB [ command | \- ]
.YS
.
.SH DESCRIPTION
Control radio amplifiers.
.B ampctl
accepts
.B commands
from the command line as well as in interactive mode if none are provided on
the command line.
.
.PP
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.
.
.PP
Please report bugs and provide feedback at the e-mail address given in the
.B BUGS
section below. Patches and code enhancements sent to the same address are
welcome.
.
.
.SH OPTIONS
.
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 (\(oq\-\(cq) require an
\(oq=\(cq between the option and any argument.
.
.PP
Here is a summary of the supported options:
.
.TP
.BR \-m ", " \-\-model = \fIid\fP
Select amplifier model number.
.IP
See model list (use \(lqampctl -l\(rq).
.IP
.BR Note :
.B ampctl
(or third party software using the C API) will use amplifier model 2 for
.B NET ampctl
(communicating with
.BR ampctld ).
.
.TP
.BR \-r ", " \-\-amp\-file = \fIdevice\fP
Use
.I device
as the file name of the port connected to the amplifier.
.IP
Often a serial port, but could be a USB to serial adapter. Typically
.IR /dev/ttyS0 ", " /dev/ttyS1 ", " /dev/ttyUSB0 ,
etc. on Linux,
.IR COM1 ", " COM2 ,
etc. on MS Windows. The BSD flavors and Mac OS/X have their own designations.
See your system's documentation.
.
.TP
.BR \-s ", " \-\-serial\-speed = \fIbaud\fP
Set serial speed to
.I baud
rate.
.IP
Uses maximum serial speed from amplifier backend capabilities (set by
.B -m
above) as the default.
.
.TP
.BR \-t ", " \-\-send\-cmd\-term = \fIchar\fP
Change the termination
.I char
for text protocol when using the
.B send_cmd
command.
.IP
The default value is ASCII CR (\(oq0x0D\(cq). ASCII non-printing characters
can be given as the ASCII number in hexadecimal format prepended with
\(lq0x\(rq. You may pass an empty string for no termination char. The string
\(lq\-1\(rq tells
.B ampctl
to switch to binary protocol.
.IP
For example, to specify a command terminator for Kenwood style text commands
pass \(lq-t ';'\(rq to ampctl. See
.B EXAMPLE
below.
.
.TP
.BR \-L ", " \-\-show\-conf
List all config parameters for the amplifier defined with
.B \-m
above.
.
.TP
.BR \-C ", " \-\-set\-conf = \fIparm=val\fP [ \fI,parm=val\fP ]
Set amplifier configuration parameter(s), e.g.
.IR stop_bits=2 .
.IP
Use the
.B -L
option above for a list of configuration parameters for a given model number.
.
.TP
.BR \-u ", " \-\-dump\-caps
Dump capabilities for the amplifier defined with
.B -m
above and exit.
.
.TP
.BR \-l ", " \-\-list
List all amplifier model numbers defined in
.B Hamlib
and exit.
.IP
The list is sorted by model number.
.IP
.BR Note :
In Linux the list can be scrolled back using
.BR 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
.BR more (1)
or
.BR less (1),
e.g. \(lqampctl -l | more\(rq.
.
.TP
.BR \-i ", " \-\-read\-history
Read previously saved command and argument history from a file (default
.IR $HOME/.ampctl_history )
for the current session.
.IP
Available when
.B ampctl
is built with Readline support (see READLINE below).
.IP
.BR Note :
To read a history file stored in another directory, set the
.B AMPCTL_HIST_DIR
environment variable, e.g. \(lqAMPCTL_HIST_DIR=~/tmp ampctl -i\(rq. When
AMPCTL_HIST_DIR is not set, the value of
.B HOME
is used.
.
.TP
.BR \-I ", " \-\-save\-history
Write current session (and previous session(s), if
.B -i
option is given) command and argument history to a file (default
.IR $HOME/.ampctl_history )
at the end of the current session.
.IP
Complete commands with arguments are saved as a single line to be recalled and
used or edited. Available when
.B ampctl
is built with Readline support (see
.B READLINE
below).
.IP
.BR Note :
To write a history file in another directory, set the
.B AMPCTL_HIST_DIR
environment variable, e.g. \(lqAMPCTL_HIST_DIR=~/tmp ampctl -I\)Rq. When
AMPCTL_HIST_DIR is not set, the value of
.B HOME
is used.
.
.TP
.BR \-v ", " \-\-verbose
Set verbose mode, cumulative (see
.B DIAGNOSTICS
below).
.
.TP
.BR \-Z ", " \-\-debug\-time\-stamps
Enable time stamps for the debug messages.
.IP
Use only in combination with the
.B -v
option as it generates no output on its own.
.
.TP
.BR \-h ", " \-\-help
Show a summary of these options and exit.
.
.TP
.BR \-V ", " \-\-version
Show version of
.B ampctl
and exit.
.
.TP
.B \-
Stop option processing and read commands from standard input.
.IP
See
.B Standard Input
below.
.
.PP
.BR Note :
Some options may not be implemented by a given backend and will return an
error. This is most likely to occur with the
.B \-\-set\-conf
and
.B \-\-show\-conf
options.
.
.PP
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
.B Hamlib
error code.
.
.
.SH COMMANDS
.
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:
.
.PP
.in +4n
.EX
.B F 14250000
.EE
.in
.
.PP
Since most of the
.B Hamlib
operations have a
.B set
and a
.B get
method, an upper case letter will often be used for a
.B set
method whereas the corresponding lower case letter refers to the
.B get
method. Each operation also has a long name; in interactive mode, prepend a
backslash, \(oq\\\(cq, to enter a long command name.
.
.PP
Example: Use \(lq\\dump_caps\(rq to see what capabilities this amplifier and
backend support.
.
.IP
.BR 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
.B Hamlib
error message.
.
.
.PP
A simple example using commands saved to a file (typed text shown in bold):
.
.PP
.in +4n
.EX
.RB $ " cat <<.EOF. >cmds.txt"
.RB > " # File of commands"
.RB > " F 14250000"
.RB > " f"
.RB > " l PWRINPUT"
.RB > " l PWRFORWARD"
.RB > " l SWR"
> \fB\\dump_caps\fP
.RB > " .EOF."
.RB $ " 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:
$
.EE
.in
.
.
.SS ampctl Commands
.
A summary of commands is included below (In the case of
.B set
commands the quoted italicized string is replaced by the value in the
description. In the case of
.B get
commands the quoted italicized string is the key name of the value returned.):
.
.TP
.BR Q | q ", exit ampctl"
Exit ampctl in interactive mode.
.IP
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.
.
.TP
.BR F ", " set_freq " \(aq" \fIFrequency\fP \(aq
Set
.RI \(aq Frequency \(aq,
in Hz.
.IP
Frequency may be a floating point or integer value.
.
.TP
.BR f ", " get_freq
Get
.RI \(aq Frequency \(aq,
in Hz.
.IP
Returns an integer value.
.
.TP
.BR l ", " get_level " \(aq" \fILevel\fP \(aq
Get
.RI \(aq "Level Value" \(aq.
.IP
Returns Level Value as a float or integer for the Level token given.
.IP
.BR Note :
Passing a \(oq?\(cq (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.
.
.TP
.BR w ", " send_cmd " \(aq" \fICmd\fP \(aq
Send a raw command string to the amplifier.
.IP
This is useful for testing and troubleshooting amplifier commands and
responses when developing a backend.
.IP
For binary protocols enter values as \\0xAA\\0xBB. Expect a
.RI \(aq Reply \(aq
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).
.IP
The command terminator, set by the
.B 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.
.
.TP
.B dump_state
Return certain state information about the amplifier backend.
.
.TP
.BR 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.
.IP
TODO: Ensure this is in a consistent format so it can be read into a hash,
dictionary, etc. Bug reports requested.
.IP
.BR 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.
.
.TP
.BR _ ", " get_info
Return information from the amplifier backend.
.
.TP
.BR R ", " reset " \(aq" \fIReset\fP \(aq
Perform amplifier
.RI \(aq Reset \(aq.
.IP
Reset is an integer value: \(oq0\(cq = None, \(oq1\(cq = Memory reset,
\(oq2\(cq = Fault reset, \(oq3\(cq = Amplifier reset.
.
.TP
.BR set_powerstat " \(aq" "\fIPower Status\fP" \(aq
Set
.RI \(aq "Power Status" \(aq.
.IP
Power Status is an integer value: \(oq0\(cq = Power Off, \(oq1\(cq = Power On,
\(oq2\(cq = Power Standby (enter standby), \(oq4\(cq = Power Operate (leave
standby).
.
.TP
.B get_powerstat
Get
.RI \(aq "Power Status" \(aq
as in
.B set_powerstat
above.
.
.TP
.BR Y ", " set_ant " \(aq" \fIAntenna\fP "\(aq \(aq" \fIOption\fP \(aq
Set
.RI \(aq Antenna \(aq
and
.RI \(aq Option \(aq.
.IP
Number is 1-based antenna# (\(oq1\(cq, \(oq2\(cq, \(oq3\(cq, ...).
.IP
.in +4n
.EX
1 = A/1
2 = B/2
3 = C/3
.EE
.in
.
.
.SH READLINE
.
If
.B Readline
library development files are found at configure time,
.B ampctl
will be conditionally built with Readline support for command and argument entry.
Readline command key bindings are at their defaults as described in the
.UR https://tiswww.cwru.edu/php/chet/readline/rluserman.html
Readline manual
.UE .
.B ampctl
sets the name \(lqampctl\(rq which can be used in Conditional Init Constructs
in the Readline Init File
.RI ( $HOME/.inputrc
by default) for custom keybindings unique to
.BR ampctl .
.
.PP
Command history is available with Readline support as described in the
.UR https://tiswww.case.edu/php/chet/readline/history.html#SEC1
Readline History manual
.UE .
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.
.
.PP
Normally session history is not saved, however, use of either of the
.BR \-i / \-\-read\-history
or
.BR \-I / \-\-save\-history
options when starting
.B ampctl
will cause any previously saved history to be read in and/or the
current and any previous session history (assuming the
.BR -i " and " -I
options are given together) will be written out when
.B 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.
.
.PP
History is stored in
.I $HOME/.ampctl_history
by default although the destination directory may be changed by setting the
.B AMPCTL_HIST_DIR
environment variable. When AMPCTL_HIST_DIR is unset, the value of the
.B HOME
environment variable is used instead. Only the destination directory may be
changed at this time.
.
.PP
If Readline support is not found at configure time the original internal
command handler is used. Readline is not used for
.B ampctl
commands entered on the command line regardless if Readline support is built
in or not.
.
.PP
.BR Note :
Readline support is not included in the MS Windows 32 or 64 bit binary builds
supplied by the Hamlib Project. Running
.B ampctl
on the MS Windows platform in the \(oqcmd\(cq shell does give session command
line history, however, it is not saved to disk between sessions.
.
.
.SH DIAGNOSTICS
.
The
.BR \-v ,
.B \-\-verbose
option allows different levels of diagnostics
to be output to
.B stderr
and correspond to \-v for
.BR BUG ,
\-vv for
.BR ERR ,
\-vvv for
.BR WARN ,
\-vvvv for
.BR VERBOSE ,
or \-vvvvv for
.BR TRACE .
.
.PP
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.
.
.
.SH EXIT STATUS
.B ampctl
exits with:
.
.TP
.B 0
if all operations completed normally;
.
.TP
.B 1
if there was an invalid command line option or argument;
.
.TP
.B 2
if an error was returned by
.BR Hamlib .
.
.
.SH EXAMPLES
.
Start
.B ampctl
for am Elecraft KPA-1500 using a USB to serial adapter on Linux in interactive
mode:
.
.PP
.in +4n
.EX
.RB $ " ampctl -m 201 -r /dev/ttyUSB1"
.EE
.in
.
.PP
Start
.B ampctl
for an Elecraft KPA-1500 using COM1 on MS Windows while generating TRACE
output to
.IR stderr :
.
.PP
.in +4n
.EX
.RB > " ampctl -m 201 -r COM1 -vvvvv"
.EE
.in
.
.PP
Connect to a running
.B ampctld
with amplifier model 2 (\(lqNET ampctl\(rq) on the local host and specifying
the TCP port, setting frequency and mode:
.
.PP
.in +4n
.EX
.RB $ " ampctl -m 2 -r localhost:4531 F 7253500"
.EE
.in
.
.
.SH BUGS
.
This almost empty section...
.PP
Report bugs to:
.IP
.nf
.MT hamlib\-developer@lists.sourceforge.net
Hamlib Developer mailing list
.ME
.fi
.
.
.SH 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.
.
.PP
Copyright \(co 2000-2011 Stephane Fillod
.br
Copyright \(co 2000-2018 the Hamlib Group (various contributors)
.br
Copyright \(co 2010-2020 Nate Bargmann
.
.PP
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.
.
.
.SH SEE ALSO
.
.BR less (1),
.BR more (1),
.BR ampctld (1),
.BR hamlib (7)
.
.
.SH COLOPHON
.
Links to the Hamlib Wiki, Git repository, release archives, and daily snapshot
archives are available via
.
.UR http://www.hamlib.org
hamlib.org
.UE .