myrig->state doesn't report correct information
PianetaRadio opened this issue · comments
Following your suggestion from #1305, I replace in my code myrig->caps with myrig->state, but the information reported are not correct, the value is always false. Radio Yaesu FT-991. Code CatRadio PianetaRadio/CatRadio@0ae620b
Code examples:
VFO Exchange
my_rig->caps->vfo_ops & RIG_OP_XCHG my_rig->state.vfo_ops & RIG_OP_XCHG
VFO Copy
my_rig->caps->vfo_ops & RIG_OP_CPY my_rig->state.vfo_ops & RIG_OP_CPY
Band Up or Down
my_rig->caps->vfo_ops & RIG_OP_BAND_UP my_rig->state.vfo_ops & RIG_OP_BAND_UP
Tuner
etc...
To be more clear, I report an exctract of code where the variable are used:
if (my_rig->state.vfo_ops & RIG_OP_XCHG)
{
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_XCHG);
}
I have done some test with vfo_op with my Yaesu FT-991, I discover that using the NET connection some vfo_op are not listed.
So there are two issues, one related to state vector and another to rigctld. Previously with v.4.5.5 the rigctld doesn't have this issues.
These are the caps using the serial connection:
Rig command: G
rigctl_parse: input_line: G
VFO: VFOA
rig_parse_vfo called
Mem/VFO Op: ?
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
CPY XCHG FROM_VFO TO_VFO UP DOWN BAND_UP BAND_DOWN TUNE
rigctl_parse.c(3924):rigctl_vfo_op returning2(0)
rigctl_parse: called, interactive=1
And these are using NET connection (rigctl -m 2):
Rig command: G
rigctl_parse: input_line: G
VFO: VFOA
rig_parse_vfo called
Mem/VFO Op: ?
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
CPY XCHG
rigctl_parse.c(3924):rigctl_vfo_op returning2(0)
rigctl_parse: called, interactive=1
Rigctld vfo_ops now is working.
I have to check rig->state
The issue is not closed, command via NET rig doesn't work.
For example, rigctl -m 2, UP is in the list but the command says "feature not available"
Rig command: G
rigctl_parse: input_line: G
VFO: VFOA
rig_parse_vfo called
Mem/VFO Op: ?
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
CPY XCHG FROM_VFO TO_VFO UP DOWN BAND_UP BAND_DOWN TUNE
rigctl_parse.c(3924):rigctl_vfo_op returning2(0)
rigctl_parse: called, interactive=1
Rig command: G
rigctl_parse: input_line: G
VFO: VFOA
rig_parse_vfo called
Mem/VFO Op: UP
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
rig_parse_vfo_op called
***2:rig.c(6939):rig_vfo_op entered
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
rig_vfo_op: vfo_op=0xf737b7d4, has_vfo_op=0
**2:rig_vfo_op: elapsed=0ms
***2:rig.c(6950):rig_vfo_op returning(-11) Feature not available
rigctl_parse.c(3936):rigctl_vfo_op returning2(-11) Feature not available
vfo_op: error = rig_get_cache(323): vfo=MEM, current_vfo=VFOA
rig_get_cache(518): vfo=MEM, freq=0, mode=, width=0
multicast_publisher: sending rig snapshot data: {"app":"Hamlib","version":"4.6~git 2024-02-29T05:04:47Z SHA=c68ef1","seq":104,"time":"2024-02-29T22:02:54.292742-0000","crc":0,"rig":{"id":{"model":"NET rigctl","endpoint":"127.0.0.1:4532","process":"2203","deviceId":""},"status":"OK","errorMsg":"","name":"NET rigctl","split":false,"splitVfo":"None","satMode":false,"modes":["AM","CW","USB","LSB","RTTY","FM","CWR","RTTYR","PKTLSB","PKTUSB","FM-D","FMN","AMN","C4FM"]},"vfos":[{"name":"VFOA","freq":14090500,"mode":"PKTUSB","width":3000,"ptt":false,"rx":true,"tx":true},{"name":"VFOB","freq":14090500,"mode":"","width":0,"ptt":false,"rx":false,"tx":false},{"name":"MEM","freq":0,"mode":"","width":0,"ptt":false,"rx":false,"tx":false}]}
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
rig_parse_vfo_op called
***2:rig.c(6939):rig_vfo_op entered
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
****3:rig.c(6905):rig_has_vfo_op entered
****3:rig.c(6908):rig_has_vfo_op returning(0)
****3:rig.c(6908):rig_has_vfo_op returning(0)
**2:rig_vfo_op: elapsed=0ms
***2:rig.c(6950):rig_vfo_op returning(-11) Feature not available
rigctl_parse.c(3936):rigctl_vfo_op returning2(-11) Feature not available
Feature not available
Also rig->state still not reporting the right vfo_op capabilities with radio serial connection
rigctl -m 1035 ...
Rig command: G
rigctl_parse: input_line: G
VFO: VFOA
rig_parse_vfo called
Mem/VFO Op: ?
rigctl_parse: vfo_opt=1
rigctl_parse.c(3917):rigctl_vfo_op entered
rigctl_parse.c(3924):rigctl_vfo_op returning2(0)
rigctl_parse: called, interactive=1
Tested with GIT Hamlib 4.6~git 2024-03-01T17:27:26Z.
Rigctl works, both NET and serial.
Also my CatRadio works as expected with STATE. Please note that this GUI was compiled with the old state definition, not pointer.