From f5870c84ef844aa60be0d710e8b6401214621141 Mon Sep 17 00:00:00 2001 From: George Baltz N3GB Date: Thu, 6 Jun 2024 12:58:40 -0400 Subject: [PATCH] First set of rigs/icom/* state pointer macros. --- rigs/icom/frame.c | 9 ++++----- rigs/icom/ic746.c | 12 ++++++------ rigs/icom/ic756.c | 4 ++-- rigs/icom/ic7700.c | 2 +- rigs/icom/ic7800.c | 4 ++-- rigs/icom/ic821h.c | 4 ++-- rigs/icom/ic92d.c | 2 +- rigs/icom/icf8101.c | 4 ++-- rigs/icom/icr75.c | 8 ++++---- rigs/icom/id5100.c | 28 ++++++++++++++-------------- rigs/icom/omni.c | 2 +- rigs/icom/optoscan.c | 24 ++++++++++++------------ rigs/icom/xiegu.c | 18 +++++++++--------- 13 files changed, 60 insertions(+), 61 deletions(-) diff --git a/rigs/icom/frame.c b/rigs/icom/frame.c index d939de897..8526ad4e4 100644 --- a/rigs/icom/frame.c +++ b/rigs/icom/frame.c @@ -116,7 +116,7 @@ int icom_frame_fix_preamble(int frame_len, unsigned char *frame) /* * icom_one_transaction * - * We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL + * We assume that rig!=NULL, STATE(rig)!= NULL, payload!=NULL, data!=NULL, data_len!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * payload can be NULL if payload_len == 0 * subcmd can be equal to -1 (no subcmd wanted) @@ -131,7 +131,7 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd, { struct icom_priv_data *priv; const struct icom_priv_caps *priv_caps; - struct rig_state *rs; + struct rig_state *rs = STATE(rig); hamlib_port_t *rp = RIGPORT(rig); struct timeval start_time, current_time, elapsed_time; // this buf needs to be large enough for 0xfe strings for power up @@ -145,7 +145,6 @@ int icom_one_transaction(RIG *rig, unsigned char cmd, int subcmd, ENTERFUNC; memset(buf, 0, 200); memset(sendbuf, 0, MAXFRAMELEN); - rs = &rig->state; priv = (struct icom_priv_data *)rs->priv; priv_caps = (struct icom_priv_caps *)rig->caps->priv; @@ -461,7 +460,7 @@ again2: * * This function honors rigport.retry count. * - * We assume that rig!=NULL, rig->state!= NULL, payload!=NULL, data!=NULL, data_len!=NULL + * We assume that rig!=NULL, STATE(rig)!= NULL, payload!=NULL, data!=NULL, data_len!=NULL * Otherwise, you'll get a nice seg fault. You've been warned! * payload can be NULL if payload_len == 0 * subcmd can be equal to -1 (no subcmd wanted) @@ -613,7 +612,7 @@ int rig2icom_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width, signed char icmode_ext; pbwidth_t width_tmp = width; const struct icom_priv_data *priv_data = (struct icom_priv_data *) - rig->state.priv; + STATE(rig)->priv; ENTERFUNC; rig_debug(RIG_DEBUG_TRACE, "%s: mode=%d, width=%d\n", __func__, (int)mode, diff --git a/rigs/icom/ic746.c b/rigs/icom/ic746.c index 616b8f08c..19bd632d5 100644 --- a/rigs/icom/ic746.c +++ b/rigs/icom/ic746.c @@ -601,7 +601,7 @@ struct rig_caps ic746pro_caps = /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ static int ic746pro_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) { @@ -664,7 +664,7 @@ static int ic746pro_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) } /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL * and val points to a buffer big enough to hold the conf value. */ static int ic746pro_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val) @@ -918,7 +918,7 @@ int ic746_get_parm(RIG *rig, setting_t parm, value_t *val) /* * ic746pro_get_channel - * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL * * If memory is empty it will return RIG_OK,but every thing will be null. Where do we boundary check? */ @@ -929,7 +929,7 @@ int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) unsigned char chanbuf[MAXFRAMELEN]; int chan_len, freq_len, retval, data_len; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; to_bcd_be(chanbuf, chan->channel_num, 4); @@ -1086,7 +1086,7 @@ int ic746pro_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) /* * ic746pro_set_channel - * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL */ int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) { @@ -1096,7 +1096,7 @@ int ic746pro_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) unsigned char chanbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; int chan_len, ack_len, freq_len, retval; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; freq_len = priv->civ_731_mode ? 4 : 5; diff --git a/rigs/icom/ic756.c b/rigs/icom/ic756.c index 67b63f506..76f23fdf0 100644 --- a/rigs/icom/ic756.c +++ b/rigs/icom/ic756.c @@ -697,7 +697,7 @@ struct rig_caps ic756pro2_caps = /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ static int ic756pro2_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) { @@ -777,7 +777,7 @@ static int ic756pro2_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) } /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL * and val points to a buffer big enough to hold the conf value. */ static int ic756pro2_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val) diff --git a/rigs/icom/ic7700.c b/rigs/icom/ic7700.c index b9b1edc43..73b6f891c 100644 --- a/rigs/icom/ic7700.c +++ b/rigs/icom/ic7700.c @@ -267,7 +267,7 @@ int ic7700_get_clock(RIG *rig, int *year, int *month, int *day, int *hour, static int ic7700_rig_open(RIG *rig) { rig_debug(RIG_DEBUG_VERBOSE, "%s: enter\n", __func__); - struct icom_priv_data *priv = (struct icom_priv_data *) rig->state.priv; + struct icom_priv_data *priv = (struct icom_priv_data *) STATE(rig)->priv; priv->x26cmdfails = priv->x25cmdfails = 1; return icom_rig_open(rig); } diff --git a/rigs/icom/ic7800.c b/rigs/icom/ic7800.c index 00a99be41..839def696 100644 --- a/rigs/icom/ic7800.c +++ b/rigs/icom/ic7800.c @@ -371,7 +371,7 @@ int ic7800_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) for (i = 0; i < 7; i++) { - if (val.i == rig->state.attenuator[i]) + if (val.i == STATE(rig)->attenuator[i]) { val.i = i + 1; break; @@ -412,7 +412,7 @@ int ic7800_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) */ if (val->i > 0 && val->i <= 7) { - val->i = rig->state.attenuator[val->i - 1]; + val->i = STATE(rig)->attenuator[val->i - 1]; } break; diff --git a/rigs/icom/ic821h.c b/rigs/icom/ic821h.c index 3b6000f7a..1d0938eba 100644 --- a/rigs/icom/ic821h.c +++ b/rigs/icom/ic821h.c @@ -68,14 +68,14 @@ int ic821h_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) split; // we emulate satmode of other rigs since we apparently can't query rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo==MAIN so assuming sat mode=%d\n", __func__, CACHE(rig)->satmode); - rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN; + STATE(rig)->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_SUB : RIG_VFO_MAIN; // the IC821 seems to be backwards in satmode -- setting Main select Sub and vice versa retval = rig_set_vfo(rig, RIG_VFO_SUB); } else if (tx_vfo == RIG_VFO_A) { retval = rig_set_vfo(rig, RIG_VFO_A); - rig->state.tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A; + STATE(rig)->tx_vfo = split == RIG_SPLIT_ON ? RIG_VFO_B : RIG_VFO_A; } else { diff --git a/rigs/icom/ic92d.c b/rigs/icom/ic92d.c index 5d8c33f95..125a4ac33 100644 --- a/rigs/icom/ic92d.c +++ b/rigs/icom/ic92d.c @@ -225,7 +225,7 @@ const char *ic92d_get_info(RIG *rig) int ack_len, retval; static char info[64]; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; // 018019fd diff --git a/rigs/icom/icf8101.c b/rigs/icom/icf8101.c index 2c6e448d0..a94769cff 100644 --- a/rigs/icom/icf8101.c +++ b/rigs/icom/icf8101.c @@ -42,7 +42,7 @@ static int icf8101_set_freq(RIG *rig, vfo_t vfo, freq_t freq) int freq_len = 5; int ack_len; unsigned char freqbuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN]; - vfo_t vfo_save = rig->state.current_vfo; + vfo_t vfo_save = STATE(rig)->current_vfo; if (vfo != vfo_save) { @@ -348,7 +348,7 @@ int icf8101_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) /* * icf8101_get_ptt - * Assumes rig!=NULL, rig->state.priv!=NULL, ptt!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, ptt!=NULL */ int icf8101_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) { diff --git a/rigs/icom/icr75.c b/rigs/icom/icr75.c index d866eceb1..f00a8c432 100644 --- a/rigs/icom/icr75.c +++ b/rigs/icom/icr75.c @@ -250,7 +250,7 @@ struct rig_caps icr75_caps = /* * icr75_set_channel - * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) @@ -263,7 +263,7 @@ int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) signed char icmode_ext; int err; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; to_bcd_be(chanbuf, chan->channel_num, 4); @@ -319,7 +319,7 @@ int icr75_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan) /* * icr75_get_channel - * Assumes rig!=NULL, rig->state.priv!=NULL, chan!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, chan!=NULL * TODO: still a WIP --SF */ int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) @@ -329,7 +329,7 @@ int icr75_get_channel(RIG *rig, vfo_t vfo, channel_t *chan, int read_only) unsigned char chanbuf[24]; int chan_len, freq_len, retval; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; to_bcd_be(chanbuf, chan->channel_num, 4); diff --git a/rigs/icom/id5100.c b/rigs/icom/id5100.c index aae0b19d2..e31f55585 100644 --- a/rigs/icom/id5100.c +++ b/rigs/icom/id5100.c @@ -75,14 +75,14 @@ int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo); int id5100_set_vfo(RIG *rig, vfo_t vfo) { - struct rig_state *rs = &rig->state; + struct rig_state *rs = STATE(rig); struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; unsigned char ackbuf[MAXFRAMELEN]; int ack_len = sizeof(ackbuf), retval; ENTERFUNC; - if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } + if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; } // if user requests VFOA/B we automatically turn of dual watch mode // if user requests Main/Sub we automatically turn on dual watch mode @@ -127,13 +127,13 @@ int id5100_set_vfo(RIG *rig, vfo_t vfo) int myvfo = S_MAIN; priv->dual_watch_main_sub = MAIN_ON_LEFT; - rig->state.current_vfo = RIG_VFO_A; + rs->current_vfo = RIG_VFO_A; if (vfo == RIG_VFO_B || vfo == RIG_VFO_SUB) { myvfo = S_SUB; priv->dual_watch_main_sub = MAIN_ON_RIGHT; - rig->state.current_vfo = vfo; + rs->current_vfo = vfo; } if (RIG_OK != (retval = icom_transaction(rig, C_SET_VFO, myvfo, NULL, 0, ackbuf, @@ -153,12 +153,12 @@ int id5100_set_freq(RIG *rig, vfo_t vfo, freq_t freq) unsigned char freqbuf[MAXFRAMELEN]; int freq_len = 5; int retval; - struct rig_state *rs = &rig->state; + struct rig_state *rs = STATE(rig); //struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; - vfo_t currvfo = rig->state.current_vfo; + vfo_t currvfo = rs->current_vfo; - if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } + if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; } if (rs->dual_watch == 0 && (vfo == RIG_VFO_MAIN || vfo == RIG_VFO_SUB)) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 1, RIG_VFO_MAIN); } @@ -209,13 +209,13 @@ static int id5100_get_freq2(RIG *rig, vfo_t vfo, freq_t *freq) int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { - struct rig_state *rs = &rig->state; + struct rig_state *rs = STATE(rig); struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; int retval; - vfo_t currvfo = rig->state.current_vfo; + vfo_t currvfo = rs->current_vfo; - if (rs->dual_watch == 1 && rig->state.current_vfo != RIG_VFO_SUB) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 0, RIG_VFO_MAIN); } + if (rs->dual_watch == 1 && rs->current_vfo != RIG_VFO_SUB) { id5100_set_split_vfo(rig, RIG_VFO_SUB, 0, RIG_VFO_MAIN); } if (rs->dual_watch) // dual watch is different { @@ -298,7 +298,7 @@ int id5100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { rig_debug(RIG_DEBUG_VERBOSE, "%s: Dual watch is off\n", __func__); } - if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } + if (vfo == RIG_VFO_CURR) { vfo = rs->current_vfo; } if (vfo == RIG_VFO_MAIN && priv->dual_watch_main_sub == MAIN_ON_LEFT) { rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): Main/A vfo=%s\n", __func__, __LINE__, @@ -422,7 +422,7 @@ int id5100_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) int id5100_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { - struct rig_state *rs = &rig->state; + struct rig_state *rs = STATE(rig); struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; int retval; @@ -486,14 +486,14 @@ int id5100_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) int id5100_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) { int retval; - //struct rig_state *rs = &rig->state; + //struct rig_state *rs = STATE(rig); //struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv; //vfo_t currvfo; rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): vfo=%s\n", __func__, __LINE__, rig_strvfo(vfo)); #if 0 - currvfo = rig->state.current_vfo; + currvfo = rs->current_vfo; if (priv->dual_watch_main_sub == MAIN_ON_LEFT && (currvfo == RIG_VFO_MAIN || currvfo == RIG_VFO_A) && vfo == RIG_VFO_TX) diff --git a/rigs/icom/omni.c b/rigs/icom/omni.c index 0c2e33f7c..60029e0b7 100644 --- a/rigs/icom/omni.c +++ b/rigs/icom/omni.c @@ -179,7 +179,7 @@ struct rig_caps omnivip_caps = /* * omni6_set_ptt based on icom_set_ptt - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int omni6_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { diff --git a/rigs/icom/optoscan.c b/rigs/icom/optoscan.c index 21222667b..117632e88 100644 --- a/rigs/icom/optoscan.c +++ b/rigs/icom/optoscan.c @@ -60,7 +60,7 @@ static int optoscan_wait_timer(RIG *rig, pltstate_t *state); /* * optoscan_open - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_open(RIG *rig) { @@ -70,7 +70,7 @@ int optoscan_open(RIG *rig) unsigned char ackbuf[16]; int ack_len, retval; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; pltstate = calloc(1, sizeof(pltstate_t)); @@ -106,7 +106,7 @@ int optoscan_open(RIG *rig) /* * optoscan_close - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_close(RIG *rig) { @@ -115,7 +115,7 @@ int optoscan_close(RIG *rig) unsigned char ackbuf[16]; int ack_len, retval; - rs = &rig->state; + rs = STATE(rig); priv = (struct icom_priv_data *)rs->priv; /* select LOCAL control */ @@ -141,7 +141,7 @@ int optoscan_close(RIG *rig) /* * optoscan_get_info - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ const char *optoscan_get_info(RIG *rig) { @@ -176,7 +176,7 @@ const char *optoscan_get_info(RIG *rig) /* * optoscan_get_ctcss_tone - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) { @@ -209,7 +209,7 @@ int optoscan_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone) /* * optoscan_get_dcs_code - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code) { @@ -292,7 +292,7 @@ int optoscan_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) } /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) { @@ -364,7 +364,7 @@ int optoscan_set_ext_parm(RIG *rig, hamlib_token_t token, value_t val) } /* - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL * and val points to a buffer big enough to hold the conf value. */ int optoscan_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val) @@ -422,7 +422,7 @@ int optoscan_get_ext_parm(RIG *rig, hamlib_token_t token, value_t *val) /* * optoscan_set_level - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) { @@ -487,7 +487,7 @@ int optoscan_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) /* * optoscan_get_level - * Assumes rig!=NULL, rig->state.priv!=NULL, val!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, val!=NULL */ int optoscan_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) { @@ -618,7 +618,7 @@ int optoscan_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) return -RIG_ENAVAIL; } - rs = &rig->state; + rs = STATE(rig); cb = rig->callbacks.pltune; state = ((struct icom_priv_data *)rs->priv)->pltstate; diff --git a/rigs/icom/xiegu.c b/rigs/icom/xiegu.c index d70de0f4a..342250154 100644 --- a/rigs/icom/xiegu.c +++ b/rigs/icom/xiegu.c @@ -917,7 +917,7 @@ struct rig_caps x5105_caps = /* * x108g_set_ptt - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL * The response from the x108g isn't quite right at this time * Eventually they may fix their firmware and we can use the icom_set_split_vfo */ @@ -953,7 +953,7 @@ int x108g_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) * The response from the x108g isn't quite right at this time * Eventually they may fix their firmware and we can use the icom_set_split_vfo * x108g_set_split - * Assumes rig!=NULL, rig->state.priv!=NULL + * Assumes rig!=NULL, STATE(rig)->priv!=NULL */ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) { @@ -976,7 +976,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) if (cachep->split == RIG_SPLIT_OFF) { /* ensure VFO A is Rx and VFO B is Tx as we assume that elsewhere */ - if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)) + if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B)) { if (RIG_OK != (rc = icom_set_vfo(rig, RIG_VFO_A))) { return rc; } } @@ -1006,7 +1006,7 @@ static int x108g_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo) /* * x108g_set_split_freq - * Assumes rig!=NULL, rig->state.priv!=NULL, + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, * * Assumes also that the current VFO is the rx VFO. */ @@ -1040,7 +1040,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) assumptions allow us to deal with the lack of VFO and split queries */ /* broken if user changes split on rig :( */ - if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) + if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) && cachep->split != RIG_SPLIT_OFF) { /* VFO A/B style rigs swap VFO on split Tx so we need to disable @@ -1067,7 +1067,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; } - if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) + if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) && cachep->split != RIG_SPLIT_OFF) { /* Re-enable split */ @@ -1083,7 +1083,7 @@ static int x108g_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) /* * x108g_set_split_mode - * Assumes rig!=NULL, rig->state.priv!=NULL, + * Assumes rig!=NULL, STATE(rig)->priv!=NULL, */ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width) @@ -1117,7 +1117,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, assumptions allow us to deal with the lack of VFO and split queries */ /* broken if user changes split on rig :( */ - if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) + if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) && cachep->split != RIG_SPLIT_OFF) { /* VFO A/B style rigs swap VFO on split Tx so we need to disable @@ -1145,7 +1145,7 @@ static int x108g_set_split_mode(RIG *rig, vfo_t vfo, rmode_t tx_mode, if (RIG_OK != (rc = icom_set_vfo(rig, rx_vfo))) { return rc; } - if ((rig->state.vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) + if ((STATE(rig)->vfo_list & (RIG_VFO_A | RIG_VFO_B)) == (RIG_VFO_A | RIG_VFO_B) && cachep->split != RIG_SPLIT_OFF) { /* Re-enable split */