Commit graph

70 commits

Author SHA1 Message Date
David Christle
560a44d844
fix(ampctl): bound escaped command parsing
Stop binary command decoding at the documented escape boundary and use the conversion endpoint to advance. This avoids reading beyond a terminated command while preserving valid escaped bytes.
2026-07-27 23:33:13 -05:00
David Christle
c0adbb27bb
fix(ctl): bound command parser inputs
Reject stream read errors instead of synthesizing empty commands, validate raw hexadecimal command syntax without reading past its terminator, and keep fixed-size command and description inputs within their actual capacities.
2026-07-27 23:32:48 -05:00
George Baltz N3GB
0508a165c5 Shrink scope of some iteration variables 2026-06-23 12:13:22 -04:00
George Baltz N3GB
7df5ae1a00 Fix errors found by glibc 2.43
glibc implements some new parts of the C23 standard:
(Taken from https://download.opensuse.org/tumbleweed/iso/Changes.20260430.txt)

  * For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
    strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
    pointers into their input arrays now have definitions as macros that
    return a pointer to a const-qualified type when the input argument is
    a pointer to a const-qualified type

and

  * The aforementioned change in ISO C23 of the declaration of bsearch,
    memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr,
    wcsstr, and wmemchr as const-preserving macros can lead to compilation
    issues in code not set up for it

This lead to some warnings about assigning returns from strchr(const, target)
  to non-const pointers, and then discovering that Hamlib was modifying
  those const parameters.

This commit aligns the const-ness of the offending parameters. Only affects
  internal functions in ampctl_parse.c, rigctl_parse.c and rotctl_parse.c,
  so API/ABI should not change.
2026-05-03 14:55:05 -04:00
George Baltz N3GB
1b2461aba9 Cope with new amplifier code
Replace obsolete usages (search&replace)
Add required includes
2026-02-23 15:16:31 -05: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
Mikael Nousiainen
a526eb6bbc Extend amplifier API with funcs, levels, parms, ops, status and Expert backend.
Add new amp_caps fields (funcs, levels, parms, ops, status, freq ranges, input/ant)
with corresponding frontend API functions, ampctl commands, and dumpcaps
support. Implement Expert 13K-FA/15K-FA/2K-FA amplifier backend. Extend
dummy backend with full coverage of all new API features.
2026-02-17 15:54:00 +02:00
George Baltz N3GB
de5087f57a Same for ampctl_parse.c
Update NEWS
Fix compiler snit about possible truncation
2026-01-28 04:50:19 -05:00
Nate Bargmann
f15537f2e6
Merge GitHub PR #1875 2025-09-02 15:38:54 -05:00
Daniele Forsi IU5HKX
e4c43821d0 Always print error messages to stderr
Do not depend on the debug level set with --verbose
2025-09-02 21:54:18 +02:00
Daniele Forsi IU5HKX
632746cf91 Use rig_debug() instead of sending error messages to stdout 2025-08-30 16:20:32 +02:00
George Baltz N3GB
002677e48c Still more pthread conditional code cleanup 2025-08-27 15:24:50 -04:00
Daniele Forsi IU5HKX
1194125b3d Remove unused code, apparently copied from rotctl_parse.c and modified 2025-08-21 09:03:59 +02:00
Daniele Forsi IU5HKX
90ffcadfa5 Refactor to remove code duplication in ampctl*.c 2025-08-19 16:51:31 +02:00
Daniele Forsi IU5HKX
9904747358 Handle the question mark as second argument of set_level in ampctl
Test command:
tests/ampctl -m 1 \
set_level FAULT '?' \
set_level NH '?' \
set_level PF '?' \
set_level PWRFORWARD '?' \
set_level PWRINPUT '?' \
set_level PWRPEAK '?' \
set_level PWRREFLECTED '?' \
set_level SWR '?'
2025-08-12 23:31:11 +02:00
George Baltz N3GB
e172d34381 Deprecate amp_get_conf(), too 2025-07-28 11:32:34 -04:00
Daniele Forsi IU5HKX
0267068220 Fix ambiguity between system includes and Hamlib includes 2025-07-22 23:33:57 +02:00
Daniele Forsi IU5HKX
2fab137fc5 Apply fixes suggested by iwyu
Removes unused includes and adds missing includes.
2025-07-22 23:33:57 +02:00
George Baltz N3GB
07d0d91a44 Yet more cppcheck messages silenced. 2025-06-15 13:52:09 -04:00
Daniele Forsi IU5HKX
10180a6dc2 Fix sign of error return values
All RIG_E* constants should be negated when returned or compared.

Fixed with:
perl -pe 's/return RIG_E/return -RIG_E/' -i $(grep -lEr "return RIG_E" --include=*.{c,h})
perl -pe 's/= RIG_E/= -RIG_E/g' -i $(grep -lEr "= RIG_E" --include=*.{c,h})
2025-06-07 12:07:44 +02:00
Michael Black W9MDB
57c5047c3e Hopefully fix codeql warning about cleartext storage of sensitive information 2024-12-22 10:32:59 -06:00
George Baltz N3GB
7bf63ecbf0 More amplifier and rotator state changes 2024-07-14 01:17:28 -04:00
George Baltz N3GB
728db84c0c Finish tests/* 2024-03-01 12:27:26 -05:00
Mike Black W9MDB
e267c62764 astyle files 2023-12-16 11:37:58 -06: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
Mike Black W9MDB
2da6c400f7 Add RTS/DTR capability to rotctl and ampctl 2023-07-20 11:58:26 -05:00
Mike Black W9MDB
dad55ef148 astyle files getting ready for WSJT-x-2.7.0rc1 2023-05-08 07:37:13 -05:00
Daniele Forsi IU5HKX
1c72440c51 Fix segfaults with malformed input and wrong command line arguments
Fixes:
NULL dereference.

Steps to reproduce:
echo L x | tests/ampctl
echo L x | tests/rigctl
echo L x | tests/rotctl
2023-04-10 19:44:49 +02:00
Daniele Forsi IU5HKX
e11b4bd01c Fix segfaults with malformed input and wrong command line arguments
Fixes:
NULL dereference.

Steps to reproduce:
echo L | tests/ampctl
echo L | tests/rigctl
echo L | tests/rotctl
2023-04-10 19:44:40 +02:00
Daniele Forsi IU5HKX
96bb604b12 Fix typos 2023-04-09 23:06:32 +02:00
Daniele Forsi IU5HKX
52d41236a7 Enable --show-conf for ampctl and ampctld 2023-03-18 10:25:36 +01:00
Daniele Forsi IU5HKX
3f90086991 [tests] Fix includes 2023-02-16 19:08:24 +01:00
Mike Black W9MDB
c5a83b1652 Fix compiler warnings 2022-11-28 11:39:03 -06:00
Mike Black W9MDB
a83eb3bf42 astyle files for 4.5 release 2022-07-27 17:16:17 -05:00
Mike Black W9MDB
627ec83652 Change malloc to calloc 2022-07-27 10:26:08 -05:00
Mike Black W9MDB
30884ae47e Add amp_set_level and amp_set_ext_level 2022-07-14 08:14:41 -05:00
Mike Black W9MDB
68e121d82c Change all to remove HAVE_CONFIG dependency and include <hamlib/config.h> by default
This is necessary to keep alignment between the client view of rig->state and the shared libarary view
Including PTHREAD functions in rig->state necessitated this as HAVE_PTHREAD only defined during hamlib compilation.
Clients including hamlib/rig.h did not pick up all the HAVE* config variable that control what gets included
https://github.com/Hamlib/Hamlib/issues/947
2022-02-04 07:41:36 -06:00
Mike Black W9MDB
c2cb94e412 Change sprintf to snprint in tests
https://github.com/Hamlib/Hamlib/issues/857
2022-01-11 00:00:44 -06:00
Mikael Nousiainen
c764336e73 Fix build warnings caused by changes to I/O function signatures 2021-12-18 23:49:45 +02:00
Mike Black W9MDB
d820ee9dbf Add expected_len to read_string function for potential serial I/O speedup
https://github.com/Hamlib/Hamlib/issues/850
2021-11-24 13:02:39 -06:00
Mike Black W9MDB
8fe190d622 Reduce error messages about RIG_VFO_OTHER which only applies to some rigs like Icom rigs with the 0x25 command
Add a flush_flag to read_string so that the new serial_flush will not produce a timeout value when flushing
https://github.com/Hamlib/Hamlib/issues/835
2021-11-01 23:43:45 -05:00
Michael Black W9MDB
6eee309b56 Improve rig_get_version and hamlib_version2 information to include commit information
https://github.com/Hamlib/Hamlib/issues/617
2021-03-19 22:56:18 -05:00
Michael Black W9MDB
82126a4f09 Phase 1 of changing sprintflst functions to use buffer length
https://github.com/Hamlib/Hamlib/issues/580
2021-03-03 08:03:18 -06:00
Mikael Nousiainen
a48f149955 Implement funcs, levels and parms + the ext variants for rotators. Add option to not change rotator speed when using the move command. Add rotator status flags. Work in progress. 2020-11-24 21:51:10 +02:00
Daniele Forsi
d7b332c3f7 Fix spelling errors
Fixed using the following command:
codespell --write-changes --summary --skip=*.m4 --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"
codespell --write-changes --summary --skip=aclocal.m4,lib --ignore-words-list="develope,get's,quitt,setts,som,ue,vektor"

Codespell home page: https://github.com/codespell-project/codespell
2020-07-24 09:02:48 +02:00
Michael Black W9MDB
1be5c71e76 More conversions to rig_flush
https://github.com/Hamlib/Hamlib/issues/307
2020-06-23 08:39:11 -05:00
Michael Black
bda5feb1bd More cppcheck changes 2020-03-23 10:13:02 -05:00
Michael Black
d0f114b178 Add macro_name to caps structures for rig, rot, and amp devices 2020-03-05 23:48:14 -06:00
Michael Black
ff8ddf018c astyle all C files 2020-02-23 11:26:09 -06:00
Michael Black
d57cdc1cbf
More mingw32 fixes 2020-01-15 17:21:20 -06:00