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.
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
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.
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.
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.
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.
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.
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.
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.