Commit graph

2177 commits

Author SHA1 Message Date
George Baltz N3GB
f3e9a859ed Move ???PORT() macro definitions back to rig.h
Many (most?) of the uses of the port structures in Hamlib are to pass through
  to the basic I/O routines (rig_flush(), write_block(), read_string()),
  without referencing any of the structure data.  Don't bother including
  port.h if it won't be used.

The ???PORT macros are independent of actual hamlib_port_t data use.
2025-07-10 09:54:03 -04:00
George Baltz N3GB
0148378ed9 Add needed new includes in src/*.c 2025-07-10 09:54:03 -04:00
Nate Bargmann
64babdb361
Merge GitHub PR #1797 2025-07-09 07:36:00 -05:00
Daniele Forsi IU5HKX
976bfb4276 Remove the executable bit from data files 2025-07-06 19:45:43 +02:00
Daniele Forsi IU5HKX
407d3f669b Revert "Fix debug messages shown even from disabled levels"
This reverts commit ae9556462a.
2025-07-06 14:58:41 +02:00
Daniele Forsi IU5HKX
f68c48aac5 Add dependency to hamlibdatetime.h
Fixes a race during parallel builds:
rig.c:74:10: fatal error: 'hamlibdatetime.h' file not found
Occurred in https://github.com/Hamlib/Hamlib/actions/runs/16087329208/job/45400068817
2025-07-05 13:05:23 +02:00
Nate Bargmann
31c3c97352
Merge GitHub PR #1783 2025-06-25 21:32:26 -05:00
George Baltz N3GB
e163aa2645 Another reversion 2025-06-25 10:53:50 -04:00
George Baltz N3GB
55b0599b75 Stop the blithering 2025-06-25 10:41:55 -04:00
George Baltz N3GB
921a6a9de3 Still more cppcheck cleanups 2025-06-25 10:01:16 -04:00
声纳
b1ad6a7112 Add the rig_backend_list to guohetec 2025-06-25 18:11:30 +08:00
声纳
13335aff69 Add the DEFINE-INITRIGBACK macro to guohetec 2025-06-25 18:00:38 +08:00
George Baltz N3GB
0b75b96ef1 Fix rotctl \dump_caps output
rot_sprintf_status() was printing items multiple times.
Cause of problem noticed by cppcheck.
2025-06-25 05:19:07 -04:00
Nate Bargmann
0ddc6bc8f4
Fix MinGW64/MSYS2 w/GCC 15.1 warning
As reported by Steve, VK3SIR on the mailing list:

On compilation, through a fully up-to-date MinGW64/MSYS2 environment, we receive the following warnings:

....
make[3]: Entering directory '/home/sir/src/hamlib/build/src'
  CC       rig.lo
../../src/src/rig.c: In function 'rig_init':
../../src/src/rig.c:624:45: warning: unknown conversion type character 'z' in format [-Wformat=]
  624 |     rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_struct\n", needed);
      |                                             ^
../../src/src/rig.c:624:32: warning: too many arguments for format [-Wformat-extra-args]
  624 |     rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_struct\n", needed);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/src/rig.c:657:45: warning: unknown conversion type character 'z' in format [-Wformat=]
  657 |     rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_cache\n", needed);
      |                                             ^
../../src/src/rig.c:657:32: warning: too many arguments for format [-Wformat-extra-args]
  657 |     rig_debug(RIG_DEBUG_TRACE, "Requesting %zd bytes for rig_cache\n", needed);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       serial.lo
....

The '%z' modifier is also found in rigs/icom/icom.c but with a 'u'
conversion specifier.  Turns out that since 'needed' in this function is
of type 'size_t' which is an unsigned integer so the 'u' is required.
2025-06-24 07:43:37 -05:00
George Baltz N3GB
07d0d91a44 Yet more cppcheck messages silenced. 2025-06-15 13:52:09 -04:00
George Baltz N3GB
49e65de203 Get rid of spurious messages from \dump_caps
rig_sprintf_func() outputs a RIG_DEBUG_ERR message for each
  function that the rig does not support.
2025-06-14 19:17:23 -04:00
Nate Bargmann
bddd3ace00
Revert 17b404a6c7
These changes were unnecessary as the real bug is that the incorrect
function was being called in meade.c.

Closes GitHub issue #268.

Fix testloc.c
2025-06-14 11:42:45 -05:00
George Baltz N3GB
39a1a367e1 Get rid of a few more style infractions.
Update NEWS.
2025-06-08 03:42:33 -04:00
George Baltz N3GB
5087894d71 Check off a few more cppcheck carps. 2025-06-07 10:46:31 -04:00
Nate Bargmann
7b60cb586d
Merge GitHub PR #1751 2025-06-07 07:56:07 -05: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
Daniele Forsi IU5HKX
721b81d9be Fix sign of return values Doxygen comments
All RIG_E* constants are negated when returned.

Fied with:
perl -pe 's/return RIG_E/return -RIG_E/' -i src/vent.c
perl -pe 's/retval RIG_E/retval -RIG_E/g' -i $(grep -lEr "retval RIG_E" --include=*.{c,h})
2025-06-07 10:54:34 +02:00
Daniele Forsi IU5HKX
ae9556462a Fix debug messages shown even from disabled levels
Messages from ENTERFUNC and RETURNFUNC where stored in an internal buffer
even whe debug_level wasn't TRACE and were returned when calling rigerror().
2025-06-07 09:14:32 +02:00
Daniele Forsi IU5HKX
ea5a5ac312 Fix Doxygen tags 2025-06-07 00:07:00 +02:00
George Baltz N3GB
1532432236 Move more rig_cache infrastructure to cache.[ch]
Macros from rig.h, routines from misc.c
Add some error checks and comments
2025-06-03 12:07:27 -04:00
George Baltz N3GB
3bdfdebacb Simplify elapsed time computation
Do as much of the arithmetic in integers as possible.
Convert both parts to final units(msec) and add.
The casts are actually unneeded, but show when the conversions are done.
And drop an unreachable break.
2025-06-03 12:07:27 -04:00
George Baltz N3GB
f5eb8f19e9 Add utility routine to release all allocated buffers, including rig itself.
One stop shopping for all your rig data cleanup needs.
2025-06-03 12:07:27 -04:00
George Baltz N3GB
1fca93a5a2 Deprecate rig_cache definition in rig.h
Add new rig_cache definition in cache.h
2025-06-03 12:07:27 -04:00
George Baltz N3GB
6f8bf81514 Allocate separate storage for cache buffer
Add address to rig_struct, change CACHE() macro to use it.
Free it when done.
Issue #1420
2025-06-03 12:07:27 -04:00
George Baltz N3GB
7d28822273 Add '#include "cache.h"' to all files that reference cache structure.
Issue #1420
2025-06-03 12:07:27 -04:00
George Baltz N3GB
7fa0c863f2 Don't start async_data_handler until rig is fully opened.
Let the <model>_rig_open() finish its setup before trying to read status.
2025-05-30 12:39:29 -04:00
George Baltz N3GB
b74bd31b40 Quiet a few more cppcheck gripes.
Making these functions static also reduces the possibilities of
 collisions with app names and may shorten load time.
And I can finally make meter_type1 and meter_type2 const, like I
 tried to do in the beginning.
2025-05-29 05:41:39 -04:00
George Baltz N3GB
b5df48d8d9 Add locking around get/set levels 2025-05-24 20:20:10 -04:00
Daniele Forsi IU5HKX
da60d2d383 Replace non-portable make rule with one that is also easier to understand
Fixes:
warning: '%'-style pattern rules are a GNU make extension
2025-05-09 21:08:42 +02:00
Daniele Forsi IU5HKX
de01821c51 Fix typo 2025-05-08 23:51:47 +02:00
Daniele Forsi IU5HKX
1e7b1a628e Fix error return values
All constant error values RIG_E* should be negated when returned.
Found with:
grep -nrE RETURNFUNC.?.RIG_E.+ --include=*.{c,h} | grep -v \-
2025-05-08 23:51:47 +02:00
Daniele Forsi IU5HKX
5c05881e0e Add rules to build dependencies of libhamlib.la in other directories
This makes it possible to run "make -C src/" or "make -C tests/ rigctl"
or "make -C bindings/ check" (and so on) in a clean tree, but it doesn't
rebuild those targets if libhamlib.la is changed; for this run make from
the top directory as usual, to rebuild all SUBDIRS if needed.
2025-05-08 23:51:47 +02:00
Daniele Forsi IU5HKX
0b68dc5885 Also check the "name" parameter
Avoids a segfault if calling strtol(NULL, NULL, 0).
2025-05-08 23:11:21 +02:00
Daniele Forsi IU5HKX
dda30532b5 Add cross references hash mark for Doxygen 2025-04-30 19:36:20 +02:00
Daniele Forsi IU5HKX
c1788e2cf8 Fix names of parameters in Doxygen comments 2025-04-30 19:36:20 +02:00
Daniele Forsi IU5HKX
8feb174711 Fix typos 2025-04-30 19:34:47 +02:00
Daniele Forsi IU5HKX
24eafbd2a4 Fix Doxygen comment
The description of hamlib_version was attached to hamlib_license
and hamlib_license was missing the description.
2025-04-30 19:34:47 +02:00
George Baltz N3GB
a3e23e79cd Minor cleanups/fixes
Return status from rig_send_morse
Remove duplicate include and some dead code
Avoid future NULL dereference in error cases
2025-03-04 21:32:34 -05:00
George Baltz N3GB
5caa22b79a Add locking to rig_stop_morse
and rig_wait_morse
2025-03-04 17:20:41 -05:00
Michael Black W9MDB
7269ba6264 Merge branch 'master' of github.com:Hamlib/Hamlib 2025-03-04 14:42:32 -06:00
Michael Black W9MDB
701d6bf477 Hopefully fix CODAN NGS set_freq/get_freq 2025-03-04 14:41:31 -06:00
George Baltz N3GB
0147da5a3c Replace rs->multicast->mutex with a dedicated mutex for the API.
Use PTHREAD_MUTEX_RECURSIVE and change LOCK() to always call rig_lock().
Still needs a reliable way to determine availability.
2025-02-28 05:29:44 -05:00
George Baltz N3GB
439bd96b5d Fix the easy parts of missing thread locks
- Fix depth initialization so LOCK() at least calls rig_lock()
- Add message showing why rig_lock() does nothing
- Add missing LOCK(0)s
2025-02-27 06:22:30 -05:00
Michael Black W9MDB
98a0184680 Remote -w451 flag -- not available in all versions of gcc 2025-02-18 09:10:26 -06:00
Michael Black W9MDB
a0df573df7 Reduce good news about serial port to verbose 2025-02-04 11:45:56 -06:00