From 2611cad188470e767fb4c071190736d50629dfdd Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 07:36:31 -0500 Subject: [PATCH 1/8] Fix spelling error in rig.c --- src/rig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rig.c b/src/rig.c index 97b8ea20c..4c361820d 100644 --- a/src/rig.c +++ b/src/rig.c @@ -3042,7 +3042,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (caps->set_vfo) { - // if the underlying rig has OP_XCHC we don't need to set VFO + // if the underlying rig has OP_XCHG we don't need to set VFO if (!rig_has_vfo_op(rig, RIG_OP_XCHG)) { retcode = caps->set_vfo(rig, tx_vfo); From 723f3f0773782451586da9939717e88ab32a8509 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 07:51:35 -0500 Subject: [PATCH 2/8] Add some more rig cases for MainA/B and Sub A/B priv setting in icom_get_freq Add VFO_CURR as a valid VFO https://github.com/Hamlib/Hamlib/issues/299 --- rigs/icom/icom.c | 10 ++++++++-- rigs/icom/icom.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index a50a25a41..bdb8f024b 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1032,9 +1032,9 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) case RIG_VFO_SUB_B: case RIG_VFO_B: priv->vfob_freq = freq; break; - case RIG_VFO_MAIN: priv->sub_freq = freq; break; + case RIG_VFO_MAIN: priv->main_freq = freq; break; - case RIG_VFO_SUB: priv->main_freq = freq; break; + case RIG_VFO_SUB: priv->sub_freq = freq; break; case RIG_VFO_CURR: break; @@ -1229,14 +1229,20 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) switch (vfo) { + case RIG_VFO_MAIN_A: + case RIG_VFO_SUB_A: case RIG_VFO_A: priv->vfoa_freq = *freq; break; + case RIG_VFO_MAIN_B: + case RIG_VFO_SUB_B: case RIG_VFO_B: priv->vfob_freq = *freq; break; case RIG_VFO_MAIN: priv->main_freq = *freq; break; case RIG_VFO_SUB: priv->sub_freq = *freq; break; + case RIG_VFO_CURR: break; + default: rig_debug(RIG_DEBUG_ERR, "%s: unknown VFO? VFO=%s\n", __func__, rig_strvfo(vfo)); diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index 9e4b8c729..e6bd2248d 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -31,7 +31,7 @@ #include #endif -#define BACKEND_VER "20200612" +#define BACKEND_VER "20200613" /* * defines used by comp_cal_str in rig.c From 31fdc8cc0c357111cec66a83986724082aecb959 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 12:54:33 -0500 Subject: [PATCH 3/8] Add some debug to rig.c --- src/rig.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rig.c b/src/rig.c index 4c361820d..cc396b287 100644 --- a/src/rig.c +++ b/src/rig.c @@ -586,6 +586,7 @@ int HAMLIB_API rig_open(RIG *rig) &net3, &net4, &net5, &port) == 6; is_network |= sscanf(rs->rigport.pathname, "%u:%u:%u:%u:%u:%u:%u:%u:%u", &net1, &net2, &net3, &net4, &net5, &net6, &net7, &net8, &port) == 9; + // if we haven't met one of the condition above then we must have a hostname if (!is_network && (token = strtok_r(rs->rigport.pathname, ":", &strtokp))) { @@ -1292,10 +1293,14 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) return RIG_OK; // would be better as error but other software won't handle errors } + rig_debug(RIG_DEBUG_TRACE, "%s: TARGETABLE_FREQ vfo=%s\n", __func__, + rig_strvfo(vfo)); retcode = caps->set_freq(rig, vfo, freq); } else { + rig_debug(RIG_DEBUG_TRACE, "%s: not a TARGETABLE_FREQ vfo=%s\n", __func__, + rig_strvfo(vfo)); int rc2; vfo_t curr_vfo; From c5388b9f37191a9362e7c6e8056a3d33160e6db2 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 15:53:37 -0500 Subject: [PATCH 4/8] In icom.c remove priv->curr_vfo and change to rig->state.current_vfo https://github.com/Hamlib/Hamlib/issues/299 --- rigs/icom/icom.c | 97 +++++++++++++++++++++++------------------------- rigs/icom/icom.h | 3 +- src/rig.c | 3 +- 3 files changed, 50 insertions(+), 53 deletions(-) diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index bdb8f024b..e4e49da49 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -621,7 +621,7 @@ icom_init(RIG *rig) priv->no_xchg = priv_caps->no_xchg; priv->tx_vfo = RIG_VFO_NONE; priv->rx_vfo = RIG_VFO_NONE; - priv->curr_vfo = RIG_VFO_NONE; + rig->state.current_vfo = RIG_VFO_NONE; rig_debug(RIG_DEBUG_TRACE, "%s: done\n", __func__); @@ -804,10 +804,9 @@ icom_rig_close(RIG *rig) int icom_set_default_vfo(RIG *rig) { int retval; - struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv; rig_debug(RIG_DEBUG_TRACE, "%s: called, curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); if (VFO_HAS_MAIN_SUB_A_B_ONLY) { @@ -827,7 +826,7 @@ int icom_set_default_vfo(RIG *rig) return retval; } - priv->curr_vfo = RIG_VFO_MAIN; + rig->state.current_vfo = RIG_VFO_MAIN; return RIG_OK; } @@ -836,7 +835,7 @@ int icom_set_default_vfo(RIG *rig) rig_debug(RIG_DEBUG_TRACE, "%s: setting default as MAIN\n", __func__); retval = rig_set_vfo(rig, RIG_VFO_MAIN); // we'll default to Main in this case - priv->curr_vfo = RIG_VFO_MAIN; + rig->state.current_vfo = RIG_VFO_MAIN; } else if (VFO_HAS_A_B) { @@ -844,15 +843,15 @@ int icom_set_default_vfo(RIG *rig) __func__); retval = rig_set_vfo(rig, RIG_VFO_A); // we'll default to VFOA for all others - priv->curr_vfo = RIG_VFO_A; + rig->state.current_vfo = RIG_VFO_A; } else { // we don't have any VFO selection - rig_debug(RIG_DEBUG_TRACE, "%s: setting default as VFO_CURR\n", + rig_debug(RIG_DEBUG_TRACE, "%s: Unknown VFO setup so setting default as VFOA\n", __func__); - priv->curr_vfo = RIG_VFO_A; + rig->state.current_vfo = RIG_VFO_A; retval = RIG_OK; } @@ -860,6 +859,7 @@ int icom_set_default_vfo(RIG *rig) { return retval; } + rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now %s\n", __func__, rig_strvfo(rig->state.current_vfo)); return RIG_OK; } @@ -916,21 +916,21 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq) rs = &rig->state; priv = (struct icom_priv_data *) rs->priv; - if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) + if (rig->state.current_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) { icom_set_default_vfo(rig); } if (vfo == RIG_VFO_CURR) { - vfo = priv->curr_vfo; + vfo = rig->state.current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s: currVFO asked for so vfo set to %s\n", __func__, rig_strvfo(vfo)); } rig_debug(RIG_DEBUG_TRACE, "%s: set_vfo_curr=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); - retval = set_vfo_curr(rig, vfo, priv->curr_vfo); + rig_strvfo(rig->state.current_vfo)); + retval = set_vfo_curr(rig, vfo, rig->state.current_vfo); if (retval != RIG_OK) { @@ -1114,7 +1114,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (vfo == RIG_VFO_CURR) { - vfo = priv->curr_vfo; + vfo = rig->state.current_vfo; if (vfo == RIG_VFO_NONE) { vfo = RIG_VFO_A; } @@ -1125,7 +1125,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) #endif - retval = set_vfo_curr(rig, vfo, priv->curr_vfo); + retval = set_vfo_curr(rig, vfo, rig->state.current_vfo); if (retval != RIG_OK) { @@ -1137,7 +1137,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) #if 0 // Pick the appropriate VFO when VFO_RX or VFO_TX is requested - if (vfo == RIG_VFO_RX && priv->curr_vfo) + if (vfo == RIG_VFO_RX && rig->state.current_vfo) { vfo = vfo_fixup(rig, vfo); rig_debug(RIG_DEBUG_TRACE, "%s: vfo_fixup vfo=%s\n", __func__, rig_strvfo(vfo)); @@ -1167,7 +1167,7 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) rig_debug(RIG_DEBUG_VERBOSE, "%s: using vfo=%s\n", __func__, rig_strvfo(vfo)); - if (priv->curr_vfo == RIG_VFO_NONE) + if (rig->state.current_vfo == RIG_VFO_NONE) { retval = rig_set_vfo(rig, vfo); @@ -1952,7 +1952,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) if (vfo == RIG_VFO_CURR) { rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); return RIG_OK; } @@ -2003,10 +2003,10 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) rig_debug(RIG_DEBUG_TRACE, "%s: debug#1\n", __func__); - if (vfo != priv->curr_vfo) + if (vfo != rig->state.current_vfo) { rig_debug(RIG_DEBUG_TRACE, "%s: VFO changing from %s to %s\n", __func__, - rig_strvfo(priv->curr_vfo), rig_strvfo(vfo)); + rig_strvfo(rig->state.current_vfo), rig_strvfo(vfo)); priv->curr_freq = 0; // reset curr_freq so set_freq works 1st time } @@ -2063,7 +2063,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } - priv->curr_vfo = vfo; + rig->state.current_vfo = vfo; return RIG_OK; case RIG_VFO_MEM: @@ -2082,7 +2082,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } - priv->curr_vfo = vfo; + rig->state.current_vfo = vfo; return RIG_OK; case RIG_VFO_MAIN_A: // we need to select Main before setting VFO @@ -2102,7 +2102,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } - priv->curr_vfo = vfo; + rig->state.current_vfo = vfo; return RIG_OK; break; @@ -2124,7 +2124,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } - priv->curr_vfo = vfo; + rig->state.current_vfo = vfo; return RIG_OK; break; @@ -2152,9 +2152,8 @@ int icom_set_vfo(RIG *rig, vfo_t vfo) return -RIG_ERJCTED; } - priv->curr_vfo = vfo; rig->state.current_vfo = vfo; - rig_debug(RIG_DEBUG_TRACE, "%s: debug#5\n", __func__); + rig_debug(RIG_DEBUG_TRACE, "%s: debug#5 curr_vfo=%s\n", __func__, rig_strvfo(rig->state.current_vfo)); return RIG_OK; } @@ -3832,7 +3831,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) rs = &rig->state; priv = (struct icom_priv_data *) rs->priv; rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); rig_debug(RIG_DEBUG_VERBOSE, "%s: satmode=%d, subvfo=%s\n", __func__, rig->state.cache.satmode, rig_strvfo(priv->tx_vfo)); @@ -3847,7 +3846,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) if (rig->state.cache.satmode && vfo == RIG_VFO_TX) { vfo = RIG_VFO_SUB; } - if (priv->curr_vfo == RIG_VFO_NONE) + if (rig->state.current_vfo == RIG_VFO_NONE) { retval = icom_set_default_vfo(rig); @@ -4037,7 +4036,7 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) rs = &rig->state; priv = (struct icom_priv_data *) rs->priv; rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); if (rig->caps->rig_model == RIG_MODEL_IC910) @@ -4061,9 +4060,9 @@ int icom_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) } rig_debug(RIG_DEBUG_VERBOSE, "%s curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); - if (priv->curr_vfo == RIG_VFO_NONE) + if (rig->state.current_vfo == RIG_VFO_NONE) { icom_set_default_vfo(rig); } @@ -4442,13 +4441,13 @@ int icom_set_split_freq_mode(RIG *rig, vfo_t vfo, freq_t tx_freq, rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s\n", __func__, rig_strvfo(vfo)); rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); // If the user is asking to set split on VFO_CURR we'll assume split mode // WSJT-X calls this function before turning on split mode if (vfo == RIG_VFO_CURR) { split_assumed = 1; } - if (priv->curr_vfo == RIG_VFO_NONE) + if (rig->state.current_vfo == RIG_VFO_NONE) { icom_set_default_vfo(rig); } @@ -4700,11 +4699,11 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo='%s', split=%d, tx_vfo=%s, curr_vfo=%s\n", __func__, - rig_strvfo(vfo), split, rig_strvfo(tx_vfo), rig_strvfo(priv->curr_vfo)); + rig_strvfo(vfo), split, rig_strvfo(tx_vfo), rig_strvfo(rig->state.current_vfo)); if (vfo == RIG_VFO_CURR) { - vfo = priv->curr_vfo; + vfo = rig->state.current_vfo; } // This should automaticaly switch between satmode on/off based on the requested split vfo @@ -4713,7 +4712,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) if ((tx_vfo == RIG_VFO_SUB || tx_vfo == RIG_VFO_MAIN) && !rig->state.cache.satmode) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_SUB and satmode is off so turning on\n", + rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_SUB and satmode is off so turning satmode on\n", __func__); rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 1); rig->state.cache.satmode = 1; @@ -4722,7 +4721,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) else if ((tx_vfo == RIG_VFO_A || tx_vfo == RIG_VFO_B) && rig->state.cache.satmode) { - rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning off\n", + rig_debug(RIG_DEBUG_VERBOSE, "%s: VFO_B and satmode is on so turning satmode off\n", __func__); rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_SATMODE, 0); rig->state.cache.satmode = 0; @@ -4884,7 +4883,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) priv->split_on = RIG_SPLIT_ON == split; - if (vfo_final != RIG_VFO_NONE && vfo_final != priv->curr_vfo) + if (vfo_final != RIG_VFO_NONE && vfo_final != rig->state.current_vfo) { rig_debug(RIG_DEBUG_TRACE, "%s: vfo_final set %s\n", __func__, rig_strvfo(vfo_final)); @@ -4899,7 +4898,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s curr_vfo=%s rx_vfo=%s tx_vfo=%s split=%d\n", - __func__, rig_strvfo(vfo), rig_strvfo(priv->curr_vfo), rig_strvfo(priv->rx_vfo), + __func__, rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo), rig_strvfo(priv->rx_vfo), rig_strvfo(priv->tx_vfo), split); return RIG_OK; } @@ -7144,7 +7143,7 @@ int icom_get_freq_range(RIG *rig) return RIG_OK; } -// Sets rig vfo && priv->curr_vfo to default VFOA, or current vfo, or the vfo requested +// Sets rig vfo && rig->state.current_vfo to default VFOA, or current vfo, or the vfo requested static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo) { int retval; @@ -7156,8 +7155,8 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo) if (vfo == RIG_VFO_CURR) { rig_debug(RIG_DEBUG_TRACE, "%s: Asking for currVFO, currVFO=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); - vfo = priv->curr_vfo; + rig_strvfo(rig->state.current_vfo)); + vfo = rig->state.current_vfo; } if (vfo == RIG_VFO_MAIN && VFO_HAS_A_B_ONLY) @@ -7176,22 +7175,22 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo) /* This method works also in memory mode(RIG_VFO_MEM) */ // first time we will set default to VFOA or Main as // So if you ask for frequency or such without setting VFO first you'll get Main/VFOA - if (priv->curr_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) + if (rig->state.current_vfo == RIG_VFO_NONE && vfo == RIG_VFO_CURR) { icom_set_default_vfo(rig); } // asking for vfo_curr so give it to them - else if (priv->curr_vfo != RIG_VFO_NONE && vfo == RIG_VFO_CURR) + else if (rig->state.current_vfo != RIG_VFO_NONE && vfo == RIG_VFO_CURR) { rig_debug(RIG_DEBUG_TRACE, "%s: using curr_vfo=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); - vfo = priv->curr_vfo; + rig_strvfo(rig->state.current_vfo)); + vfo = rig->state.current_vfo; } // only need to set vfo if it's changed - else if (priv->curr_vfo != vfo) + else if (rig->state.current_vfo != vfo) { if (!(VFO_HAS_MAIN_SUB_A_B_ONLY && !priv->split_on && !rig->state.cache.satmode - && vfo == RIG_VFO_SUB && priv->curr_vfo == RIG_VFO_B)) + && vfo == RIG_VFO_SUB && rig->state.current_vfo == RIG_VFO_B)) { rig_debug(RIG_DEBUG_TRACE, "%s: setting new vfo=%s\n", __func__, rig_strvfo(vfo)); @@ -7201,13 +7200,11 @@ static int set_vfo_curr(RIG *rig, vfo_t vfo, vfo_t curr_vfo) { return retval; } - - priv->curr_vfo = vfo; } } rig_debug(RIG_DEBUG_TRACE, "%s: curr_vfo now=%s\n", __func__, - rig_strvfo(priv->curr_vfo)); + rig_strvfo(rig->state.current_vfo)); rig->state.current_vfo = vfo; diff --git a/rigs/icom/icom.h b/rigs/icom/icom.h index e6bd2248d..a2693dbfe 100644 --- a/rigs/icom/icom.h +++ b/rigs/icom/icom.h @@ -179,9 +179,8 @@ struct icom_priv_data int split_on; /* record split state */ pltstate_t *pltstate; /* only on optoscan */ int serial_USB_echo_off; /* USB is not set to echo */ - /* we track vfos internallhy for use with different functions like split */ + /* we track vfos internally for use with different functions like split */ /* this allows queries using CURR_VFO and Main/Sub to behave */ - vfo_t curr_vfo; vfo_t rx_vfo; vfo_t tx_vfo; freq_t curr_freq; // our current freq depending on which vfo is selected diff --git a/src/rig.c b/src/rig.c index cc396b287..ca13178ba 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2899,7 +2899,8 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) int retcode, rc2; vfo_t curr_vfo, tx_vfo; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__, + rig_strvfo(vfo), rig_strvfo(vfo_curr)); if (CHECK_RIG_ARG(rig)) { From c5557ce3b177425ac75d2e14247fff7ec382fcea Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 16:02:14 -0500 Subject: [PATCH 5/8] Replace priv->curr_vfo in xg3.c with rig->state.current_vfo --- rigs/kenwood/xg3.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/rigs/kenwood/xg3.c b/rigs/kenwood/xg3.c index 0ef09d06d..eac10f408 100644 --- a/rigs/kenwood/xg3.c +++ b/rigs/kenwood/xg3.c @@ -52,7 +52,6 @@ struct xg3_priv_data { /* current vfo already in rig_state ? */ - vfo_t curr_vfo; vfo_t last_vfo; ptt_t ptt; powerstat_t powerstat; @@ -107,9 +106,9 @@ const struct rig_caps xg3_caps = RIG_MODEL(RIG_MODEL_XG3), .model_name = "XG3", .mfg_name = "Elecraft", - .version = "20191218.0", + .version = "20200613.0", .copyright = "LGPL", - .status = RIG_STATUS_BETA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_RIG, @@ -193,7 +192,7 @@ int xg3_init(RIG *rig) // Tried set_trn to turn transceiver on/off but turning it on isn't enabled in hamlib for some reason // So we use PTT instead // rig->state.transceive = RIG_TRN_RIG; // this allows xg3_set_trn to be called - priv->curr_vfo = RIG_VFO_A; + rig->state.current_vfo = RIG_VFO_A; priv->last_vfo = RIG_VFO_A; priv->ptt = RIG_PTT_ON; priv->powerstat = RIG_POWER_ON; @@ -334,8 +333,6 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) */ int xg3_get_vfo(RIG *rig, vfo_t *vfo) { - struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!vfo) @@ -343,7 +340,7 @@ int xg3_get_vfo(RIG *rig, vfo_t *vfo) return -RIG_EINVAL; } - *vfo = priv->curr_vfo; // VFOA or MEM + *vfo = rig->state.current_vfo; // VFOA or MEM return RIG_OK; } @@ -352,8 +349,6 @@ int xg3_get_vfo(RIG *rig, vfo_t *vfo) */ int xg3_set_vfo(RIG *rig, vfo_t vfo) { - struct xg3_priv_data *priv = (struct xg3_priv_data *)rig->state.priv; - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); if (!vfo) @@ -365,7 +360,7 @@ int xg3_set_vfo(RIG *rig, vfo_t vfo) // We don't actually set the vfo on the XG3 // But we need this so we can set frequencies on the band buttons - priv->curr_vfo = vfo; + rig->state.current_vfo = vfo; return RIG_OK; } From f323a54b5aeb8bd84df9b100aa8cb08607471dd8 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 16:31:25 -0500 Subject: [PATCH 6/8] Fix cppcheck warnings and compile error --- src/rig.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rig.c b/src/rig.c index ca13178ba..c14537d2a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -597,7 +597,7 @@ int HAMLIB_API rig_open(RIG *rig) { rig_debug(RIG_DEBUG_TRACE, "%s: token2=%s\n", __func__, token); - if (sscanf(token, "%d", &port)) { is_network |= 1; } + if (sscanf(token, "%u", &port)) { is_network |= 1; } } } @@ -2900,7 +2900,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) vfo_t curr_vfo, tx_vfo; rig_debug(RIG_DEBUG_VERBOSE, "%s called vfo=%s, curr_vfo=%s\n", __func__, - rig_strvfo(vfo), rig_strvfo(vfo_curr)); + rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo)); if (CHECK_RIG_ARG(rig)) { @@ -3004,7 +3004,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { const struct rig_caps *caps; - int retcode, rc2; + int retcode = -RIG_EPROTO, rc2; vfo_t save_vfo, tx_vfo; rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); @@ -3052,6 +3052,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (!rig_has_vfo_op(rig, RIG_OP_XCHG)) { retcode = caps->set_vfo(rig, tx_vfo); + return retcode; } } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) From 815db24852f30f9eb74531dae32a0fc571c5e446 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sat, 13 Jun 2020 17:40:47 -0500 Subject: [PATCH 7/8] Fix MSVC compile by removing unistd.h and defining our own rig_useconds_t https://github.com/Hamlib/Hamlib/issues/301 --- dummy/flrig.h | 2 +- include/hamlib/rig.h | 4 ++-- src/misc.h | 2 +- src/sleep.c | 6 ++++-- src/sleep.h | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dummy/flrig.h b/dummy/flrig.h index 1134d7aba..00e841d8a 100644 --- a/dummy/flrig.h +++ b/dummy/flrig.h @@ -28,7 +28,7 @@ #include #endif -#define BACKEND_VER "20200510" +#define BACKEND_VER "20200613" #define EOM "\r" #define TRUE 1 diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 239c9deec..53e0f2948 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2743,8 +2743,8 @@ extern HAMLIB_EXPORT(int) rig_set_vfo_opt(RIG *rig, int status); // cppcheck-suppress * -#include -extern HAMLIB_EXPORT(int) hl_usleep(useconds_t msec); +typedef unsigned long rig_useconds_t; +extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t msec); //! @endcond diff --git a/src/misc.h b/src/misc.h index f92d5fcc8..382b949d8 100644 --- a/src/misc.h +++ b/src/misc.h @@ -100,7 +100,7 @@ extern HAMLIB_EXPORT(void) rig_force_cache_timeout(struct timeval *tv); extern HAMLIB_EXPORT(setting_t) rig_idx2setting(int i); -extern HAMLIB_EXPORT(int) hl_usleep(useconds_t usec); +extern HAMLIB_EXPORT(int) hl_usleep(rig_useconds_t usec); extern HAMLIB_EXPORT(double) elapsed_ms(struct timespec *start, int start_flag); diff --git a/src/sleep.c b/src/sleep.c index 709f884db..d8624ed4c 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -50,7 +50,7 @@ extern "C" { // In order to stop the usleep warnings in cppcheck we provide our own interface // So this will use system usleep or our usleep depending on availability of nanosleep // This version of usleep can handle > 1000000 usec values -int hl_usleep(useconds_t usec) +int hl_usleep(rig_useconds_t usec) { int retval = 0; @@ -85,12 +85,13 @@ unsigned int sleep(unsigned int secs) } +#if 0 /** * \brief microsecond sleep * \param usec is microseconds to sleep * This does not have the same 1000000 limit as POSIX usleep */ -int usleep(useconds_t usec) +int usleep(rig_useconds_t usec) { int retval; unsigned long sec = usec / 1000000ul; @@ -106,6 +107,7 @@ int usleep(useconds_t usec) return 0; } +#endif #endif // HAVE_NANOSLEEP #ifdef __cplusplus diff --git a/src/sleep.h b/src/sleep.h index 5f2c11d0d..89f9be2e3 100644 --- a/src/sleep.h +++ b/src/sleep.h @@ -28,7 +28,7 @@ __BEGIN_DECLS /* Hamlib internal use, see rig.c */ -int hl_usleep(useconds_t usec); +int hl_usleep(rig_useconds_t usec); __END_DECLS From c0a3450f28ce0e3ff373bd671f2bd3f4a2af5cf8 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Sun, 14 Jun 2020 07:23:25 -0500 Subject: [PATCH 8/8] Remove RIG_TARGETABLE_FREQ from IC-9700 https://github.com/Hamlib/Hamlib/issues/299 --- rigs/icom/ic7300.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rigs/icom/ic7300.c b/rigs/icom/ic7300.c index 26bbd1f3a..898e50e48 100644 --- a/rigs/icom/ic7300.c +++ b/rigs/icom/ic7300.c @@ -422,7 +422,7 @@ const struct rig_caps ic9700_caps = RIG_MODEL(RIG_MODEL_IC9700), .model_name = "IC-9700", .mfg_name = "Icom", - .version = BACKEND_VER ".0", + .version = BACKEND_VER ".1", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -460,7 +460,7 @@ const struct rig_caps ic9700_caps = .max_rit = Hz(9999), .max_xit = Hz(9999), .max_ifshift = Hz(0), - .targetable_vfo = RIG_TARGETABLE_FREQ, + .targetable_vfo = 0, .vfo_ops = IC9700_VFO_OPS, .scan_ops = IC9700_SCAN_OPS, .transceive = RIG_TRN_RIG,