From 64c2a4d4a95a4d905586b4b513237f622c7b0c2d Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Tue, 27 Apr 2021 09:36:27 -0500 Subject: [PATCH] Add TRACE statements to allow for better debug following top level rig calls --- src/rig.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 142 insertions(+), 4 deletions(-) diff --git a/src/rig.c b/src/rig.c index 42eb59871..21a2ca97a 100644 --- a/src/rig.c +++ b/src/rig.c @@ -193,6 +193,8 @@ static const char *rigerror_table[] = #define ERROR_TBL_SZ (sizeof(rigerror_table)/sizeof(char *)) +#define TRACE rig_debug(RIG_DEBUG_TRACE,"%s(%d) trace\n", __FILE__, __LINE__) + /* * track which rig is opened (with rig_open) * needed at least for transceive mode @@ -1002,6 +1004,7 @@ int HAMLIB_API rig_open(RIG *rig) /* * trigger state->current_vfo first retrieval */ + TRACE; if (rig_get_vfo(rig, &rs->current_vfo) == RIG_OK) { rs->tx_vfo = rs->current_vfo; @@ -1014,6 +1017,7 @@ int HAMLIB_API rig_open(RIG *rig) if (backend_num == RIG_ICOM) { + TRACE; rig_set_vfo(rig, RIG_VFO_A); // force VFOA as our startup VFO rig_debug(RIG_DEBUG_TRACE, "%s: Icom rig so default vfo = %s\n", __func__, rig_strvfo(rs->current_vfo)); @@ -1037,6 +1041,7 @@ int HAMLIB_API rig_open(RIG *rig) // try to turn off the screensaver if possible // don't care about the return here...it's just a nice-to-have parm_value.i = 0; + TRACE; rig_set_parm(rig, RIG_PARM_SCREENSAVER, parm_value); } @@ -1100,6 +1105,7 @@ int HAMLIB_API rig_close(RIG *rig) if (rs->transceive != RIG_TRN_OFF) { + TRACE; rig_set_trn(rig, RIG_TRN_OFF); } @@ -1639,6 +1645,7 @@ int twiddling(RIG *rig) int retval2; int elapsed; + TRACE; retval2 = caps->get_freq(rig, RIG_VFO_CURR, &curr_freq); if (retval2 == RIG_OK && rig->state.current_freq != curr_freq) @@ -1737,7 +1744,10 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n", __func__); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save); + if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + TRACE; + rig_set_vfo(rig, vfo_save); + } RETURNFUNC( RIG_OK); // would be better as error but other software won't handle errors } @@ -1749,6 +1759,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) do { + TRACE; retcode = caps->set_freq(rig, vfo, freq); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -1803,11 +1814,15 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) { rig_debug(RIG_DEBUG_TRACE, "%s: Ignoring set_freq due to VFO twiddling\n", __func__); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save); + if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + TRACE; + rig_set_vfo(rig, vfo_save); + } RETURNFUNC( RIG_OK); // would be better as error but other software won't handle errors } + TRACE; retcode = caps->set_freq(rig, vfo, freq); } @@ -1827,6 +1842,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) ) { set_cache_freq(rig, RIG_VFO_ALL, (freq_t)0); + TRACE; retcode = rig_get_freq(rig, vfo, &freq_new); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -1846,7 +1862,10 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) set_cache_freq(rig, vfo, freq_new); - if (vfo != vfo_save && vfo != RIG_VFO_CURR) rig_set_vfo(rig, vfo_save); + if (vfo != vfo_save && vfo != RIG_VFO_CURR) { + TRACE; + rig_set_vfo(rig, vfo_save); + } RETURNFUNC(retcode); } @@ -1924,6 +1943,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) { // if we're in PTT don't get VFOA freq -- otherwise we interrupt transmission ptt_t ptt; + TRACE; retcode = rig_get_ptt(rig, RIG_VFO_CURR, &ptt); if (retcode != RIG_OK) @@ -1983,6 +2003,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) rig_strvfo(vfo)); } + TRACE; retcode = caps->get_freq(rig, vfo, freq); cache_show(rig, __func__, __LINE__); @@ -2012,6 +2033,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) RETURNFUNC(-RIG_ENAVAIL); } + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -2021,6 +2043,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) cache_show(rig, __func__, __LINE__); + TRACE; retcode = caps->get_freq(rig, vfo, freq); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -2127,6 +2150,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_mode(rig, vfo, mode, width); rig_debug(RIG_DEBUG_TRACE, "%s: targetable retcode after set_mode=%d\n", __func__, @@ -2145,6 +2169,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -2245,6 +2270,7 @@ int HAMLIB_API rig_get_mode(RIG *rig, || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_mode(rig, vfo, mode, width); rig_debug(RIG_DEBUG_TRACE, "%s: retcode after get_mode=%d\n", __func__, retcode); @@ -2263,6 +2289,7 @@ int HAMLIB_API rig_get_mode(RIG *rig, curr_vfo = rig->state.current_vfo; rig_debug(RIG_DEBUG_TRACE, "%s(%d): vfo=%s, curr_vfo=%s\n", __func__, __LINE__, rig_strvfo(vfo), rig_strvfo(curr_vfo)); + TRACE; retcode = caps->set_vfo(rig, vfo == RIG_VFO_CURR ? RIG_VFO_A : vfo); cache_show(rig, __func__, __LINE__); @@ -2272,6 +2299,7 @@ int HAMLIB_API rig_get_mode(RIG *rig, RETURNFUNC(retcode); } + TRACE; retcode = caps->get_mode(rig, vfo, mode, width); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -2523,6 +2551,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) RIG_OK); // would be better as error but other software won't handle errors } + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode == RIG_OK) @@ -2543,6 +2572,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) // we only get the freq if we set the vfo OK if (retcode == RIG_OK && caps->get_freq) { + TRACE; retcode = caps->get_freq(rig, vfo, &curr_freq); rig_debug(RIG_DEBUG_TRACE, "%s: retcode from rig_get_freq = %.10000s\n", __func__, @@ -2628,6 +2658,7 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) rig_debug(RIG_DEBUG_TRACE, "%s: cache miss age=%dms\n", __func__, cache_ms); } + TRACE; retcode = caps->get_vfo(rig, vfo); if (retcode == RIG_OK) @@ -2704,6 +2735,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) do { + TRACE; retcode = caps->set_ptt(rig, vfo, ptt); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -2743,6 +2775,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode == RIG_OK) @@ -2753,6 +2786,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) do { + TRACE; retcode = caps->set_ptt(rig, vfo, ptt); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -2769,6 +2803,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) while (tptt != ptt && retry-- > 0 && retcode == RIG_OK); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); /* return the first error code */ @@ -2969,6 +3004,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -2986,6 +3022,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -2993,6 +3030,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) RETURNFUNC(retcode); } + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -3010,6 +3048,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) case RIG_PTT_SERIAL_RTS: if (caps->get_ptt) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -3041,6 +3080,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) case RIG_PTT_SERIAL_DTR: if (caps->get_ptt) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -3072,6 +3112,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) case RIG_PTT_PARALLEL: if (caps->get_ptt) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -3096,6 +3137,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) case RIG_PTT_CM108: if (caps->get_ptt) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -3121,6 +3163,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) case RIG_PTT_GPION: if (caps->get_ptt) { + TRACE; retcode = caps->get_ptt(rig, vfo, ptt); if (retcode == RIG_OK) @@ -3191,6 +3234,7 @@ int HAMLIB_API rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_dcd(rig, vfo, dcd); RETURNFUNC(retcode); } @@ -3201,6 +3245,7 @@ int HAMLIB_API rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -3208,6 +3253,7 @@ int HAMLIB_API rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) RETURNFUNC(retcode); } + TRACE; retcode = caps->get_dcd(rig, vfo, dcd); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -3295,6 +3341,7 @@ int HAMLIB_API rig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_rptr_shift(rig, vfo, rptr_shift); RETURNFUNC(retcode); } @@ -3305,6 +3352,7 @@ int HAMLIB_API rig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -3312,6 +3360,7 @@ int HAMLIB_API rig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) RETURNFUNC(retcode); } + TRACE; retcode = caps->set_rptr_shift(rig, vfo, rptr_shift); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -3368,6 +3417,7 @@ int HAMLIB_API rig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_rptr_shift(rig, vfo, rptr_shift); RETURNFUNC(retcode); } @@ -3378,6 +3428,7 @@ int HAMLIB_API rig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -3385,7 +3436,8 @@ int HAMLIB_API rig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) RETURNFUNC(retcode); } - retcode = caps->get_rptr_shift(rig, vfo, rptr_shift); + TRACE; + retcode = caps->get_rptr_shift(rig, vfo, rptr_shift); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -3436,6 +3488,7 @@ int HAMLIB_API rig_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_rptr_offs(rig, vfo, rptr_offs); RETURNFUNC(retcode); } @@ -3446,6 +3499,7 @@ int HAMLIB_API rig_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -3509,6 +3563,7 @@ int HAMLIB_API rig_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_rptr_offs(rig, vfo, rptr_offs); RETURNFUNC(retcode); } @@ -3519,6 +3574,7 @@ int HAMLIB_API rig_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -3585,6 +3641,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) || vfo == RIG_VFO_TX || tx_vfo == rig->state.current_vfo)) { + TRACE; retcode = caps->set_split_freq(rig, vfo, tx_freq); RETURNFUNC(retcode); } @@ -3602,6 +3659,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) do { + TRACE; retcode = rig_set_freq(rig, tx_vfo, tx_freq); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -3619,6 +3677,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) if (caps->set_vfo) { + TRACE; retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) @@ -3643,11 +3702,13 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) // doing get_freq seems to break on some rigs that can't read freq immediately after set if (caps->set_split_freq) { + TRACE; retcode = caps->set_split_freq(rig, vfo, tx_freq); //rig_get_freq(rig, vfo, &tfreq); } else { + TRACE; retcode = rig_set_freq(rig, RIG_VFO_CURR, tx_freq); //rig_get_freq(rig, vfo, &tfreq); } @@ -3659,6 +3720,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) /* try and revert even if we had an error above */ if (caps->set_vfo) { + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); } else @@ -3717,6 +3779,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) { + TRACE; retcode = caps->get_split_freq(rig, vfo, tx_freq); RETURNFUNC(retcode); } @@ -3736,6 +3799,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (caps->get_freq && (caps->targetable_vfo & RIG_TARGETABLE_FREQ)) { + TRACE; retcode = caps->get_freq(rig, tx_vfo, tx_freq); RETURNFUNC(retcode); } @@ -3746,6 +3810,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) // if the underlying rig has OP_XCHG we don't need to set VFO if (!rig_has_vfo_op(rig, RIG_OP_XCHG)) { + TRACE; retcode = caps->set_vfo(rig, tx_vfo); if (retcode != RIG_OK) { RETURNFUNC(retcode); } @@ -3769,10 +3834,12 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (caps->get_split_freq) { + TRACE; retcode = caps->get_split_freq(rig, vfo, tx_freq); } else { + TRACE; retcode = caps->get_freq(rig, RIG_VFO_CURR, tx_freq); } @@ -3785,6 +3852,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) rig_debug(RIG_DEBUG_TRACE, "%s: restoring vfo=%s\n", __func__, rig_strvfo(save_vfo)); + TRACE; rc2 = caps->set_vfo(rig, save_vfo); } else @@ -3845,6 +3913,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) { + TRACE; retcode = caps->set_split_mode(rig, vfo, tx_mode, tx_width); RETURNFUNC(retcode); } @@ -3864,6 +3933,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, if (caps->set_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) { + TRACE; retcode = caps->set_mode(rig, tx_vfo, tx_mode, tx_width); RETURNFUNC(retcode); } @@ -3871,6 +3941,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, if (caps->set_vfo) { + TRACE; retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) @@ -3890,16 +3961,19 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, if (caps->set_split_mode) { + TRACE; retcode = caps->set_split_mode(rig, vfo, tx_mode, tx_width); } else { + TRACE; retcode = caps->set_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); } /* try and revert even if we had an error above */ if (caps->set_vfo) { + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); } else @@ -3962,6 +4036,7 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, || vfo == RIG_VFO_TX || vfo == rig->state.current_vfo)) { + TRACE; retcode = caps->get_split_mode(rig, vfo, tx_mode, tx_width); RETURNFUNC(retcode); } @@ -3981,6 +4056,7 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, if (caps->get_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) { + TRACE; retcode = caps->get_mode(rig, tx_vfo, tx_mode, tx_width); RETURNFUNC(retcode); } @@ -3988,10 +4064,12 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, if (caps->set_vfo) { + TRACE; retcode = caps->set_vfo(rig, tx_vfo); } else if (rig_has_vfo_op(rig, RIG_OP_TOGGLE) && caps->vfo_op) { + TRACE; retcode = caps->vfo_op(rig, vfo, RIG_OP_TOGGLE); } else @@ -4006,16 +4084,19 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, if (caps->get_split_mode) { + TRACE; retcode = caps->get_split_mode(rig, vfo, tx_mode, tx_width); } else { + TRACE; retcode = caps->get_mode(rig, RIG_VFO_CURR, tx_mode, tx_width); } /* try and revert even if we had an error above */ if (caps->set_vfo) { + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); } else @@ -4095,6 +4176,7 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig, int retcode2; #endif + TRACE; retcode = caps->set_split_freq_mode(rig, vfo, tx_freq, tx_mode, tx_width); #if 0 // this verification seems to be causing bad behavior on some reigs @@ -4126,11 +4208,13 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig, } else { + TRACE; retcode = rig_set_split_freq(rig, vfo, tx_freq); } if (RIG_OK == retcode) { + TRACE; retcode = rig_set_split_mode(rig, vfo, tx_mode, tx_width); } @@ -4188,14 +4272,17 @@ int HAMLIB_API rig_get_split_freq_mode(RIG *rig, if (caps->get_split_freq_mode) { + TRACE; retcode = caps->get_split_freq_mode(rig, vfo, tx_freq, tx_mode, tx_width); return retcode; } + TRACE; retcode = rig_get_split_freq(rig, vfo, tx_freq); if (RIG_OK == retcode) { + TRACE; retcode = rig_get_split_mode(rig, vfo, tx_mode, tx_width); } @@ -4246,6 +4333,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig, if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_split_vfo(rig, vfo, split, tx_vfo); if (retcode == RIG_OK) @@ -4265,6 +4353,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig, } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4272,6 +4361,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig, RETURNFUNC(retcode); } + TRACE; retcode = caps->set_split_vfo(rig, vfo, split, tx_vfo); /* try and revert even if we had an error above */ @@ -4374,6 +4464,7 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig, if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_split_vfo(rig, vfo, split, tx_vfo); rig->state.cache.split = *split; rig->state.cache.split_vfo = *tx_vfo; @@ -4397,6 +4488,7 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig, #endif + TRACE; retcode = caps->get_split_vfo(rig, vfo, split, tx_vfo); #if 0 // see above /* try and revert even if we had an error above */ @@ -4459,6 +4551,7 @@ int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_rit(rig, vfo, rit); RETURNFUNC(retcode); } @@ -4469,6 +4562,7 @@ int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4533,6 +4627,7 @@ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_rit(rig, vfo, rit); RETURNFUNC(retcode); } @@ -4543,6 +4638,7 @@ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4550,6 +4646,7 @@ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) RETURNFUNC(retcode); } + TRACE; retcode = caps->get_rit(rig, vfo, rit); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -4602,6 +4699,7 @@ int HAMLIB_API rig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_xit(rig, vfo, xit); RETURNFUNC(retcode); } @@ -4612,6 +4710,7 @@ int HAMLIB_API rig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4676,6 +4775,7 @@ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_xit(rig, vfo, xit); RETURNFUNC(retcode); } @@ -4686,6 +4786,7 @@ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4693,6 +4794,7 @@ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) RETURNFUNC(retcode); } + TRACE; retcode = caps->get_xit(rig, vfo, xit); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -4744,6 +4846,7 @@ int HAMLIB_API rig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_ts(rig, vfo, ts); RETURNFUNC(retcode); } @@ -4754,6 +4857,7 @@ int HAMLIB_API rig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4761,6 +4865,7 @@ int HAMLIB_API rig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) RETURNFUNC(retcode); } + TRACE; retcode = caps->set_ts(rig, vfo, ts); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -4817,6 +4922,7 @@ int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) if (vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_ts(rig, vfo, ts); RETURNFUNC(retcode); } @@ -4827,6 +4933,7 @@ int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4834,6 +4941,7 @@ int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) RETURNFUNC(retcode); } + TRACE; retcode = caps->get_ts(rig, vfo, ts); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -4891,6 +4999,7 @@ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->set_ant(rig, vfo, ant, option); RETURNFUNC(retcode); } @@ -4901,6 +5010,7 @@ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4908,6 +5018,7 @@ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) RETURNFUNC(retcode); } + TRACE; retcode = caps->set_ant(rig, vfo, ant, option); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -4972,6 +5083,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, || vfo == RIG_VFO_CURR || vfo == rig->state.current_vfo) { + TRACE; retcode = caps->get_ant(rig, vfo, ant, option, ant_curr, ant_tx, ant_rx); RETURNFUNC(retcode); } @@ -4982,6 +5094,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -4989,6 +5102,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, RETURNFUNC(retcode); } + TRACE; retcode = caps->get_ant(rig, vfo, ant, option, ant_curr, ant_tx, ant_rx); /* try and revert even if we had an error above */ rc2 = caps->set_vfo(rig, curr_vfo); @@ -5193,6 +5307,7 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) RETURNFUNC(-RIG_ENAVAIL); } + TRACE; retcode = rig->caps->set_powerstat(rig, status); RETURNFUNC(retcode); } @@ -5233,6 +5348,7 @@ int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status) RETURNFUNC(-RIG_ENAVAIL); } + TRACE; retcode = rig->caps->get_powerstat(rig, status); RETURNFUNC(retcode); } @@ -5421,6 +5537,7 @@ int HAMLIB_API rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5430,6 +5547,7 @@ int HAMLIB_API rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) retcode = caps->vfo_op(rig, vfo, op); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5524,6 +5642,7 @@ int HAMLIB_API rig_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5533,6 +5652,7 @@ int HAMLIB_API rig_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) retcode = caps->scan(rig, vfo, scan, ch); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5597,6 +5717,7 @@ int HAMLIB_API rig_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5606,6 +5727,7 @@ int HAMLIB_API rig_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) retcode = caps->send_dtmf(rig, vfo, digits); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5671,6 +5793,7 @@ int HAMLIB_API rig_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5680,6 +5803,7 @@ int HAMLIB_API rig_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) retcode = caps->recv_dtmf(rig, vfo, digits, length); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5744,6 +5868,7 @@ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5753,6 +5878,7 @@ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg) retcode = caps->send_morse(rig, vfo, msg); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5802,6 +5928,7 @@ int HAMLIB_API rig_stop_morse(RIG *rig, vfo_t vfo) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5811,6 +5938,7 @@ int HAMLIB_API rig_stop_morse(RIG *rig, vfo_t vfo) retcode = caps->stop_morse(rig, vfo); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5843,6 +5971,7 @@ static int wait_morse_ptt(RIG *rig, vfo_t vfo) rig_debug(RIG_DEBUG_TRACE, "%s: loop#%d until ptt=0, ptt=%d\n", __func__, loops, pttStatus); elapsed_ms(&rig->state.cache.time_ptt, HAMLIB_ELAPSED_INVALIDATE); + TRACE; retval = rig_get_ptt(rig, vfo, &pttStatus); if (retval != RIG_OK) @@ -5892,6 +6021,7 @@ int HAMLIB_API rig_wait_morse(RIG *rig, vfo_t vfo) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5901,6 +6031,7 @@ int HAMLIB_API rig_wait_morse(RIG *rig, vfo_t vfo) retcode = wait_morse_ptt(rig, vfo); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -5960,6 +6091,7 @@ int HAMLIB_API rig_send_voice_mem(RIG *rig, vfo_t vfo, int ch) } curr_vfo = rig->state.current_vfo; + TRACE; retcode = caps->set_vfo(rig, vfo); if (retcode != RIG_OK) @@ -5969,6 +6101,7 @@ int HAMLIB_API rig_send_voice_mem(RIG *rig, vfo_t vfo, int ch) retcode = caps->send_voice_mem(rig, vfo, ch); /* try and revert even if we had an error above */ + TRACE; rc2 = caps->set_vfo(rig, curr_vfo); if (RIG_OK == retcode) @@ -6036,6 +6169,7 @@ int HAMLIB_API rig_set_vfo_opt(RIG *rig, int status) RETURNFUNC(-RIG_ENAVAIL); } + TRACE; retcode = rig->caps->set_vfo_opt(rig, status); RETURNFUNC(retcode); } @@ -6063,6 +6197,7 @@ const char *HAMLIB_API rig_get_info(RIG *rig) return (NULL); } + TRACE; return (rig->caps->get_info(rig)); } @@ -6100,6 +6235,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, // we can't use the cached values as some clients may only call this function // like Log4OM which mostly does polling + TRACE; retval = rig_get_freq(rig, vfo, freq); if (retval != RIG_OK) { RETURNFUNC(retval); } @@ -6114,6 +6250,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, if (allTheTimeA || allTheTimeB || justOnceB) { + TRACE; retval = rig_get_mode(rig, vfo, mode, width); if (retval != RIG_OK) { RETURNFUNC(retval); } @@ -6125,6 +6262,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, } // we should only need to ask for VFO_CURR to minimize display swapping + TRACE; retval = rig_get_split(rig, RIG_VFO_CURR, split); if (retval != RIG_OK) { RETURNFUNC(retval); }