Commit graph

437 commits

Author SHA1 Message Date
Daniele Forsi IU5HKX
901682ba30 [rigctl] Use "fout" for consistency
This makes no difference in the current code, but other usages
of dumpconf_list() are different:
$ grep dumpconf_list *parse.c
rigctl_parse.c:        dumpconf_list(rig, stdout);
rigctl_parse.c:        dumpconf_list(rig, fout);
rotctl_parse.c:        dumpconf_list(rot, fout);
rotctl_parse.c:        dumpconf_list(rot, fout);
rotctl_parse.c:    dumpconf_list(rot, fout);
2025-09-03 20:32:09 +02: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
Daniele Forsi IU5HKX
0317e64dc8 Remove double call to rig_token_lookup() and rot_token_lookup()
The needed value is already in the variable.

Test case /to check that the changes don't break the code):
tests/rigctl --set-conf=rig_pathname=test,write_delay=1,timeout=2 --show-conf Q | grep --no-group-separator -A1 -E "(rig_pathname|^write_delay|^timeout):"
tests/rotctl --set-conf=rot_pathname=test,write_delay=1,timeout=2 --show-conf Q | grep --no-group-separator -A1 -E "(rot_pathname|^write_delay|^timeout):"

The output before and after this patch is:
rig_pathname: "Path name to the device file of the rig"
        Default: /dev/rig, Value: test
write_delay: "Delay in ms between each byte sent out"
        Default: 0, Value: 1
timeout: "Timeout in ms"
        Default: 0, Value: 2
Command 'Q' not found!
rot_pathname: "Path name to the device file of the rotator"
        Default: /dev/rotator, Value: test
write_delay: "Delay in ms between each byte sent out"
        Default: 0, Value: 1
timeout: "Timeout in ms"
        Default: 0, Value: 2
2025-08-20 23:07:48 +02:00
Nate Bargmann
db7219b731
Merge GitHub PR #1858 2025-08-19 20:05:20 -05:00
Daniele Forsi IU5HKX
67038154db Refactor to remove code duplication in rigctl*.c 2025-08-19 16:51:31 +02:00
Daniele Forsi IU5HKX
fd7d69d24c Fix output of dump_state
Fixes references to levels and properly handles strings.

Steps to reproduce:
tests/rigctl chk_vfo dump_state
2025-08-17 18:49:52 +02:00
Daniele Forsi IU5HKX
2f2b703ccf Handle the question mark as second argument of set_parm KEYERTYPE in rigctl
Test case:
tests/rigctl -m 1 \
set_parm KEYERTYPE '?' \
set_parm BANDSELECT '?'
STRAIGHT BUG PADDLE
BANDUNUSED BAND70CM BAND33CM BAND23CM
2025-08-13 22:04:15 +02:00
Daniele Forsi IU5HKX
b5b9e136a1 Do not use strcmp() when we are going to get a RIG_PARM_* define anyway 2025-08-13 20:24:22 +02:00
Daniele Forsi IU5HKX
fb4d2c6455 Fix segfault when using the dummy driver
Steps to reproduce:
tests/rigctl -m 1 \
get_parm KEYERTYPE

Fixes:
 Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault.
 0x0000556aff4f890d in rigctl_get_parm (rig=<optimized out>, fout=0x7f87517f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=1, prompt=1, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n',
     cmd=0x556aff516050 <test_list+1520>, vfo=536870912, arg1=0x7ffc5985b5c0 "KEYERTYPE", arg2=0x556aff50cce8 "", arg3=0x556aff50cce8 "") at rigctl_parse.c:3947
 3947            if (strcmp(val.s, "0") == 0) {s = "STRAIGHT";}
 (gdb) bt
 #0  0x0000556aff4f890d in rigctl_get_parm (rig=<optimized out>, fout=0x7f87517f25c0 <_IO_2_1_stdout_>, fin=<optimized out>, interactive=1, prompt=1, vfo_opt=<optimized out>, send_cmd_term=13 '\r', ext_resp=0, resp_sep=10 '\n',
     cmd=0x556aff516050 <test_list+1520>, vfo=536870912, arg1=0x7ffc5985b5c0 "KEYERTYPE", arg2=0x556aff50cce8 "", arg3=0x556aff50cce8 "") at rigctl_parse.c:3947
 #1  0x0000556aff5007f6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc5985d788, 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
 #2  0x0000556aff4eaadc in main (argc=<optimized out>, argv=0x7ffc5985d788) at rigctl.c:801
2025-08-13 20:23:57 +02:00
Daniele Forsi IU5HKX
3013912111 Make get_param read back the value passed to set_param
Test case:
tests/rigctl -m 1 \
set_parm KEYERTYPE BUG get_parm KEYERTYPE \
set_parm KEYERTYPE PADDLE get_parm KEYERTYPE \
set_parm KEYERTYPE STRAIGHT get_parm KEYERTYPE
BUG
PADDLE
STRAIGHT
2025-08-13 20:17:56 +02:00
Daniele Forsi IU5HKX
12ba558343 Fix segfault with set_parm KEYERTYPE
Steps to reproduce:
tests/rigctl -m 1 \
set_parm KEYERTYPE BUG

Fixes:
 Thread 1 "rigctl" received signal SIGSEGV, Segmentation fault.
 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142
 warning: 142    ../sysdeps/x86_64/multiarch/strlen-sse2.S: File o directory non esistente
 (gdb) bt
 #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142
 #1  0x00007ffac346e300 in __printf_buffer (buf=buf@entry=0x7ffc3bcf40d0, format=0x7ffac38aef17 "%s", ap=0x7ffc3bcf4190, mode_flags=0) at ./stdio-common/vfprintf-process-arg.c:435
 #2  0x00007ffac3491daf in __vsnprintf_internal (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=args@entry=0x7ffc3bcf4190, mode_flags=mode_flags@entry=0) at ./libio/vsnprintf.c:96
 #3  0x00007ffac3469642 in __GI___snprintf (s=s@entry=0x7ffc3bcf4290 "", maxlen=maxlen@entry=32, format=format@entry=0x7ffac38aef17 "%s") at ./stdio-common/snprintf.c:31
 #4  0x00007ffac370b7b9 in dummy_set_parm (rig=0x558fe1991b20, parm=2048, val=...) at dummy.c:1704
 #5  0x0000558fb536afbe in rigctl_set_parm (rig=0x558fe1991b20, fout=0x7ffac35f25c0 <_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=0x558fb5388000 <test_list+1440>, vfo=536870912, arg1=0x7ffc3bcf4e10 "KEYERTYPE", arg2=0x558fb537fdb1 "1", arg3=0x558fb537ece8 "") at rigctl_parse.c:3829
 #6  0x0000558fb53727d6 in rigctl_parse (my_rig=<optimized out>, fin=<optimized out>, fout=<optimized out>, argv=argv@entry=0x7ffc3bcf6fd8, 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
 #7  0x0000558fb535cadc in main (argc=<optimized out>, argv=0x7ffc3bcf6fd8) at rigctl.c:801
2025-08-13 17:07:55 +02:00
Daniele Forsi IU5HKX
a81aab6e11 Return an error if the keyer type is unknown
Instead of quietly doing nothing.
2025-08-13 16:58:46 +02:00
Daniele Forsi IU5HKX
762caa85c0 Remove stray char after printing value of KEYERTYPE
Steps to reproduce:
tests/rigctl -m 1 get_parm KEYERTYPE
STRAIGHT
v <-- this 'v' shouldn't be there
2025-08-13 16:58:46 +02:00
Daniele Forsi IU5HKX
4187e9f4a3 Handle the question mark as second argument of set_level in rigctl
Closes #720.

Test command:

tests/rigctl -m 1 \
set_level AF '?' set_level AGC '?' set_level AGC_TIME '?' \
set_level ANTIVOX '?' set_level APF '?' set_level ATT '?' \
set_level BAL '?' set_level BAND_SELECT '?' set_level BKINDL '?' \
set_level BKIN_DLYMS '?' set_level COMP '?' set_level CWPITCH '?' \
set_level IF '?' set_level KEYSPD '?' set_level METER '?' \
set_level MGC '?' set_level MGF '?' set_level MGL '?' \
set_level MICGAIN '?' set_level MONITOR_GAIN '?' set_level NB '?' \
set_level NOTCHF '?' set_level NOTCHF_RAW '?' set_level NR '?' \
set_level PBT_IN '?' set_level PBT_OUT '?' set_level PREAMP '?' \
set_level RF '?' set_level RFPOWER '?' set_level SLOPE_HIGH '?' \
set_level SLOPE_LOW '?' set_level SPECTRUM_ATT '?' set_level SPECTRUM_AVG '?' \
set_level SPECTRUM_EDGE_HIGH '?' set_level SPECTRUM_EDGE_LOW '?' set_level SPECTRUM_MODE '?' \
set_level SPECTRUM_REF '?' set_level SPECTRUM_SPAN '?' set_level SPECTRUM_SPEED '?' \
set_level SQL '?' set_level USB_AF '?' set_level USB_AF_INPUT '?' \
set_level VOXDELAY '?' set_level VOXGAIN '?'
2025-08-12 20:38:11 +02:00
George Baltz N3GB
20eeb96787 Deprecate rig_get_conf()
Define macro to set attribute, if compiler is capable
Add macro to rig_get_conf(), Rig::getConf() declarations
Fix internal uses of rig_get_conf()
2025-07-27 11:31:18 -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
0740af61a3 Fix memory leak in rigctl_parse.c
strip_quotes() orphaned 1 or 2 strings per call.
2025-06-21 04:39:11 -04:00
George Baltz N3GB
07d0d91a44 Yet more cppcheck messages silenced. 2025-06-15 13:52:09 -04:00
Daniele Forsi IU5HKX
4109d606b5 Fix typos 2025-05-22 21:55:10 +02:00
Michael Black W9MDB
f2a9f091d0 Change rig_list_foreach back to using const argument -- was breaking many C++ application builds
https://github.com/Hamlib/Hamlib/issues/1647
2024-12-29 08:42:24 -06:00
Michael Black W9MDB
8edf99fc18 Change skipinit so skip-init for consistency
And now ignores the skip-init on the non-interactive rigctl
2024-12-25 16:36:37 -06:00
Michael Black W9MDB
750adb40b5 Fix cleartext warning in rigctl_parse.c 2024-12-22 11:30:04 -06:00
Michael Black W9MDB
b763761d9e Fix cleartext warning in rigctl_parse.c and rotctl_parse.c 2024-12-22 11:26:18 -06:00
Michael Black W9MDB
d302b8fabd Fix sscanf in rigctl_parse.c 2024-12-22 11:14:14 -06:00
Michael Black W9MDB
fe45fa2dfc Fix sscanf compare in rigctl_parse.c 2024-12-22 10:38:07 -06:00
Michael Black W9MDB
2b23051c6d Remove display of password from debug
https://github.com/Hamlib/Hamlib/security/code-scanning/15
2024-12-21 15:19:25 -06:00
Michael Black W9MDB
4a34d4c27f Add new semi-colon separated hex values for send_raw icom
https://github.com/Hamlib/Hamlib/issues/1632
2024-12-01 11:24:43 -06:00
Daniele Forsi IU5HKX
6036a65d2e Fix typos in comments 2024-11-24 19:24:35 +01:00
Mike Black W9MDB
5c269964c2 astyle files in preparation for release 4.6 2024-11-06 08:07:34 -06:00
Mike Black W9MDB
87531d273d Fix KEYERTYPE 2024-10-21 22:31:42 -05:00
Mike Black W9MDB
882d22a50c Add help to N command in rigctl 2024-10-07 12:19:03 -05:00
George Baltz N3GB
b667e31dcf Fix wrong utc_offset
Only compare magnitude when checking for only hours given.  Offsets west of
  UTC could be off by a factor of 100.
2024-09-10 21:30:24 -04:00
Mike Black W9MDB
e35b87b11a Fix MacOS warning in rigctl_parse.c 2024-09-08 11:52:06 -05:00
Mike Black W9MDB
940814617b Update set_clock options again 2024-08-30 16:36:10 -05:00
Mike Black W9MDB
954fd00161 Fix set_clock information 2024-08-30 10:17:55 -05:00
Mike Black W9MDB
abd6d4f388 Avoid possible segfault 2024-07-19 22:39:12 -05:00
Mike Black W9MDB
8b9c768063 Update info in riglist.h
Make check for mfg_name or model_name of Misc, Other, or Dummy for GM3ZZA's application
Just to avoid ever using these accidentally
2024-07-14 22:57:40 -05:00
George Baltz N3GB
06301679d3 Balance ENTERFUNC/RETURNFUNC usage
Still some unbalanced RETURNFUNC2 usage, but doesn't affect any rig data.
2024-06-26 10:16:12 -04:00
George Baltz N3GB
2794d2dfe1 More state pointer changes
Done with search/replace
Less than 2300 left to do
2024-06-01 16:59:17 -04:00
Mike Black W9MDB
c73c728b5e Allow rigctl w command to quote arg1 for use by SmartSDR
e.g. w "C0|set slice 0 tx=1"
2024-05-22 11:44:54 -05:00
Mike Black W9MDB
878243aff3 Fix FLRig 'w' and 'W' command reply display 2024-04-04 07:53:06 -05:00
Mike Black W9MDB
9a7dda25c8 w command now recognizes ; and 0xfd as valid endings for faster response instead of timeout
Stacking commands with w and W works e.g. FA;FB;
Still need to allow for hex values with simple form "xfe xfe...." instead of "\0xfe \0xfe..." -- more in-line with FLRig format
https://github.com/Hamlib/Hamlib/issues/1536
2024-04-02 16:26:27 -05:00
Mike Black W9MDB
41de3425d2 Fix hamlib_version in netrigctl_open and blank agc_levels from FLRig 2024-03-31 12:22:02 -05:00
Mike Black W9MDB
59fca440a5 Fix rigctld CPU usage when client impolitely disconnects 2024-03-30 17:21:29 -05:00
Mike Black W9MDB
8ebffd20b6 Fix get_vfo_info compatibility with Log4OM
https://github.com/Hamlib/Hamlib/issues/1531
2024-03-25 17:50:39 -05:00
Mike Black W9MDB
6d257841a6 Fix some memory leaks in rigctl_parse.c 2024-03-15 16:46:14 -05:00
Mike Black W9MDB
b9e59f205e Fix compile error
https://github.com/Hamlib/Hamlib/issues/1524
2024-03-14 22:43:10 -05:00
George Baltz N3GB
728db84c0c Finish tests/* 2024-03-01 12:27:26 -05:00