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
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
Daniele Forsi IU5HKX
9904747358
Handle the question mark as second argument of set_level in ampctl
...
Test command:
tests/ampctl -m 1 \
set_level FAULT '?' \
set_level NH '?' \
set_level PF '?' \
set_level PWRFORWARD '?' \
set_level PWRINPUT '?' \
set_level PWRPEAK '?' \
set_level PWRREFLECTED '?' \
set_level SWR '?'
2025-08-12 23:31:11 +02:00
Daniele Forsi IU5HKX
2a2f33673e
Handle the question mark as second argument of set_level in rotctl
...
Test command:
tests/rotctl -m 1 \
set_level MGC '?' \
set_level MGF '?' \
set_level MGL '?' \
set_level SPEED '?'
2025-08-12 20:38:53 +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
Nate Bargmann
f32b744ac9
Update Segfault-award for netrigctl_open() fix
...
Congrats, Daniele!
2025-08-12 11:59:33 -05:00
Nate Bargmann
84fbe1df4a
Merge GitHub PR #1842
2025-08-12 07:50:53 -05: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
Nate Bargmann
c51357388c
Merge GitHub PR #1841
2025-08-12 07:04:50 -05:00
Daniele Forsi IU5HKX
3b79b13f6d
Make the tests for set_conf() and get_conf() more meaningful
2025-08-11 23:41:39 +02:00
Daniele Forsi IU5HKX
e2feb1d1d0
Fix "val_len" paramenter for rot_get_conf2() and amp_get_conf2()
...
Thanks to @GeoBaltz.
2025-08-11 23:40:01 +02:00
Daniele Forsi IU5HKX
19dce9dc32
Remove deprecated functions and methods from the bindings
2025-08-11 15:50:10 +02:00
Nate Bargmann
5e13d102af
Merge merge GitHub PR #1840
2025-08-11 08:31:20 -05:00
Daniele Forsi IU5HKX
6dec579144
Replace library functions deprecated in Hamlib
2025-08-11 15:09:49 +02:00
Daniele Forsi IU5HKX
65439c6719
Fix typo
2025-08-11 15:09:37 +02:00
Daniele Forsi IU5HKX
e16f4077e7
Implement the Python bindings and the tests for rig_send_raw()
...
Allows to send either string or bytes and to receive a response
converted to the same datatype. Also the "term" argument can be
of either type (but it can't contain NULs, it's a single char
or byte anyway).
Closes #1624 .
2025-08-11 12:33:49 +02:00
Daniele Forsi IU5HKX
289a3952ce
Change the dummy implementation of rig_send_raw()
...
Makes it more similar to the regular version handling also
the reply and term arguments.
2025-08-11 12:18:50 +02:00
Daniele Forsi IU5HKX
12ec55c3d7
Add missing set_transaction_inactive()
...
Otherwise no other command will be executed afterwards.
2025-08-10 21:39:15 +02:00
Daniele Forsi IU5HKX
5e336b90c1
Improve Doxygen comments
2025-08-10 21:39:09 +02:00
Nate Bargmann
0d1481d86f
Update W32 and W64 build scripts
...
Renaming the lib\gcc directory to lib\gcc-mingw broke the build of
WSJT-X. See (yes, the archive sucks):
https://sourceforge.net/p/hamlib/mailman/message/59215755/
2025-08-10 10:39:54 -05:00
Nate Bargmann
c1aaeba5ac
Merge GitHub PR #1837
2025-08-09 18:43:57 -05:00
Daniele Forsi IU5HKX
221cc512bc
Fix setting antenna number 3 for Yaesu FTDX3000
...
The argument ant_t ant is a bit mask, not a scalar.
Also use the defines instead of magic numbers.
2025-08-09 22:34:12 +02:00
Daniele Forsi IU5HKX
10303d5803
Fix function signature of spectrum_callback()
2025-08-09 18:09:17 +02:00
Daniele Forsi IU5HKX
81cb260670
Fix ptt_callback()
2025-08-09 17:57:18 +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
2890da9d79
Split the tests
...
It makes it easier in future to conditionally run some tests(eg.
to not test PTT for receiver-only rigs), or to run tests in
isolation (after renaming them).
It makes it easier to look at failing tests because pytest prints
the code of the failing test up to the failure including any
function that called the failed test (in this case would print
everything from def test_with_open() up to the line with the
failed assert.
2025-08-09 15:57:45 +02:00
Daniele Forsi IU5HKX
8e4bcbcede
Add another cross-reference in a Doxygen comment
2025-08-09 15:57:40 +02:00
Daniele Forsi IU5HKX
9e1c7b5ec1
Allocate zereod memory for struct python_callbacks
...
Otherwise Py_XDECREF() would randomly segfault trying to use
uninitialized memory that by chance is not zeroed.
2025-08-09 10:33:54 +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
2462ab0a13
Improve Doxygen comments
...
Adds missing cross-references. Fix tagging of comment blocks in "aor"
even if the rigs aren't included in the generated documentation.
2025-08-08 10:38:55 +02:00
Nate Bargmann
93a24356e5
Merge GitHub PR #1831
2025-08-07 07:26:47 -05:00
Daniele Forsi IU5HKX
891070941f
Fix compiler warnings
...
Fixes:
simic905.c:108:9: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
simic910.c:112:9: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
2025-08-07 14:14:58 +02:00
Daniele Forsi IU5HKX
5b1517778e
Replace "goto again" with "continue" (third case)
...
When the software on the other side of the pty closes the device,
the simulator would close and reopen its side but it is unneeded
because it can continue to call read() without doing anything special.
2025-08-07 11:38:12 +02:00
Daniele Forsi IU5HKX
8887294cd8
Replace "goto again" with "continue" (second case)
...
Does the same thing with more structured control flow.
It also silences compiler warnings.
2025-08-07 11:22:44 +02:00
Daniele Forsi IU5HKX
5b87b38704
Replace "goto again" with "continue" (first case)
...
Does the same thing with more structured control flow.
It also silences compiler warnings.
2025-08-07 11:22:14 +02:00
Daniele Forsi IU5HKX
4251c50b7f
Fix reading line when the client (eg. rigctl) closes
...
Fixes an infinite stream of debug output because it erroneously
appeared to have read 1 byte instead of 0:
n=1
00
Not 8 bytes? bytes=1
Unknown cmd=00
Tested with:
tests/rigctl -m 37001 -r /dev/pts/6 f
(however it doesn't read the frequency because it looks like the
protocol is different or incomplete, rigs/anytone/d578.c is still
in beta)
2025-08-07 08:54:09 +02:00
Daniele Forsi IU5HKX
49c78edb80
Make code more uniform
2025-08-06 21:49:17 +02:00
George Baltz N3GB
70d50d0efb
Fix one byte buffer overrun
...
All the pictures in manuals show message as 4 bytes, but they don't
include the major command (0x26).
Found by `gcc -fanalyzer`
2025-08-06 05:13:25 -04:00
George Baltz N3GB
1e5adb9fde
Fix errors in error cases
...
Leak FDs in error exits, seg faults if RIG missing.
Found by `gcc -fanalyzer`
2025-08-06 04:56:02 -04:00
Daniele Forsi IU5HKX
59acdb791e
Fix compiler warning
...
Move both initialization outside of the conditional.
Fixes:
simyaesu.c:364:12: warning: ‘pbuf’ may be used uninitialized [-Wmaybe-uninitialized]
2025-08-06 09:34:04 +02:00
Daniele Forsi IU5HKX
032e78826e
Fix BC and FO commands
...
The following command work from rigctl: get_freq get_ctcss_tone get_rig_info.
Uses the information from the manual linked at the top of rig/kenwood/tmd710.c.
Fixes:
simtmd710.c:64:44: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘double’ [-Wformat=]
simtmd710.c:68:44: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘double’ [-Wformat=]
2025-08-05 23:46:10 +02:00
Daniele Forsi IU5HKX
d5c5eeff15
No need to use strlen() because the i variable counted the chars read
2025-08-05 22:40:17 +02:00
Daniele Forsi IU5HKX
af4c6ec806
Make the output of simft990 more friendly
2025-08-05 22:40:17 +02:00
Daniele Forsi IU5HKX
9dd0009f9e
Remove unused define
2025-08-05 22:22:50 +02:00