[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. f8db0b2a367f1233aeaca
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-09-20 04:57:20
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via f8db0b2a367f1233aeaca39820d6bbbdf25e024d (commit) via e5aa78c3960c7a197ee86248aa9f18ae9b4fc6ae (commit) via 2a93553e58a3c801d7d7d2f7700b600abbee8516 (commit) via d9e1f5aac479abda13950dfed68f286cd7f4af4a (commit) via 82785f81dc0427d4641d6137b73f0a6547c78590 (commit) via f029769fb7e3663dc56817e3fa6bf27956f2e956 (commit) via 912bfb4d5b510b08493cb18895dfcd7a0dd78eb5 (commit) via 1cdc387bc431edcbe87b9b2fe592e5f20e236d0e (commit) via 63240f16713082a933bf9af5f018c3c59ae30e60 (commit) via e49693af0859a55e003177f0a582f4ae81a1997e (commit) via c2117ce140fd1ee37f5a8e040c628dc0c92b4a6e (commit) via be3d79ce19da5a639252c3595dec9f1016110cb2 (commit) via 696a55a96866fce2d0456a9877a6d6bf7be3ad97 (commit) via 1586a92b63be3de34bd1689e9c565112f8b99e2c (commit) via f01a9647d075561d2ee6468bed052cf2d4b50b5d (commit) via 17bbd2f6029e37fc77050d68bdbe7bed1a97f2ae (commit) via e81ad71221de8459dde25eeebef406765ffc0619 (commit) via 345729421d2b7a19c8f83ffe1a43f5d79855e671 (commit) via 7d605c86bdd9d0bf454ced8ae12cc242add6fa4b (commit) via 759cbbed3beda49b4ee2f9591b8240ba724c86cc (commit) via 90f27ac7aa7a24eeda2c6ca19297f8ad9544c5fd (commit) via 34492271bc21c307a5ffbbeff0fbf016fdf8db83 (commit) from ca43bf50da6e8e50f747865ff1a311496943b6b6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f8db0b2a367f1233aeaca39820d6bbbdf25e024d Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Sep 19 23:56:38 2021 -0500 Fix FTDX9000 METER readings https://github.com/Hamlib/Hamlib/issues/755 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index 1f022cc8..6d9c6ed6 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -3740,7 +3740,7 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) switch (val.i) { - case RIG_METER_ALC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 1); + case RIG_METER_ALC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 7 : 1); break; case RIG_METER_PO: @@ -3750,21 +3750,21 @@ int newcat_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val) } else { - snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 2); + snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 8 : 2); } break; - case RIG_METER_SWR: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 3); + case RIG_METER_SWR: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 9 : 3); break; - case RIG_METER_COMP: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 0); + case RIG_METER_COMP: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 6 : 0); break; - case RIG_METER_IC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 4); + case RIG_METER_IC: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 10: 4); break; - case RIG_METER_VDD: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, 5); + case RIG_METER_VDD: snprintf(priv->cmd_str, sizeof(priv->cmd_str), format, is_ftdx9000? 11 : 5); break; rig_debug(RIG_DEBUG_ERR, "%s: unknown val.i=%d\n", __func__, val.i); commit e5aa78c3960c7a197ee86248aa9f18ae9b4fc6ae Author: Mike Black W9MDB <mdb...@ya...> Date: Sun Sep 19 23:49:06 2021 -0500 Fix FTDX9000 METER_TEMP Change return codes for meters to RIG_ENAVAIL https://github.com/Hamlib/Hamlib/issues/755 diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index c910ecd1..1f022cc8 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -4647,7 +4647,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } else { - RETURNFUNC(-RIG_EINVAL); + RETURNFUNC(-RIG_ENAVAIL); } break; @@ -4691,7 +4691,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) case RIG_LEVEL_TEMP_METER: if (is_ftdx9000) { - snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM11%c", cat_term); + snprintf(priv->cmd_str, sizeof(priv->cmd_str), "RM14%c", cat_term); } else if (is_ftdx101d || is_ftdx101mp) { @@ -4699,7 +4699,7 @@ int newcat_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val) } else { - RETURNFUNC(-RIG_EINVAL); + RETURNFUNC(-RIG_ENAVAIL); } break; diff --git a/rigs/yaesu/newcat.h b/rigs/yaesu/newcat.h index e71f9ba7..e4c12664 100644 --- a/rigs/yaesu/newcat.h +++ b/rigs/yaesu/newcat.h @@ -50,7 +50,7 @@ typedef char ncboolean; /* shared function version */ -#define NEWCAT_VER "20210805" +#define NEWCAT_VER "20210919" /* Hopefully large enough for future use, 128 chars plus '\0' */ #define NEWCAT_DATA_LEN 129 commit 2a93553e58a3c801d7d7d2f7700b600abbee8516 Merge: 912bfb4d d9e1f5aa Author: Michael Black <mdb...@ya...> Date: Sun Sep 19 16:15:06 2021 -0500 Merge pull request #801 from wutje/improve_rig Improve rig.c checks and documentation commit d9e1f5aac479abda13950dfed68f286cd7f4af4a Author: Wouter van Gulik <pa...@gm...> Date: Sun Sep 19 22:52:41 2021 +0200 Fix and document rig_cookie; Example in doxygen was wrong. Description of parameters was wrong; we return an int so we cannot return a NULL. NULL check for cookies is needed for all 3 commands so move it up, fixing the missing one. Length check was wrong; cookie needs to be at least as large as HAMLIB_COOKIE_SIZE otherwise subsequent checks will always faila Document the 3 cookie commands a bit. diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 4ab36850..a649a448 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -98,7 +98,7 @@ constant from a constant number literal using ull */ // #define CONSTANT_64BIT_FLAG(BIT) (1 << (BIT)) // #define SWIGLUAHIDE -/* But this appears to have been fixed so we'll use the correct one now +/* But this appears to have been fixed so we'll use the correct one now If you have the older version of SWIG comment out this line and use the two above */ // This 1ul definition works on swig 4.0.1 and lua 5.3.5 @@ -774,7 +774,7 @@ typedef enum { /** * \brief Antenna number * \def RIG_ANT_NONE - * No antenna set yet or unknown + * No antenna set yet or unknown */ /** * \brief Antenna conversion macro @@ -1000,9 +1000,9 @@ enum rig_parm_e { * */ enum cookie_e { - RIG_COOKIE_GET, - RIG_COOKIE_RELEASE, - RIG_COOKIE_RENEW, + RIG_COOKIE_GET, /*!< Setup a cookie */ + RIG_COOKIE_RELEASE, /*!< Release a cookie */ + RIG_COOKIE_RENEW, /*!< Renew a cookie */ }; /** @@ -1769,7 +1769,7 @@ struct rig_caps { // As of 2020-02-12 we know of 5 models from Icom USA, EUR, ITR, TPE, KOR for the IC-9700 // So we currently have 5 ranges we need to deal with // The backend for the model should fill in the label field to explain what model it is - // The the IC-9700 in ic7300.c for an example + // The the IC-9700 in ic7300.c for an example freq_range_t rx_range_list1[HAMLIB_FRQRANGESIZ]; /*!< Receive frequency range list #1 */ freq_range_t tx_range_list1[HAMLIB_FRQRANGESIZ]; /*!< Transmit frequency range list #1 */ freq_range_t rx_range_list2[HAMLIB_FRQRANGESIZ]; /*!< Receive frequency range list #2 */ @@ -2210,7 +2210,7 @@ typedef enum { /** * \brief Rig cache data - * + * * This struct contains all the items we cache at the highest level */ struct rig_cache { @@ -2230,7 +2230,7 @@ struct rig_cache { freq_t freqSubA; // VFO_SUBA -- only for rigs with dual Sub VFOs freq_t freqSubB; // VFO_SUBB -- only for rigs with dual Sub VFOs freq_t freqSubC; // VFO_SUBC -- only for rigs with 3 Sub VFOs - freq_t freqMem; // VFO_MEM -- last MEM channel + freq_t freqMem; // VFO_MEM -- last MEM channel rmode_t modeMainA; rmode_t modeMainB; rmode_t modeMainC; @@ -2347,7 +2347,7 @@ struct rig_state { pbwidth_t current_width; /*!< Passband width currently set */ vfo_t tx_vfo; /*!< Tx VFO currently set */ rmode_t mode_list; /*!< Complete list of modes for this rig */ - // mode_list is used by some + // mode_list is used by some // so anything added to this structure must be below here int transmit; /*!< rig should be transmitting i.e. hard wired PTT asserted - used by rigs that @@ -2501,10 +2501,10 @@ rig_get_vfo HAMLIB_PARAMS((RIG *rig, extern HAMLIB_EXPORT(int) rig_get_vfo_info HAMLIB_PARAMS((RIG *rig, - vfo_t vfo, - freq_t *freq, - rmode_t *mode, - pbwidth_t *width, + vfo_t vfo, + freq_t *freq, + rmode_t *mode, + pbwidth_t *width, split_t *split, int *satmode)); @@ -2904,30 +2904,30 @@ rig_has_scan HAMLIB_PARAMS((RIG *rig, scan_t scan)); extern HAMLIB_EXPORT(int) -rig_set_channel HAMLIB_PARAMS((RIG *rig, +rig_set_channel HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const channel_t *chan)); /* mem */ extern HAMLIB_EXPORT(int) -rig_get_channel HAMLIB_PARAMS((RIG *rig, +rig_get_channel HAMLIB_PARAMS((RIG *rig, vfo_t vfo, channel_t *chan, int read_only)); extern HAMLIB_EXPORT(int) -rig_set_chan_all HAMLIB_PARAMS((RIG *rig, +rig_set_chan_all HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const channel_t chans[])); extern HAMLIB_EXPORT(int) -rig_get_chan_all HAMLIB_PARAMS((RIG *rig, +rig_get_chan_all HAMLIB_PARAMS((RIG *rig, vfo_t vfo, channel_t chans[])); extern HAMLIB_EXPORT(int) -rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, +rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) -rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, +rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t)); @@ -2939,7 +2939,7 @@ rig_set_mem_all_cb HAMLIB_PARAMS((RIG *rig, confval_cb_t parm_cb, rig_ptr_t)); extern HAMLIB_EXPORT(int) -rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, +rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, vfo_t vfo, chan_cb_t chan_cb, confval_cb_t parm_cb, diff --git a/src/rig.c b/src/rig.c index 2763a839..3ef58153 100644 --- a/src/rig.c +++ b/src/rig.c @@ -6763,17 +6763,27 @@ const char *HAMLIB_API rig_copyright() /** * \brief get a cookie to grab rig control + * \param rig Not used + * \param cookie_cmd The command to execute on \a cookie. + * \param cookie The cookie to operate on, cannot be NULL or RIG_EINVAL will be returned. + * \param cookie_len The length of the cookie, must be #HAMLIB_COOKIE_SIZE or larger. + * + * #RIG_COOKIE_GET will set \a cookie with a cookie. + * #RIG_COOKIE_RENEW will update the timeout with 1 second. + * #RIG_COOKIE_RELEASE will release the cookie and allow a new one to be grabbed. * - * RIG_COOKIE_GET must have cookie=NULL or NULL returned - * RIG_COOKIE_RENEW must have cookie!=NULL or NULL returned - * RIG_COOKIE_RELEASE must have cookie!=NULL or NULL returned; * Cookies should only be used when needed to keep commands sequenced correctly * For example, when setting both VFOA and VFOB frequency and mode * Example to wait for cookie, do rig commands, and release - * while((cookie=rig_cookie(NULL, RIG_COOKIE_GET)) == NULL) hl_usleep(10*1000); - * set_freq A;set mode A;set freq B;set modeB; - * rig_cookie(cookie,RIG_COOKIE_RELEASE); - * if wait!=0 rig_cookie with RIG_COOKIE_GET will wait for the cookie to become available + * \code + * while((rig_cookie(NULL, RIG_COOKIE_GET, cookie, sizeof(cookie))) != RIG_OK) + * hl_usleep(10*1000); + * + * //Pseudo code + * set_freq A;set mode A;set freq B;set modeB; + * + * rig_cookie(NULL, RIG_COOKIE_RELEASE, cookie, sizeof(cookie))); + * \endcode */ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, int cookie_len) @@ -6791,27 +6801,27 @@ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, static pthread_mutex_t cookie_lock = PTHREAD_MUTEX_INITIALIZER; #endif - if (cookie_len < 27) + if (cookie_len < HAMLIB_COOKIE_SIZE) { - rig_debug(RIG_DEBUG_ERR, "%s(%d): cookie_len < 32 so returning NULL!!\n", - __FILE__, __LINE__); - return -RIG_EINTERNAL; + rig_debug(RIG_DEBUG_ERR, "%s(%d): cookie_len < %d\n", + __FILE__, __LINE__, HAMLIB_COOKIE_SIZE); + return -RIG_EINVAL; + } + + if (!cookie) + { + rig_debug(RIG_DEBUG_ERR, "%s(%d): cookie == NULL\n", + __FILE__, __LINE__); + return -RIG_EINVAL; // nothing to do } switch (cookie_cmd) { case RIG_COOKIE_RELEASE: - if (cookie == NULL) - { - rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): coookie NULL so nothing to do\n", - __FILE__, __LINE__); - return -RIG_EINVAL; // nothing to do - } - if (cookie_save[0] != 0 && strcmp(cookie, cookie_save) == 0) // matching cookie so we'll clear it { - rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %s coookie released\n", + rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): %s cookie released\n", __FILE__, __LINE__, cookie_save); memset(cookie_save, 0, sizeof(cookie_save)); return RIG_OK; @@ -6894,7 +6904,7 @@ int HAMLIB_API rig_cookie(RIG *rig, enum cookie_e cookie_cmd, char *cookie, break; } - rig_debug(RIG_DEBUG_ERR, "%s(%d): unknown condition!!\n'", __FILE__, __LINE__); + rig_debug(RIG_DEBUG_ERR, "%s(%d): unknown cmd!!\n'", __FILE__, __LINE__); return -RIG_EPROTO; } commit 82785f81dc0427d4641d6137b73f0a6547c78590 Author: Wouter van Gulik <pa...@gm...> Date: Sun Sep 19 22:18:03 2021 +0200 Replace RIG_EIO with RIG_EINVAL when checking arguments. RIG == NULL is an argument error. A rig not properly inited (caps == NULL) is also an invalid argument. diff --git a/src/rig.c b/src/rig.c index 36907309..2763a839 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1344,7 +1344,7 @@ int HAMLIB_API rig_set_twiddle(RIG *rig, int seconds) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } rig->state.twiddle_timeout = seconds; @@ -1369,7 +1369,7 @@ int HAMLIB_API rig_set_uplink(RIG *rig, int val) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } rig->state.uplink = val; @@ -1395,7 +1395,7 @@ int HAMLIB_API rig_get_twiddle(RIG *rig, int *seconds) if (CHECK_RIG_ARG(rig) || !seconds) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } *seconds = rig->state.twiddle_timeout; @@ -1809,7 +1809,7 @@ int HAMLIB_API rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (rig->state.twiddle_state == TWIDDLE_ON) @@ -2008,7 +2008,7 @@ int HAMLIB_API rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!freq) @@ -2252,7 +2252,7 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } // do not mess with mode while PTT is on @@ -2354,7 +2354,7 @@ int HAMLIB_API rig_get_mode(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!mode || !width) @@ -2654,7 +2654,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } vfo = vfo_fixup(rig, vfo, rig->state.cache.split); @@ -2779,7 +2779,7 @@ int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo) if (CHECK_RIG_ARG(rig) || !vfo) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!vfo) @@ -2859,7 +2859,7 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -3149,7 +3149,7 @@ int HAMLIB_API rig_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!ptt) @@ -3415,7 +3415,7 @@ int HAMLIB_API rig_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!dcd) @@ -3530,7 +3530,7 @@ int HAMLIB_API rig_set_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -3601,7 +3601,7 @@ int HAMLIB_API rig_get_rptr_shift(RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!rptr_shift) @@ -3677,7 +3677,7 @@ int HAMLIB_API rig_set_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t rptr_offs) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -3747,7 +3747,7 @@ int HAMLIB_API rig_get_rptr_offs(RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!rptr_offs) @@ -3820,7 +3820,7 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } @@ -3973,7 +3973,7 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!tx_freq) @@ -4125,7 +4125,7 @@ int HAMLIB_API rig_set_split_mode(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } // do not mess with mode while PTT is on @@ -4253,7 +4253,7 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!tx_mode || !tx_width) @@ -4389,7 +4389,7 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -4504,7 +4504,7 @@ int HAMLIB_API rig_get_split_freq_mode(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!tx_freq || !tx_mode || !tx_width) @@ -4564,7 +4564,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -4694,7 +4694,7 @@ int HAMLIB_API rig_get_split_vfo(RIG *rig, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!split || !tx_vfo) @@ -4816,7 +4816,7 @@ int HAMLIB_API rig_set_rit(RIG *rig, vfo_t vfo, shortfreq_t rit) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -4887,7 +4887,7 @@ int HAMLIB_API rig_get_rit(RIG *rig, vfo_t vfo, shortfreq_t *rit) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!rit) @@ -4964,7 +4964,7 @@ int HAMLIB_API rig_set_xit(RIG *rig, vfo_t vfo, shortfreq_t xit) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -5035,7 +5035,7 @@ int HAMLIB_API rig_get_xit(RIG *rig, vfo_t vfo, shortfreq_t *xit) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!xit) @@ -5112,7 +5112,7 @@ int HAMLIB_API rig_set_ts(RIG *rig, vfo_t vfo, shortfreq_t ts) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -5183,7 +5183,7 @@ int HAMLIB_API rig_get_ts(RIG *rig, vfo_t vfo, shortfreq_t *ts) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!ts) @@ -5264,7 +5264,7 @@ int HAMLIB_API rig_set_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t option) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -5344,7 +5344,7 @@ int HAMLIB_API rig_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (ant_curr == NULL || ant_tx == NULL || ant_rx == NULL) @@ -5586,7 +5586,7 @@ int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (rig->caps->set_powerstat == NULL) @@ -5623,7 +5623,7 @@ int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!status) @@ -5664,7 +5664,7 @@ int HAMLIB_API rig_reset(RIG *rig, reset_t reset) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (rig->caps->reset == NULL) @@ -5802,7 +5802,7 @@ int HAMLIB_API rig_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -5906,7 +5906,7 @@ int HAMLIB_API rig_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -5977,7 +5977,7 @@ int HAMLIB_API rig_send_dtmf(RIG *rig, vfo_t vfo, const char *digits) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!digits) @@ -6053,7 +6053,7 @@ int HAMLIB_API rig_recv_dtmf(RIG *rig, vfo_t vfo, char *digits, int *length) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!digits || !length) @@ -6128,7 +6128,7 @@ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } if (!msg) @@ -6366,7 +6366,7 @@ int HAMLIB_API rig_send_voice_mem(RIG *rig, vfo_t vfo, int ch) if CHECK_RIG_ARG(rig) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } caps = rig->caps; @@ -6663,7 +6663,7 @@ int HAMLIB_API rig_get_vfo_info(RIG *rig, vfo_t vfo, freq_t *freq, if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } //if (vfo == RIG_VFO_CURR) { vfo = rig->state.current_vfo; } @@ -6724,7 +6724,7 @@ int HAMLIB_API rig_get_vfo_list(RIG *rig, char *buf, int buflen) if (CHECK_RIG_ARG(rig)) { - RETURNFUNC(-RIG_EIO); + RETURNFUNC(-RIG_EINVAL); } rig_sprintf_vfo(buf, buflen - 1, rig->state.vfo_list); commit f029769fb7e3663dc56817e3fa6bf27956f2e956 Author: Wouter van Gulik <pa...@gm...> Date: Sun Sep 19 22:12:21 2021 +0200 Add arguments check for rig_get_cache, rig_stop_morse, rig_wait_morse, rig_get_range, rig_set_vfo_opt, rig_get_infget_info. diff --git a/src/rig.c b/src/rig.c index d85dceb5..36907309 100644 --- a/src/rig.c +++ b/src/rig.c @@ -1596,12 +1596,20 @@ static int set_cache_freq(RIG *rig, vfo_t vfo, freq_t freq) * * \note All pointers must be given. No pointer can be left at NULL * - * \return RIG_OK + * \return RIG_OK if the operation has been successful, otherwise + * a negative value if an error occurred (in which case, cause is + * set appropriately). * */ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq, rmode_t *mode, int *cache_ms_mode, pbwidth_t *width, int *cache_ms_width) { + if (CHECK_RIG_ARG(rig) || !freq || !cache_ms_freq || + !mode || !cache_ms_mode || !width || !cache_ms_width) + { + RETURNFUNC(-RIG_EINVAL); + } + if (rig_need_debug(RIG_DEBUG_CACHE)) { ENTERFUNC; @@ -6189,6 +6197,11 @@ int HAMLIB_API rig_stop_morse(RIG *rig, vfo_t vfo) vfo_t curr_vfo; ENTERFUNC; + if (CHECK_RIG_ARG(rig)) + { + RETURNFUNC(-RIG_EINVAL); + } + caps = rig->caps; if (caps->stop_morse == NULL) @@ -6287,6 +6300,11 @@ int HAMLIB_API rig_wait_morse(RIG *rig, vfo_t vfo) vfo_t curr_vfo; ENTERFUNC; + if (CHECK_RIG_ARG(rig)) + { + RETURNFUNC(-RIG_EINVAL); + } + caps = rig->caps; if (vfo == RIG_VFO_CURR @@ -6413,6 +6431,11 @@ const freq_range_t *HAMLIB_API rig_get_range(const freq_range_t *range_list, { int i; + if (!range_list) + { + return NULL; + } + for (i = 0; i < HAMLIB_FRQRANGESIZ; i++) { if (range_list[i].startf == 0 && range_list[i].endf == 0) @@ -6444,6 +6467,11 @@ int HAMLIB_API rig_set_vfo_opt(RIG *rig, int status) ENTERFUNC; + if CHECK_RIG_ARG(rig) + { + RETURNFUNC(-RIG_EINVAL); + } + if (rig->caps->set_vfo_opt == NULL) { RETURNFUNC(-RIG_ENAVAIL); @@ -6547,6 +6575,11 @@ int HAMLIB_API rig_get_rig_info(RIG *rig, char *response, int max_response_len) int rxa, txa, rxb, txb; response[0] = 0; + if (CHECK_RIG_ARG(rig) || !response) + { + RETURNFUNC(-RIG_EINVAL); + } + vfoA = vfo_fixup(rig, RIG_VFO_A, rig->state.cache.split); vfoB = vfo_fixup(rig, RIG_VFO_B, rig->state.cache.split); ret = rig_get_vfo_info(rig, vfoA, &freqA, &modeA, &widthA, &split, &satmode); commit 912bfb4d5b510b08493cb18895dfcd7a0dd78eb5 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Sep 18 09:36:29 2021 -0500 Promote IC781 to stable diff --git a/rigs/icom/ic781.c b/rigs/icom/ic781.c index 8350ecbb..78359d8a 100644 --- a/rigs/icom/ic781.c +++ b/rigs/icom/ic781.c @@ -66,7 +66,7 @@ const struct rig_caps ic781_caps = .mfg_name = "Icom", .version = BACKEND_VER ".0", .copyright = "LGPL", - .status = RIG_STATUS_UNTESTED, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_NONE, .dcd_type = RIG_DCD_NONE, commit 1cdc387bc431edcbe87b9b2fe592e5f20e236d0e Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Sep 18 08:45:55 2021 -0500 Promote Orion Tentec 599 Eagle to stable diff --git a/rigs/tentec/orion.h b/rigs/tentec/orion.h index b6a09186..baa7dc5e 100644 --- a/rigs/tentec/orion.h +++ b/rigs/tentec/orion.h @@ -415,7 +415,7 @@ RIG_MODEL(RIG_MODEL_TT599), .mfg_name = "Ten-Tec", .version = BACKEND_VER ".0", .copyright = "LGPL", -.status = RIG_STATUS_UNTESTED, +.status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, commit 63240f16713082a933bf9af5f018c3c59ae30e60 Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Sep 18 06:08:16 2021 -0500 Fix rigtestlibusb test_wrapped_device for libusb-1.0.22 or less diff --git a/tests/rigtestlibusb.c b/tests/rigtestlibusb.c index 2dd9d18a..29156cc0 100644 --- a/tests/rigtestlibusb.c +++ b/tests/rigtestlibusb.c @@ -312,13 +312,6 @@ static void print_device(libusb_device *dev, libusb_device_handle *handle) #if defined(ANDROID) && defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION < 0x01000107) #warning LIBUSB-1.0.23 or greater is required for Android devices -static int test_wrapped_device(const char *device_name) -{ - (void)device_name; - printf("Testing wrapped devices is not supported on your platform\n"); - return 1; -} -#else #include <errno.h> #include <fcntl.h> @@ -350,6 +343,13 @@ static int test_wrapped_device(const char *device_name) close(fd); return 0; } +#else +static int test_wrapped_device(const char *device_name) +{ + (void)device_name; + printf("Testing wrapped devices is not supported on your platform\n"); + return 1; +} #endif int main(int argc, char *argv[]) commit e49693af0859a55e003177f0a582f4ae81a1997e Author: Mike Black W9MDB <mdb...@ya...> Date: Sat Sep 18 06:00:35 2021 -0500 Update version in flrig.c to match format of all others diff --git a/rigs/dummy/flrig.c b/rigs/dummy/flrig.c index 9d65fe78..cfcf776e 100644 --- a/rigs/dummy/flrig.c +++ b/rigs/dummy/flrig.c @@ -144,7 +144,7 @@ const struct rig_caps flrig_caps = RIG_MODEL(RIG_MODEL_FLRIG), .model_name = "FLRig", .mfg_name = "FLRig", - .version = "202100914", + .version = "202100914.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, commit c2117ce140fd1ee37f5a8e040c628dc0c92b4a6e Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Sep 17 22:16:10 2021 -0500 Fix Xiegu spelling in x108g.c diff --git a/rigs/icom/x108g.c b/rigs/icom/x108g.c index f8f64208..77b0da69 100644 --- a/rigs/icom/x108g.c +++ b/rigs/icom/x108g.c @@ -8,7 +8,7 @@ * If they do the functions below can go back to the icom routines * #1 the response to PTT * #2 the inability to set_dsp_mode - * #3 setting splie which impacts 3 routines + * #3 setting split which impacts 3 routines * * Copyright (c) 2004-2010 by Stephane Fillod * commit be3d79ce19da5a639252c3595dec9f1016110cb2 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Sep 17 10:09:39 2021 -0500 Change libusb warning in rigtestlibusb.c to Android-only Doesn't appear wrapped usb devices are needed elsewhere diff --git a/tests/rigtestlibusb.c b/tests/rigtestlibusb.c index 660420ec..2dd9d18a 100644 --- a/tests/rigtestlibusb.c +++ b/tests/rigtestlibusb.c @@ -310,7 +310,15 @@ static void print_device(libusb_device *dev, libusb_device_handle *handle) } } -#if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000107) +#if defined(ANDROID) && defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION < 0x01000107) +#warning LIBUSB-1.0.23 or greater is required for Android devices +static int test_wrapped_device(const char *device_name) +{ + (void)device_name; + printf("Testing wrapped devices is not supported on your platform\n"); + return 1; +} +#else #include <errno.h> #include <fcntl.h> @@ -342,14 +350,6 @@ static int test_wrapped_device(const char *device_name) close(fd); return 0; } -#else -#warning LIBUSB-1.0.23 may be required in Hamlib > 4.3 -static int test_wrapped_device(const char *device_name) -{ - (void)device_name; - printf("Testing wrapped devices is not supported on your platform\n"); - return 1; -} #endif int main(int argc, char *argv[]) commit 696a55a96866fce2d0456a9877a6d6bf7be3ad97 Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Sep 17 09:25:50 2021 -0500 Promote FTDX10 to stable diff --git a/rigs/yaesu/ftdx10.c b/rigs/yaesu/ftdx10.c index 4a911768..7d8d3eed 100644 --- a/rigs/yaesu/ftdx10.c +++ b/rigs/yaesu/ftdx10.c @@ -78,7 +78,7 @@ const struct rig_caps ftdx10_caps = .mfg_name = "Yaesu", .version = NEWCAT_VER ".0", .copyright = "LGPL", - .status = RIG_STATUS_ALPHA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_RIG, .dcd_type = RIG_DCD_NONE, commit 1586a92b63be3de34bd1689e9c565112f8b99e2c Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Sep 17 09:01:53 2021 -0500 Prompt FT980 to stable diff --git a/rigs/yaesu/ft980.h b/rigs/yaesu/ft980.h index 181f9e43..09605a52 100644 --- a/rigs/yaesu/ft980.h +++ b/rigs/yaesu/ft980.h @@ -148,7 +148,7 @@ const struct rig_caps ft980_caps = .mfg_name = "Yaesu", .version = "20200114.0", .copyright = "LGPL", - .status = RIG_STATUS_BETA, + .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, .ptt_type = RIG_PTT_SERIAL_RTS, .dcd_type = RIG_DCD_NONE, commit f01a9647d075561d2ee6468bed052cf2d4b50b5d Author: Mike Black W9MDB <mdb...@ya...> Date: Fri Sep 17 09:00:23 2021 -0500 Prompt TenTec Orion to stable diff --git a/rigs/tentec/orion.h b/rigs/tentec/orion.h index 5d2cfb2b..b6a09186 100644 --- a/rigs/tentec/orion.h +++ b/rigs/tentec/orion.h @@ -198,7 +198,7 @@ RIG_MODEL(RIG_MODEL_TT565), .mfg_name = "Ten-Tec", .version = BACKEND_VER ".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_NONE, commit 17bbd2f6029e37fc77050d68bdbe7bed1a97f2ae Author: Mike Black W9MDB <mdb...@ya...> Date: Thu Sep 16 15:57:37 2021 -0500 Update version date in ft817.c diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 03070e48..fbf75c5f 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -300,7 +300,7 @@ const struct rig_caps ft817_caps = RIG_MODEL(RIG_MODEL_FT817), .model_name = "FT-817", .mfg_name = "Yaesu", - .version = "20210911.0", + .version = "20210916.0", .copyright = "LGPL", .status = RIG_STATUS_STABLE, .rig_type = RIG_TYPE_TRANSCEIVER, commit e81ad71221de8459dde25eeebef406765ffc0619 Merge: ca43bf50 34572942 Author: Michael Black <mdb...@ya...> Date: Thu Sep 16 15:55:58 2021 -0500 Merge pull request #799 from wutje/ft817_improvements2 FT817 improve reading of mode/freq. commit 345729421d2b7a19c8f83ffe1a43f5d79855e671 Author: Wouter van Gulik <pa...@gm...> Date: Mon Sep 6 21:49:09 2021 +0200 ft817: Only set the VFO after a successful read. diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 21b059fe..03070e48 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -1370,7 +1370,6 @@ static int ft817_send_icmd(RIG *rig, int index, unsigned char *data) static int ft817_get_vfo(RIG *rig, vfo_t *vfo) { unsigned char c; - *vfo = RIG_VFO_B; rig_debug(RIG_DEBUG_VERBOSE, "%s: called \n", __func__); @@ -1379,7 +1378,14 @@ static int ft817_get_vfo(RIG *rig, vfo_t *vfo) return -RIG_EPROTO; } - if ((c & 0x1) == 0) { *vfo = RIG_VFO_A; } + if ((c & 0x1) == 0) + { + *vfo = RIG_VFO_A; + } + else + { + *vfo = RIG_VFO_B; + } return RIG_OK; } commit 7d605c86bdd9d0bf454ced8ae12cc242add6fa4b Author: Wouter van Gulik <pa...@gm...> Date: Sun Sep 12 22:16:28 2021 +0200 Split on/off is used so drop comment saying it is not yet diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index e45f4d9e..21b059fe 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -39,9 +39,6 @@ * - received ctcss/dcs matched (yes/no flag) TBC * * - TX status command returns info that is not used: - * - split on/off flag; actually this could have been used - * for get_split_vfo, but the flag is valid only when - * PTT is ON. * - high swr flag * * Todo / tocheck list (oz9aec): commit 759cbbed3beda49b4ee2f9591b8240ba724c86cc Author: Wouter van Gulik <pa...@gm...> Date: Wed Sep 8 22:14:34 2021 +0200 ft817.c: Improve get_ptt by fetching TX_STATUS explicitly, instead of doing a manual cache timeout. Also be consistent: if we allow set_ptt to be rejected then also allow get_tx_status en get_ptt to be rejected without failing. Stop settings ptt_response to -1; it is only set when we got a reply so it is a sane value or the default, no need set it again. diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index f53eb299..e45f4d9e 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -1514,22 +1514,33 @@ static int ft817_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt) { int n; n = ft817_send_cmd(rig, index); + if (n < 0 && n != -RIG_ERJCTED) + { + rig_debug(RIG_DEBUG_ERR, "%s: send ptt cmd failed\n", __func__); + return n; + } - rig_force_cache_timeout( - &((struct ft817_priv_data *)rig->state.priv)->tx_status_tv); - + /* Read TX status it contains the PTT flag. + * Use TX_STATUS instead of ft817_get_ptt to skip the cache. */ + n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS); if (n < 0 && n != -RIG_ERJCTED) { + rig_debug(RIG_DEBUG_ERR, "%s: get ptt cmd failed\n", __func__); return n; } - if (ft817_get_ptt(rig, vfo, &ptt_response) != RIG_OK) + /* Should be in cache now! But if above command was rejected + * we will still try again here. */ + n = ft817_get_ptt(rig, vfo, &ptt_response); + if (n < 0 && n != -RIG_ERJCTED) { - ptt_response = -1; + rig_debug(RIG_DEBUG_ERR, "%s: get ptt cmd failed\n", __func__); + return n; } if (ptt_response != ptt) { + rig_debug(RIG_DEBUG_TRACE, "%s: ptt not requested level, retry\n", __func__); hl_usleep(1000l * FT817_RETRY_DELAY); // Wait before next try. Helps with slower rigs cloning FT817 protocol (e.g. MCHF) } commit 90f27ac7aa7a24eeda2c6ca19297f8ad9544c5fd Author: Wouter van Gulik <pa...@gm...> Date: Wed Sep 8 21:36:24 2021 +0200 ft817.c: Use ft817_get_ptt instead of open coding it. diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index 90ca60cf..f53eb299 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -951,22 +951,26 @@ static int ft817_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) static int ft817_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo) { struct ft817_priv_data *p = (struct ft817_priv_data *) rig->state.priv; + ptt_t ptt; int n; rig_debug(RIG_DEBUG_VERBOSE, "%s: called\n", __func__); - if (check_cache_timeout(&p->tx_status_tv)) - if ((n = ft817_get_status(rig, FT817_NATIVE_CAT_GET_TX_STATUS)) < 0) - { - return n; - } + n = ft817_get_ptt(rig, 0, &ptt); + if (n != RIG_OK) + { + return n; + } - if (p->tx_status & 0x80) + /* Check if rig is in TX mode */ + if (ptt == RIG_PTT_OFF) { // TX status not valid when in RX unsigned char c; - if ((n = ft817_read_eeprom(rig, 0x007a, &c)) < 0) /* get split status */ + /* Get split status from EEPROM */ + n = ft817_read_eeprom(rig, 0x7a, &c); + if (n != RIG_OK) { return n; } commit 34492271bc21c307a5ffbbeff0fbf016fdf8db83 Author: Wouter van Gulik <pa...@gm...> Date: Wed Sep 8 21:33:02 2021 +0200 ft817.c: Only get dig mode when needed. This improves getting frequency and mode because we can skip reading EEPROM if not needed. diff --git a/rigs/yaesu/ft817.c b/rigs/yaesu/ft817.c index eda35747..90ca60cf 100644 --- a/rigs/yaesu/ft817.c +++ b/rigs/yaesu/ft817.c @@ -773,14 +773,25 @@ static int ft817_get_status(RIG *rig, int status) { case FT817_NATIVE_CAT_GET_FREQ_MODE_STATUS: { - unsigned char dig_mode; - if ((n = ft817_read_eeprom(rig, 0x0065, &dig_mode)) < 0) + /* Only in digimode we need fetch to extra bits from EEPROM. + * This save communication cycle for all other modes. + * Because mode and frequency are shared this saves also when + * getting the frequency. */ + switch (p->fm_status[4] & 0x7f) { - return n; + unsigned char dig_mode; + case 0x0a: + if ((n = ft817_read_eeprom(rig, 0x0065, &dig_mode)) < 0) + { + return n; + } + + /* Top 3 bit define the digi mode */ + p->dig_mode = dig_mode >> 5; + + default: + break; } - - /* Top 3 bit define the digi mode */ - p->dig_mode = dig_mode >> 5; } break; ----------------------------------------------------------------------- Summary of changes: include/hamlib/rig.h | 40 ++++++------ rigs/dummy/flrig.c | 2 +- rigs/icom/ic781.c | 2 +- rigs/icom/x108g.c | 2 +- rigs/tentec/orion.h | 4 +- rigs/yaesu/ft817.c | 77 ++++++++++++++++------- rigs/yaesu/ft980.h | 2 +- rigs/yaesu/ftdx10.c | 2 +- rigs/yaesu/newcat.c | 18 +++--- rigs/yaesu/newcat.h | 2 +- src/rig.c | 171 +++++++++++++++++++++++++++++++------------------- tests/rigtestlibusb.c | 4 +- 12 files changed, 199 insertions(+), 127 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |