From 545081c8d4735ce9058e6e3a749232de1d7e6d3a Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Fri, 15 May 2020 14:17:59 -0500 Subject: [PATCH] Fix rigctl/rigctld "V VFOA" protocol error 4.0 rigctld now works with 3.3 rigctl client and 4.0 rigctl client https://github.com/Hamlib/Hamlib/issues/246 --- dummy/netrigctl.c | 2 +- src/rig.c | 10 ++++++++-- tests/rigctl_parse.c | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dummy/netrigctl.c b/dummy/netrigctl.c index 12fc092cf..1b454eecd 100644 --- a/dummy/netrigctl.c +++ b/dummy/netrigctl.c @@ -724,7 +724,7 @@ static int netrigctl_set_vfo(RIG *rig, vfo_t vfo) if (ret != RIG_OK) { return ret; } len = sprintf(cmd, "V%s %s\n", vfostr, rig_strvfo(vfo)); - + rig_debug(RIG_DEBUG_VERBOSE, "%s: cmd='%s'\n", __func__, cmd); ret = netrigctl_transaction(rig, cmd, len, buf); if (ret > 0) diff --git a/src/rig.c b/src/rig.c index 08ce77666..c9fdf8edf 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1274,7 +1274,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (retcode != RIG_OK) { - rig_debug(RIG_DEBUG_ERR,"%s: set_vfo err %s\n", __func__, rigerror(retcode)); + rig_debug(RIG_DEBUG_ERR, "%s: set_vfo err %s\n", __func__, rigerror(retcode)); return retcode; } @@ -1830,7 +1830,13 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) // we need to update our internal freq to avoid getting detected as twiddling // we only get the freq if we set the vfo OK - if (retcode == RIG_OK && caps->get_freq) { retcode = rig_get_freq(rig, vfo, &curr_freq); } + if (retcode == RIG_OK && caps->get_freq) + { + retcode = rig_get_freq(rig, vfo, &curr_freq); + rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %s\n", __func__, + rigerror(retcode)); + } + // expire several cached items when we switch VFOs elapsed_ms(&rig->state.cache.time_vfo, ELAPSED_INVALIDATE); diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index de4f4f965..839dd62fe 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -281,7 +281,9 @@ static struct test_table test_list[] = { 0x91, "get_ctcss_sql", ACTION(get_ctcss_sql), ARG_OUT, "CTCSS Sql" }, { 0x92, "set_dcs_sql", ACTION(set_dcs_sql), ARG_IN, "DCS Sql" }, { 0x93, "get_dcs_sql", ACTION(get_dcs_sql), ARG_OUT, "DCS Sql" }, - { 'V', "set_vfo", ACTION(set_vfo), ARG_IN | ARG_NOVFO | ARG_OUT, "VFO" }, + // + //{ 'V', "set_vfo", ACTION(set_vfo), ARG_IN | ARG_NOVFO | ARG_OUT, "VFO" }, + { 'V', "set_vfo", ACTION(set_vfo), ARG_IN | ARG_NOVFO, "VFO" }, { 'v', "get_vfo", ACTION(get_vfo), ARG_OUT, "VFO" }, { 'T', "set_ptt", ACTION(set_ptt), ARG_IN, "PTT" }, { 't', "get_ptt", ACTION(get_ptt), ARG_OUT, "PTT" }, @@ -2113,6 +2115,7 @@ declare_proto_rig(set_vfo) vfo = rig_parse_vfo(arg1); retval = rig_set_vfo(rig, vfo); +#if 0 // see if we can make this dynamic if (retval == RIG_OK) { if ((interactive && prompt) || (interactive && !prompt && ext_resp)) @@ -2122,6 +2125,7 @@ declare_proto_rig(set_vfo) fprintf(fout, "%s%c", rig_strvfo(vfo), resp_sep); } +#endif return retval; }