Commit graph

2255 commits

Author SHA1 Message Date
Dhiru Kholia
debe6fcaf9 Add support for rigs using the 'Simple CAT' protocol
See 'rigs/simplecat/SIMPLE_CAT_PROTOCOL.md' for the protocol spec.

Notes:

- Memory correctness checks were done using Valgrind.

- Tested with wsjtx-3.1.0_improved_PLUS_260228.tgz (with mods) and
  Bunzee Labs' DDX HF Digital Transceiver

  https://bunzee-labs.com/products/ddx

Tested on:

- Ubuntu Linux
- macOS Tahoe
- Windows 11
2026-03-25 17:42:32 +05:30
Nate Bargmann
0c061d5b2e
Merge GitHub PR #2003 2026-03-08 11:24:26 -05: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
George Baltz N3GB
7a1a0d35ec And finally, the amplifiers
Resolve conflicts with new amp code/
Why move the ampport, rather than adding stuff after it???
2026-02-23 11:10:20 -05:00
George Baltz N3GB
2b3bb97dbf Convert rotators to heap storage
Just like the rigs
2026-02-23 11:02:34 -05:00
George Baltz N3GB
1cabf8ccf2 Stop updating data in deprecated structures
They go away with 5.0
2026-02-23 11:02:34 -05:00
George Baltz N3GB
bdf70503c1 Remove references to rig_state_deprecated. 2026-02-23 11:02:34 -05:00
George Baltz N3GB
02ea4af572 Move rig_state to heap storage.
Allocate and free it.
For access apps must
1) #include <hamlib/rig_state.h>  and
2) Use HAMLIB_STATE(rig) to get the address

Also fix a couple of misuses of STATE() macro.
2026-02-23 11:02:34 -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
George Baltz N3GB
0fc8954a09 Use heap storage for all rig ports
Allocates and frees buffers for CAT, PTT, and DCD.
Does *NOT* copy anything from STATE(rig)->rigport, so only works if
a) app uses rig_set_conf()   or
b) app uses HAMLIB_...() macros
2026-02-23 11:02:34 -05:00
Matthias Moeller
5a87f7e415 Initialize rp->timeout in rig_init 2026-02-22 03:01:16 +01:00
Mikael Nousiainen
d22209f4af Use double quotes for internal includes in files internal to Hamlib 2026-02-21 10:58:06 +02:00
Mikael Nousiainen
e48fcc3035 Attempt to fix CodeQL issues and distcheck Python tests 2026-02-20 19:02:20 +02: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
2ea9a30ea6 More cppcheck stuff
What started out as some cppcheck cleanups turned into a trip
  down the rabbit-hole that is neverused.c, a mix of dummy calls
  to avoid cppcheck warnings and tracers for routines that either
  don't exist anymore or are #ifdef'ed out.
  - Make it compile with '-std=c89' (no function prototypes)
  - Get rid of the calls to routines that were removed.
  - Remove some of the calls that are used elsewhere.
  - Not complete

TODO: The XXREMOVEDXX routines should be examinied to see if they are
  really needed or will be implemented in the future, and if not
  removed completely. And/or maybe just delete neverused.c.
2025-12-30 13:47:34 -05:00
George Baltz N3GB
ebf45bf5a0 Drop old name for hl_stars 2025-12-26 12:55:33 -05:00
Daniele Forsi IU5HKX
ee42a8c120 Fix typos 2025-12-21 13:12:23 +01:00
George Baltz N3GB
1d7f7591d9 First round of IC-F8101 updates
Thanks to AB4MW for driving this
See Issue #1954
2025-12-07 20:32:17 -05:00
Daniele Forsi IU5HKX
fe7fee4893 Fix typos 2025-12-02 22:06:42 +01:00
George Baltz N3GB
4ad91cad0a Add a fallback function for spaces()
This shouldn't be needed, but somebody somewhere sometime is going
to use an old rigctl with a new hamlib and get an undefined symbol.

Should go away with 5.0.
2025-10-03 11:12:06 -04:00
George Baltz N3GB
d391e569ce Add rig to opened list even if skip_init is set.
Just in case someone finishes CHECK_RIG_ARG,
 or checks status from remove_opened_rig().
2025-09-30 11:09:18 -04:00
George Baltz N3GB
8bd19c4db8 Change pseudo-anonymous structure name to convention. 2025-09-27 15:56:31 -04:00
George Baltz N3GB
00020e6d9d Add 'hl_' prefix to names of push(), pop() and peek()
to avoid conflict with app code.

Add header to fifo.c
Drop unused structure member in rig.c
2025-09-27 15:56:31 -04:00
George Baltz N3GB
2283473707 Move FIFO_RIG from hamlib/rig.h to fifo.h where it belongs.
Add header to fifo.h
Update structure pointer in rig_state
2025-09-27 15:56:31 -04:00
Nate Bargmann
0d122f6b1a
Restore information message from diff
Make sure tab preceeds all indented lines.
2025-09-27 11:16:32 -05:00
Nate Bargmann
34fa8d0e2f
Refactor hamlibdatetime.h target
Re: GitHub Issue #1895

Thanks to inspiration from Jan Engelhardt <ej@inai.de> via the GNU
automake mailing list on Thu, 25 Sep 2025 20:40:21 +0200 (CEST):
https://lists.gnu.org/archive/html/automake/2025-09/msg00013.html
The 'diff' command has been wrapped inside an 'if' conditional to
hopefully hide its return value from FreeBSD make.

Also make a couple other small changes.
2025-09-26 20:54:46 -05:00
Jan Engelhardt
744fe5a066
Remove redundant path from BUILT_SOURCES
Re: GitHub Issue #1895

In response to a query to the automake mailing list, this reply was
received:

On Wednesday 2025-09-24 19:05, Nate Bargmann wrote:

>make[1]: don't know how to make ./hamlibdatetime.h. Stop

Something wanted to make "./hamlibdatetime.h", but you only provide
a rule for "hamlibdatetime.h":

>hamlibdatetime.h: FORCE
>       @if test -x $(top_srcdir)/.git ; then \
>               echo "/* This date time is from the last non-merge commit to Hamlib. */" > $(builddir)/$(@F).tmp ;\
>               echo "#define HAMLIBDATETIME "\"$$(TZ=UTC git --git-dir=$(top_srcdir)/.git log --no-merges
+--date='format-local:%Y-%m-%dT%H:%M:%SZ SHA=' --format='%cd' -n 1)$$(git --git-dir=$(top_srcdir)/.git log --no-merges -n 1 | head
+-n 1 | cut -c8-13)\"  >> $(builddir)/$(@F).tmp ;\

The distinction is important.

>BUILT_SOURCES = $(builddir)/hamlibdatetime.h

All targets are already relative to ${builddir},
so explicitly mentioning ${builddir} is wrong for
targets, and redundant in the recipe.

----------------------

Removing "$(builddir)/" allows FreeBSD make to enter the rule.  GNU make
wasn't bothered by the prepending of the path when comparing to the
Makefile target.
2025-09-26 08:13:26 -05:00
Nate Bargmann
d04364e685
Use pkgconf/pkg-config to test for libusb-1.0
As reported in GitHub issue #1892, configure on FreeBSD failed to search
for the name of the library correctly which is libusb.  As pkg-config
correctly holds the library name for linking, modify the search for
libusb-1.0 to use the pkg-config capability.  If pkg-config (now largely
replaced by pkgconf) is not installed or found, the modules depending on
it will be gracefull disabled, i.e. the configure script will complete
with those modules disabled.

Modify the output summary to use spaces instead of tabs as things were
not lining up nicely in my FreeBSD terminal.

Rename the Automake substituted variable 'HAVE_LIBUSB' to
'TESTS_HAVE_LIBUSB' to avoid confusion with identically named variable
written to include/hamlib/config.h.

Likewise, rename the AutoConf substituted name 'LIBUSB' to
'HAMLIB_PC_LIBUSB' to avoid confusion with the 'LIBUSB' string passed to
PKG_CHECK_MODULES.

Update hamlib.pc.in and tests/Makefile.am to use the new variable names.

Make sure all source files no longer reference HAVE_LIBUSB_H or
HAVE_LIBUSB_1_0_LIBUSB_H as these variables no longer exist.

Fix src/Makefile.am to provide include path for usb_port.c.
2025-09-17 21:31:37 -05:00
George Baltz N3GB
5f845e92cb Get rid of more cppcheck fluff
Turn off -x option in cppcheck.sh, fix missing '\'.

This fixes all the "error" messages from cppcheck except those
  due to its own inability to handle concatenated format strings.
2025-09-13 21:37:25 -04:00
George Baltz N3GB
7e572fcdd0 Rename spaces() -> hl_stars()
Resolves conflict with function of same name in cqrlog.
Makes future conflicts less likely.
Add it to doxygen.
2025-09-13 21:37:25 -04:00
George Baltz N3GB
f7a127dbdc Doxygen updates. 2025-09-13 21:37:25 -04:00
Daniele Forsi IU5HKX
d507e815a3 Also check the "val" parameter in amp_set_conf() and rot_set_conf()
Avoids a segfault in lower level functions that can more easily
happen when using the bindings.
Simmetric with amp_get_conf() via amp_get_conf2() and rot_get_conf()
via rot_get_conf2().

This is a followup of commit ede84bfce4
that made the same change to conf.c
2025-09-09 20:36:58 +02:00
Nate Bargmann
d74581f6fe
Merge GitHub PR #1891 2025-09-09 06:06:07 -05:00
Daniele Forsi IU5HKX
717d3e1491 Partially revert "[src] Remove unused includes"
This partially reverts commit 83ed5abeb4.
2025-09-07 11:54:30 +02:00
Nate Bargmann
0f871a5a3e
Update Doxygen comments for rigerror() and rigerror2()
Add a new topic of "Hamlib internals" with the group of lib_internal.

Address GitHub issue #1881.
2025-09-06 18:13:12 -05:00
Daniele Forsi IU5HKX
64ec35845c Return "Feature not available" for range_list_number and range_list_name
Test case:
tests/rigctl get_conf range_list_number get_conf range_list_name
error = *1:event.c(269):rig_poll_routine_start entered
*1:event.c(309):rig_poll_routine_start returning(0)
rig.c(294):add_opened_rig entered
rig.c(306):add_opened_rig returning2(0)
rig.c(1669):rig_open returning2(0)
*1:rig.c(6904):rig_get_powerstat entered
*rig.c(6918) trace
**2:dummy.c(1680):dummy_get_powerstat entered
**2:dummy.c(1683):dummy_get_powerstat returning(0)
*1:rig.c(6931):rig_get_powerstat returning(0)
Backend version: 20240709.0, Status: Stable
rigctl_parse: called, interactive=0
rigctl_parse: vfo_opt=0
rig_set_cache_timeout_ms: called selection=0, ms=1000
rig_set_cache_timeout_ms: called selection=0, ms=1000
rigctl_get_conf:
rig_token_lookup called for range_list_number
rig_confparam_lookup called for range_list_number
rig_get_conf2 called
Feature not available

error = **2:dummy.c(1680):dummy_get_powerstat entered
**2:dummy.c(1683):dummy_get_powerstat returning(0)
*1:rig.c(6931):rig_get_powerstat returning(0)
Backend version: 20240709.0, Status: Stable
rigctl_parse: called, interactive=0
rigctl_parse: vfo_opt=0
rig_set_cache_timeout_ms: called selection=0, ms=1000
rig_set_cache_timeout_ms: called selection=0, ms=1000
rigctl_get_conf:
rig_token_lookup called for range_list_number
rig_confparam_lookup called for range_list_number
rig_get_conf2 called
Feature not available
rigctl_parse: called, interactive=0
rigctl_parse: vfo_opt=0
rigctl_get_conf:
rig_token_lookup called for range_list_name
rig_confparam_lookup called for range_list_name
rig_get_conf2 called
Feature not available
2025-09-03 21:11:16 +02:00
Daniele Forsi IU5HKX
b3cde37a06 Add missing code to read some configuration parameters
Adds code keeping the same order of token.h to `get_conf` the
following tokens:
 freq_skip
 offset_vfoa
 offset_vfob
 range_list_name (always returns an empty string)
 range_list_number (always returns 0)
 tuner_control_pathname
2025-09-03 20:32:09 +02:00
Daniele Forsi IU5HKX
7ab3dd718c Fix conflicting names for TOK_RANGE_SELECTED and TOK_RANGE_NAME
Change also the descriptions.

Test case
before:
tests/rigctl dump_conf | grep range
Selected range list: "The tx/rx range list in use"
Selected range list: "The tx/rx range list name"

after:
tests/rigctl dump_conf | grep range
range_list_number: "The tx/rx range list number in use"
range_list_name: "The tx/rx range list name in use"
2025-09-03 20:32:09 +02:00
Nate Bargmann
7180eb7da6
Merge GitHub PR #1879 2025-09-01 13:20:11 -05:00
Nate Bargmann
4c520571df
Merge GitHub PR #1876 2025-08-31 20:11:12 -05:00
Nate Bargmann
9123d08a6c
Merge GitHub PR #1874 2025-08-31 19:21:27 -05:00
Nate Bargmann
43b84ee56a
Merge GitHub PR #1873 2025-08-31 19:07:18 -05:00
Daniele Forsi IU5HKX
80281719f4 Fix twiddle_timeout
Fixes the definition of config parameter "twiddle_timeout" and
the description of rig_set_twiddle().
2025-08-31 10:34:44 +02:00
Daniele Forsi IU5HKX
39e155efe7 Fix include config.h
It should be included, with its path, before any hamlib include
and before any #ifdef that uses the symbols that it defines.
2025-08-30 11:18:51 +02:00
Daniele Forsi IU5HKX
d227444aa6 Fix return values of amp_load_backend() and rot_load_backend()
The value -EINVAL is in the domain of errno.
2025-08-30 10:27:09 +02:00
Daniele Forsi IU5HKX
83ed5abeb4 [src] Remove unused includes
Found by iwyu.
2025-08-30 09:43:45 +02:00
Daniele Forsi IU5HKX
341a5201c6 Replace literal constant with defined symbol 2025-08-29 23:27:23 +02:00
Daniele Forsi IU5HKX
8f343197e0 Replace a printf() with rig_debug()
The bug is that we don't know why the string is invalid.

Test case:
before
tests/rigctl -r "invalid:123:port" -m 2
Unhandled host=invalid:123:port
Unhandled host=invalid:123:port

after:
tests/rigctl -r "invalid:123:port" -m 2
(no output)
tests/rigctl -r "invalid:123:port" -m 2 -v
parse_hoststr: Unhandled host=invalid:123:port
parse_hoststr: Unhandled host=invalid:123:port
2025-08-29 23:26:39 +02:00
George Baltz N3GB
002677e48c Still more pthread conditional code cleanup 2025-08-27 15:24:50 -04:00