Wykres commitów

427 Commity (master)

Autor SHA1 Wiadomość Data
Daniele Forsi IU5HKX 31fc48c145 [dummy] Add code to get_conf static_data 2025-09-03 20:32:09 +02:00
Nate Bargmann 4c520571df
Merge GitHub PR #1876 2025-08-31 20:11:12 -05: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
George Baltz N3GB df65ceee67 Start removing conditional pthreads use.
We can treat HAVE_PTHREAD and HAVE_PTHREAD_H as equivalent. But using
_PTHREAD_H is a real kludge.
2025-08-24 19:53:44 -04:00
Daniele Forsi IU5HKX 7746d59438 Implement get_agc for flrig 2.0.06+
Test case:
run: flrig configured for the rig in use
run: tests/rigctl -m 4 get_level AGC
expected: should print an enum agc_level_e (an integer in range 0..10)

Part of issue #1376.
2025-08-19 09:08:28 +02:00
Daniele Forsi IU5HKX caf7346fc0 Fix typos 2025-08-16 11:52:55 +02:00
Nate Bargmann ee03370cdf
Merge GitHub PR #1846 2025-08-14 08:11:27 -05:00
Daniele Forsi IU5HKX ff5500b2d9 Avoid segfaulting when val.cs is NULL
This is the case for BANDSELECT and KEYERTYPE.
Use SNPRINTF() which deals with NULLs printing (null) and it is
used with the other datatypes..

Steps to reproduce:
tests/rigctl -m 1 set_parm KEYERTYPE '?'
tests/rigctl -m 1 set_parm BANDSELECT 1

Fixes:
 Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault.
 __strcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:302
 warning: 302    ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: File o directory non esistente
 (gdb) bt
 #0  __strcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:302
 #1  0x00007f8ab4d0b7ab in dummy_set_parm (rig=0x55d19b6cab20, parm=2048, val=...) at dummy.c:1704
 #2  0x000055d175b8c03d in rigctl_set_parm (rig=0x55d19b6cab20, fout=0x7f8ab4bf25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0,
     resp_sep=10 '\n', cmd=0x55d175ba9000 <test_list+1440>, vfo=536870912, arg1=0x7ffd730281e0 "KEYERTYPE", arg2=0x7ffd730283e0 "'?'", arg3=0x55d175b9fce8 "") at rigctl_parse.c:3828
 #3  0x000055d175b93756 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffd7302a3a8, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>,
     vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847
 #4  0x000055d175b7dadc in main (argc=<optimized out>, argv=0x7ffd7302a3a8) at rigctl.c:801
2025-08-13 16:58:26 +02:00
George Baltz N3GB 74558224a9 More cppcheck style hints 2025-08-13 09:30:59 -04:00
Daniele Forsi IU5HKX 9e6ff6edcc Fix segfault when executing the dump_caps command
Need to convert the level number 0..63 to the level bit mask.
Steps to reproduce
tests/rigctld -m 1 &
tests/rigctl -m 2 dump_caps

Fixes:
 Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault.
 [..]
 (gdb) bt
 #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:174
 #1  0x00007f532c46e300 in __printf_buffer (buf=buf@entry=0x7ffc320ad970, format=0x7f532c8aba22 "%s(%s) ", ap=0x7ffc320ada30, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435
 #2  0x00007f532c491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc320ada30, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96
 #3  0x00007f532c469642 in __GI___snprintf (
     s=s@entry=0x7ffc320aec94 "BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0.000000/0.000000) PBT_IN(0.000000..0.000000/0.000000) PBT_OUT(0.000000..0.000000/0.000000) CWPITCH(0..0/10) RFPOWER(0.050000..1.000000/0.001957) MICG"...,
     maxlen=maxlen@entry=3948, format=format@entry=0x7f532c8aba22 "%s(%s) ") at ./stdio-common/snprintf.c:31
 #4  0x00007f532c6dc14a in rig_sprintf_parm_gran (
     str=str@entry=0x7ffc320aec00 "ANN(0..0/0) APO(0..0/0) BACKLIGHT(0..0/0) BEEP(0..1316880384/1315832322) TIME(0..0/0) BAT(0..0/0) KEYLIGHT(0..0/0) SCREENSAVER(0..4/0) AFIF(0..0/0) BANDSELECT(00000..0.000000/0.000000) NR(0.000000..0."...,
     nlen=nlen@entry=4096, parm=9223372036854775807, gran=gran@entry=0x55f1f3cac338) at sprintflst.c:646
 #5  0x000055f1eb6cd487 in dumpstate (rig=rig@entry=0x55f1f3ca5b20, fout=fout@entry=0x7f532c5f25c0 <_IO_2_1_stdout_>) at dumpstate.c:408
 #6  0x000055f1eb6b4b81 in rigctl_dump_caps (rig=0x55f1f3ca5b20, fout=0x7f532c5f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=<optimized out>, prompt=<optimized out>, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0,
     resp_sep=10 '\n', cmd=0x55f1eb6dc0e0 <test_list+5760>, vfo=536870912, arg1=0x0, arg2=0x55f1eb6d1ce8 "", arg3=0x55f1eb6d1ce8 "") at rigctl_parse.c:4622
 #7  0x000055f1eb6c65f6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc320b2138, argc=argc@entry=3, sync_cb=sync_cb@entry=0x0, interactive=<optimized out>, prompt=<optimized out>,
     vfo_opt=<optimized out>, send_cmd_term=<optimized out>, ext_resp_ptr=<optimized out>, resp_sep_ptr=<optimized out>, use_password=<optimized out>) at rigctl_parse.c:1847
 #8  0x000055f1eb6b0adc in main (argc=<optimized out>, argv=0x7ffc320b2138) at rigctl.c:801
2025-08-12 14:07:23 +02:00
Daniele Forsi IU5HKX e2214fd2f1 Change .ptt_type to RIG_PTT_RIG for RIG_MODEL_DUMMY
With the old value of RIG_PTT_NONE, dummy_get_ptt() and dummy_set_ptt()
were never called because rig_get_ptt() and rig_set_ptt() do check
.ptt_type and return -RIG_ENAVAIL in that case.

Do not change .ptt_type for RIG_MODEL_DUMMY_NOVFO so that both cases
can be tested if needed.
2025-08-09 15:57:45 +02:00
Daniele Forsi IU5HKX 3bc1cc8744 Implement remaining event callbacks
Implements:
rig_set_dcd_callback(), rig_set_freq_callback(), rig_set_mode_callback(),
rig_pltune_callback(), rig_set_ptt_callback(), rig_set_spectrum_callback(),
rig_set_vfo_callback()
2025-08-09 10:33:51 +02:00
Daniele Forsi IU5HKX 8324c85487 Implement the Python callback for freq_event
Fixes #481.
2025-08-09 10:33:17 +02:00
Daniele Forsi IU5HKX 8d8d0328bf Fix typos 2025-08-03 10:49:23 +02:00
Nate Bargmann a9ecd50329
Sanitize radio model names and manufacturers
Reference GitHub issue #1013.
2025-08-01 07:55:41 -05:00
Daniele Forsi IU5HKX bc25855f48 Check split argument in dummy_get_split_mode() and fix the test 2025-07-26 19:59:36 +02:00
Daniele Forsi IU5HKX df6ddedf63 Use a define instead of a magic number 2025-07-25 23:52:02 +02:00
Daniele Forsi IU5HKX f0efc558f6 Make Dummy Rig handle also RIG_ANT_5 2025-07-25 23:47:35 +02:00
Nate Bargmann 79f8b1cde8
Merge HitHub PR #1811 2025-07-22 22:11:06 -05:00
Daniele Forsi IU5HKX 0267068220 Fix ambiguity between system includes and Hamlib includes 2025-07-22 23:33:57 +02:00
Daniele Forsi IU5HKX b57ad227a0 Remove unused #include <math.h>
Found with iwyu.
2025-07-22 23:33:56 +02:00
Daniele Forsi IU5HKX 974e619dd2 Replace #include serial.h with iofunc.h
According to iwyu, to avoid unecessary rebuilds and to reduce the
chances of breakages of the build if includes are rearranged, the
code that uses serial_open() and ser_close() should include
serial.h while the code that uses read_block() write_block() and
similar should include iofunc.h, code that uses all of them should
include both files.

Found with iwyu.
2025-07-22 23:33:56 +02:00
Daniele Forsi IU5HKX 195ed01543 Remove unused #include "serial.h"
Found with iwyu.
2025-07-22 23:33:56 +02:00
George Baltz N3GB 47dae3879d Fix compiler errors with strict C23 standards
Fix missing/misplaced '#include "config.h"' statements. Fixes missing
  function prototypes, unknown type definitions, etc. Allows configuration
  of GCC with CFLAGS="-std=c23" instead of using default -std=gnu23.

Don't know about CLANG, MSVC, MinGW, etc, but using
gwb@stitch:~> gcc --version
gcc (SUSE Linux) 15.1.1 20250714
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hamlib can compile in strict C23 mode, or previous standard levels.
2025-07-22 11:07:33 -04:00
George Baltz N3GB 8469ee1737 Fix incorrect fallthroughs
Found with -Wimplicit-fallthrough, but also many false positives
2025-07-21 23:07:56 -04:00
Mark J. Fine 528d87c496 Apparently uint64_t is handled differently on CISC and RISC systems. CISC requires the %lu format while RISC requires %llu. Solved the cross-platform ping-pong game by using %llu and type casting rmode_t and setting_t values as (long long unsigned int). 2025-07-20 20:08:25 -04:00
Mark J. Fine d32e5b3495 Addressed some formatting issues and made VFO_A/VFO_CURR checking more uniform across the code. 2025-07-19 12:28:07 -04:00
Mark J. Fine 50cb5b595e Changed %llu to just %lu to quiet a warning. 2025-07-19 10:30:09 -04:00
Mark J. Fine f934b75688 Fixed c99 booleans.
Fixed format in debug statements for mode and level.
2025-07-19 10:24:09 -04:00
Mark J. Fine 3722c643cc CW modes were reversed... fixed.
SSB narrow filter was in error.. fixed.
2025-07-19 10:09:30 -04:00
Mark J. Fine 26daf352b3 Corrects meter level query. 2025-07-19 09:45:43 -04:00
Mark J. Fine 096b6f0f4b Adds 'dummy' rig that talks to GQRX 2025-07-19 06:32:05 -04: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
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 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
Daniele Forsi IU5HKX 3034631b2f Fix typo 2025-05-26 08:31:39 +02:00
Daniele Forsi IU5HKX 4109d606b5 Fix typos 2025-05-22 21:55:10 +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
Nate Bargmann c8838cd3a6
Avoid truncating AC Log frequencies above 1 GHz
Per GitHub issue #1704, frequencies higher than 1 GHz passed from AC Log
have an embedded comma.  Even though sscanf() offers the "'" (single
quote) character as a means of ignoring thousands separator, apparently
it depends on the environment variable LC_NUMERIC being set correctly
and that may not be supported on all platforms.

This patch just parses through the string while skipping any comma that
may appear and then uses strtold() to convert to a numeric variable.  It
is supected that AC Log always uses a comma as a thousands separator.
2025-05-01 19:49:44 -05:00
Nate Bargmann 923a789c29
Fix sscanf() truncating input from thousands separator
Per Github issue #1704, N3FJP logger sends a string with an embedded
comma for frequencies above 1 GHz resulting in such frequencies being
truncated.  This patch uses the optional apostrophe character in the
sscanf() format string to ignore the thousands separator.

A possible bug is when the locale of the system on which libhamlib is
executing uses a dot for the thousands separator rather than a comma.
It is unclear if the N3FJP software obeys such locales or not.  If this
turns out to be an issue then this fix will need to be reconsidered.
2025-04-21 21:27:55 -05:00
Arkadiusz Miśkiewicz 428e3075eb Additional PKTUSB and PKTLSB mapping for USB-D1/LSB-D1
Some radios (icom 7760 for example) expose USB/LSB-Dn modes (e.g., USB-D1).
By default, USB-D1 acts as PKTUSB and LSB-D1 as PKTLSB. Adding this mapping
improves compatibility with software expecting standard PKTUSB/PKTLSB modes.

A real-life scenario: this makes WSJT-X usage much nicer, as WSJT-X requests
PKTUSB, which is then mapped to USB-D1 — the default mode for FT4/FT8 operations
on Icom radios.
2025-04-14 23:59:20 +02:00
Michael Black W9MDB 88fce980df Fix rigctld hamib_version print to suppress it
Add simeasycomm.c
2025-02-11 10:48:48 -06:00
Michael Black W9MDB d2065fe781 Add DIGI-U and DIGI-L to possible modes from FLRig
https://github.com/Hamlib/Hamlib/issues/1653
2025-01-07 07:54:00 -06:00
George Baltz N3GB 8589d5c6bc Fix unbalanced ENTERFUNC/RETURNFUNC pairs in icom.c
Also tweak comments/formats to eliminate false positives in code base
   (except for the Catch-22 ones in tests/func_chk.c itself)
2024-12-22 16:48:56 -05:00
Michael Black W9MDB 13f7b01d27 Fix sscanf compare in trxmanager.c 2024-12-22 10:36:05 -06:00
Michael Black W9MDB 62b0a25a3d Fix sscanf compare in flrig.c 2024-12-22 10:35:06 -06:00
Michael Black W9MDB ec71035822 Fix sscanf check in aclog.c
https://github.com/Hamlib/Hamlib/security/code-scanning/3206
2024-12-21 14:47:43 -06:00
Michael Black W9MDB 58924b7bec Add DATA_FMN mode to flrig 2024-12-04 15:43:47 -06:00
Michael Black W9MDB 671a3b8562 Fix rig_get_DBM in flrig 2024-12-04 14:47:48 -06:00