Commit graph

216 commits

Author SHA1 Message Date
George Baltz N3GB
b56f8d8f8a Infrastructure and setup for associating connection data with thread
Will allow rigctl_parse() routines access to connection data, without
  reworking all of the internal and external interfaces.
2026-06-03 15:45:12 -04:00
George Baltz N3GB
29c4ec4778 Finish adding #include's for things moving out of rig.h
Clean compile & execution with both NO_OLD_INCLUDES and NO_OLD_STRUCTS
  defined.
2026-02-23 11:12:15 -05:00
George Baltz N3GB
1945e8db33 Remove all code references to (rig|ptt|dcd)port_deprecated.
The structures are no longer read or written.
2026-02-23 11:02:34 -05:00
Daniele Forsi IU5HKX
59916293de Make static all usage() and usage_short() functions 2025-09-21 22:20:29 +02:00
Daniele Forsi IU5HKX
6708caa73a Print a shorter usage text for unknown options
Test case:
tests/ampctl -Q
tests/ampctld -Q
tests/rigctl -Q
tests/rigctld -Q
tests/rotctl -Q
tests/rotctld -Q

Expected output:
/home/ham/Hamlib/tests/.libs/ampctl: invalid option -- 'Q'
Usage: ampctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected amplifier.

Type: ampctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/ampctld: invalid option -- 'Q'
Usage: ampctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected amplifier.

Type: ampctld --help for extended usage.
/home/ham/Hamlib/tests/.libs/rigctl: invalid option -- 'Q'
Usage: rigctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected radio transceiver or receiver.

Type: rigctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/rigctld: invalid option -- 'Q'
Usage: rigctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected radio transceiver or receiver.

Type: rigctld --help for extended usage.
/home/ham/Hamlib/tests/.libs/rotctl: invalid option -- 'Q'
Usage: rotctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected antenna rotator.

Type: rotctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/rotctld: invalid option -- 'Q'
Usage: rotctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected antenna rotator.

Type: rotctld --help for extended usage.
2025-09-21 22:20:15 +02:00
Daniele Forsi IU5HKX
942214da6e Direct usage text to stderr or stdout depending on context
Prints usage text to stdout when requested with -h/--help
or to stderr otherwise.

Test cases:
tests/rigctl --help # prints to stdout
tests/rigctl -Q # prints to stderr
2025-09-21 18:12:32 +02:00
Daniele Forsi IU5HKX
cbefd0835f Do not show any debug trace messages unless requested with -vvvvv
This fixes the following commands that always printed debug messages
at the trace level:
 tests/ampctld -l >/dev/null
 tests/ampctl -h >/dev/null
 tests/rigctld -l >/dev/null
 tests/rigctltcp -l >/dev/null
 tests/rotctld -l >/dev/null
It doesn't affect other software which worked around this issue,
but changes all software to avoid regressions in future.

Test case (should print nothing in bash):
{
tests/ampctl -l -h
tests/ampctld -l -h
tests/rigctl -l -h
tests/rigctlcom -l -h
tests/rigctld -l -h
tests/rigctlsync -l -h
tests/rigctltcp -l -h
tests/rotctl -l -h
tests/rotctld -l -h
} >/dev/null
2025-08-20 17:03:32 +02:00
Daniele Forsi IU5HKX
ead67ec170 Replace magic number with define 2025-08-20 12:17:29 +02:00
Daniele Forsi IU5HKX
67038154db Refactor to remove code duplication in rigctl*.c 2025-08-19 16:51:31 +02:00
Daniele Forsi IU5HKX
0267068220 Fix ambiguity between system includes and Hamlib includes 2025-07-22 23:33:57 +02:00
George Baltz N3GB
39a1a367e1 Get rid of a few more style infractions.
Update NEWS.
2025-06-08 03:42:33 -04:00
Daniele Forsi IU5HKX
72bde6e131 Fix sign of error return values
All RIG_E* constants should be negated when returned or compared.
Change the usages of RIG_IS_SOFT_ERRCODE() for consistency.
2025-06-07 10:54:34 +02:00
Nate Bargmann
c92fee947a
Merge GitHub PR #1709 2025-06-05 21:42:20 -05:00
Daniele Forsi IU5HKX
dc3a71da1b Document existing option to read commands from stdin 2025-05-14 19:41:34 +02:00
Daniele Forsi IU5HKX
57e5dba438 Make usage texts more similar 2025-05-14 19:41:34 +02:00
Daniele Forsi IU5HKX
20b92ea115 Remove dead code
The code removed could never be executed because getopt()/getopt_long()
detect a missing argument only if it is at the end of the command line
and return '?' which is handled by the default case of the switch which
prints an error message to stderr.
2025-04-21 22:37:37 +02:00
George Baltz N3GB
8150583541 Drop redundant token lookups. 2025-04-20 21:28:57 -04:00
Daniele Forsi IU5HKX
b141c14270 Make help strings more similar
Fixes text indent and verbs.
2025-04-19 23:57:26 +02:00
Michael Black W9MDB
57c145d5d1 Remove skip_init default
Was causing segfault on rigctl -m 2041 -r /dev/pts/4 M CW 250 b 73
2024-12-25 22:43:20 -06:00
Michael Black W9MDB
8edf99fc18 Change skipinit so skip-init for consistency
And now ignores the skip-init on the non-interactive rigctl
2024-12-25 16:36:37 -06:00
Michael Black W9MDB
9ac7f92d1e Update some documentation 2024-12-25 15:59:40 -06:00
Michael Black W9MDB
e0a805ebc3 Make skip_init automatic when rigctl has commands on the line 2024-12-24 23:19:02 -06:00
Michael Black W9MDB
72424ac144 Fix buffer overflow in rigctl.c
https://github.com/Hamlib/Hamlib/security/code-scanning/3212
2024-12-21 14:41:58 -06:00
Mike Black W9MDB
5c269964c2 astyle files in preparation for release 4.6 2024-11-06 08:07:34 -06:00
Mike Black W9MDB
108f52806e Fix segfault when run as rigctl --ptt-file=/dev/ttyUSB2 --ptt-type=RTS
https://github.com/Hamlib/Hamlib/issues/1560
2024-06-15 22:18:59 -05:00
George Baltz N3GB
2f97b4bf82 Still more state pointer conversions. 2024-06-02 13:26:01 -04:00
Mike Black W9MDB
c16ef02196 Change rigctl and rigctld to use RTS PTT by default when --ptt-file is specified and no PTT type is given.
Can still be overridden by --set-conf=ptt_type=DTR for example.
https://github.com/Hamlib/Hamlib/issues/1560
2024-06-01 15:10:00 -05:00
Mike Black W9MDB
97a693a87f Use rig_set_conf to set pathname in rigctl and rigctld -- allows retention of default port for example 2024-05-24 07:24:24 -05:00
George Baltz N3GB
07f8023d17 Convert tests/* to pointers 2024-03-01 12:27:26 -05:00
George Baltz N3GB
b1d85e5aa1 Update dcdport usage in tests/*.c
Issue #1445
2024-02-05 11:28:30 -05:00
Mike Black W9MDB
05033171c3 Change token_t to hamlib_token_t to avoid collsions with libbsm and others
https://github.com/Hamlib/Hamlib/issues/1469
2024-01-21 23:11:55 -06:00
Mikael Nousiainen
eb7634abfb Merge upstream changes and fix conflicts 2024-01-15 09:24:17 +02:00
Mike Black W9MDB
9b817f325d Add --skipinit to rigctl.c -- can speed up single command-line invocations by quite a bit 2024-01-13 08:26:44 -06:00
Mikael Nousiainen
1cc08d2f00 Merge upstream and fix conflicts 2023-12-19 18:03:12 +02:00
Mike Black W9MDB
af5ea58350 Add -# --skip_init option to rigctl 2023-12-18 15:26:46 -06:00
Mike Black W9MDB
e267c62764 astyle files 2023-12-16 11:37:58 -06:00
Mikael Nousiainen
7d5f540b9c Fix bugs in dummy rig. Report errors (incl. timeouts) from icom_get_powerstat(), because the timeout reason is often something else than rig being powered off. Check for power status changes in rigctld/rigctl command loops. 2023-11-20 10:15:45 +02:00
Mike Black W9MDB
02ffc6d6dc More set_conf/get_conf work
https://github.com/Hamlib/Hamlib/issues/971
2023-11-05 17:03:21 -06:00
Mikael Nousiainen
43d1fbb323 Add more detailed rig communication status to rig_state and multicast state data packets. Handle SIGINT and SIGTERM in a consistent way in both rigctl and rigctld. 2023-11-06 00:42:02 +02:00
Mike Black W9MDB
d28ce6b798 Bump up some 1024 buffers to 2048 to avoid overflow error 2023-07-21 11:46:58 -05:00
Mike Black W9MDB
a6de41e206 rigctld can now see RIG_LEVEL values correctly
https://github.com/Hamlib/Hamlib/issues/1305
2023-06-03 16:50:30 -05:00
Mikael Nousiainen
fd68723da1 Fix issues with power status handling in rigctl+rigctld and the Yaesu backend 2023-05-26 18:03:20 +03:00
Daniele Forsi IU5HKX
3f90086991 [tests] Fix includes 2023-02-16 19:08:24 +01:00
Mike Black W9MDB
52bed765ef Clean up rig power on/off sequencing for Kenwood/Elecraft rigs
Note that the K3/K3S cannot power on via CAT control
https://github.com/Hamlib/Hamlib/issues/1225
2023-01-22 23:41:21 -06:00
Mike Black W9MDB
6c5e0e6974 Update astyle formatting 2022-11-16 15:30:36 -06:00
Mike Black W9MDB
ba06546623 Fix segfault with ptt_type --- seems to be constant on LHS so can't set it 2022-11-13 09:53:19 -06:00
Mike Black W9MDB
5164c1c366 Fix dummy ptt_type when ptt_type is specified on command line for rigctl and rigctld
https://github.com/Hamlib/Hamlib/issues/888
2022-11-13 08:04:27 -06:00
Mike Black W9MDB
4dbce1a0aa Add setvbuf to rigctl.c and rigctld.d to overcome non-buffering of stderr on mingw builds.
Should also speed up other OS's too since only 1 flush will be executed instead of 2
2022-10-02 08:06:50 -05:00
Mike Black W9MDB
c34f719337 Astyle files 2022-08-20 22:56:04 -05:00
Mike Black W9MDB
37830f7442 Add error codes and messages to rigctl and rigctld --help 2022-07-30 15:45:04 -05:00