[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. a396dc88255bfe8a18fd9
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Michael B. <mdb...@us...> - 2021-08-21 21:03:57
|
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 a396dc88255bfe8a18fd9efdd72d561449cb6ad3 (commit) via 6d5eb2052edb3d754943306557a9949e270a77e7 (commit) via 95a10624c1b6bd9ac2d396f2cf75346e236dd00f (commit) via b24e629e16406fa01aeba3493e2d6018c52d4a5e (commit) via 84108f9613c5836be6cc668763d0f40edbe6b59e (commit) via d1bfa0172f93c23f3c53fd0e6e1da3e59d3da731 (commit) via 83a8b98a868493af848e7a45aa44e4c4d7d43485 (commit) via 51d4473ef0610fe85ad545ff00aba833e4d1429f (commit) from ad53f2f1e3c5e06d52a21edcb0bbe499937eda83 (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 a396dc88255bfe8a18fd9efdd72d561449cb6ad3 Merge: 6d5eb205 95a10624 Author: Michael Black <mdb...@ya...> Date: Sat Aug 21 16:00:15 2021 -0500 Merge pull request #772 from wutje/constify rig.c: Constify rigerror_table commit 6d5eb2052edb3d754943306557a9949e270a77e7 Merge: ad53f2f1 84108f96 Author: Michael Black <mdb...@ya...> Date: Sat Aug 21 15:59:59 2021 -0500 Merge pull request #771 from wutje/width_removal Width pointer check removal commit 95a10624c1b6bd9ac2d396f2cf75346e236dd00f Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 22:48:02 2021 +0200 src/misc.c: Constify some tables diff --git a/src/misc.c b/src/misc.c index ad9b9694..d7abf173 100644 --- a/src/misc.c +++ b/src/misc.c @@ -413,7 +413,7 @@ const char *HAMLIB_API rig_strstatus(enum rig_status_e status) } -static struct +static const struct { rmode_t mode; const char *str; @@ -553,7 +553,7 @@ int HAMLIB_API rig_strrmodes(rmode_t modes, char *buf, int buflen) } -static struct +static const struct { vfo_t vfo; const char *str; @@ -632,7 +632,7 @@ const char *HAMLIB_API rig_strvfo(vfo_t vfo) } -static struct +static const struct { setting_t func; const char *str; @@ -686,7 +686,7 @@ static struct }; -static struct +static const struct { setting_t func; const char *str; @@ -817,7 +817,7 @@ const char *HAMLIB_API rot_strfunc(setting_t func) } -static struct +static const struct { setting_t level; const char *str; @@ -874,7 +874,7 @@ static struct }; -static struct +static const struct { setting_t level; const char *str; @@ -885,7 +885,7 @@ static struct }; -static struct +static const struct { setting_t level; const char *str; @@ -1074,7 +1074,7 @@ const char *HAMLIB_API amp_strlevel(setting_t level) } -static struct +static const struct { setting_t parm; const char *str; @@ -1092,7 +1092,7 @@ static struct }; -static struct +static const struct { setting_t parm; const char *str; @@ -1211,7 +1211,7 @@ const char *HAMLIB_API rot_strparm(setting_t parm) return ""; } -static struct +static const struct { enum agc_level_e level; const char *str; @@ -1253,7 +1253,7 @@ const char *HAMLIB_API rig_stragclevel(enum agc_level_e level) } -static struct +static const struct { vfo_op_t vfo_op; const char *str; @@ -1327,7 +1327,7 @@ const char *HAMLIB_API rig_strvfop(vfo_op_t op) } -static struct +static const struct { scan_t rscan; const char *str; @@ -1451,7 +1451,7 @@ rptr_shift_t HAMLIB_API rig_parse_rptr_shift(const char *s) } -static struct +static const struct { chan_type_t mtype; const char *str; @@ -1522,7 +1522,7 @@ const char *HAMLIB_API rig_strmtype(chan_type_t mtype) return ""; } -static struct +static const struct { enum rig_spectrum_mode_e mode; const char *str; @@ -1937,7 +1937,7 @@ int HAMLIB_API rig_flush(hamlib_port_t *port) } -static struct +static const struct { rot_status_t status; const char *str; commit b24e629e16406fa01aeba3493e2d6018c52d4a5e Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 22:26:59 2021 +0200 rig.c: Constify rigerror_table diff --git a/src/rig.c b/src/rig.c index 28043dd9..e5d93ec3 100644 --- a/src/rig.c +++ b/src/rig.c @@ -173,7 +173,7 @@ static struct opened_rig_l *opened_rig_list = { NULL }; * Careful, the order must be the same as their RIG_E* counterpart! * TODO: localise the messages.. */ -static const char *rigerror_table[] = +static const char * const rigerror_table[] = { "Command completed successfully", "Invalid parameter", commit 84108f9613c5836be6cc668763d0f40edbe6b59e Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 21:59:02 2021 +0200 src/rig.c: Add comments to clarify both mode and width must be supplied diff --git a/src/rig.c b/src/rig.c index 28043dd9..979b5dff 100644 --- a/src/rig.c +++ b/src/rig.c @@ -2297,6 +2297,9 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) * The value stored at \a mode location equals RIG_MODE_NONE when the current * mode of the VFO is not defined (e.g. blank memory). * + * Note that if either \a mode or \a width is NULL, -RIG_EINVAL is returned. + * Both must be given even if only one is actually wanted. + * * \RETURNFUNC(RIG_OK) if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). commit d1bfa0172f93c23f3c53fd0e6e1da3e59d3da731 Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 20:45:43 2021 +0200 ft600.c: Drop width check, code below has no check. The lower code would have crashed if width was NULL, so 'width == NULL' never happens. diff --git a/rigs/yaesu/ft600.c b/rigs/yaesu/ft600.c index c0f353a1..e471075a 100644 --- a/rigs/yaesu/ft600.c +++ b/rigs/yaesu/ft600.c @@ -467,10 +467,7 @@ int ft600_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return -RIG_EINVAL; } - if (width != NULL) - { - *width = RIG_PASSBAND_NORMAL; - } + *width = RIG_PASSBAND_NORMAL; ret = ft600_read_status(rig); commit 83a8b98a868493af848e7a45aa44e4c4d7d43485 Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 20:36:10 2021 +0200 icom.c: Drop width check. Other code assumes != NULL. I am not sure if the intention was to check for width == default. But that never worked, so for now do not change behaviour. diff --git a/rigs/icom/icom.c b/rigs/icom/icom.c index ea506028..e6120c3e 100644 --- a/rigs/icom/icom.c +++ b/rigs/icom/icom.c @@ -1742,7 +1742,7 @@ static int icom_set_mode_x26(RIG *rig, vfo_t vfo, rmode_t mode, int datamode, in buf[1] = datamode; // filter fixed to filter 1 due to IC7300 bug defaulting to filter 2 on mode changed -- yuck!! // buf[2] = filter // if Icom ever fixed this - buf[2] = 1; + buf[2] = 1; retval = icom_transaction(rig, cmd2, subcmd2, buf, 3, NULL, NULL); @@ -1820,7 +1820,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, unsigned char datamode[2]; unsigned char mode_icom; // Not used, we only need the width signed char width_icom; - + TRACE; switch (mode) { @@ -1844,7 +1844,7 @@ int icom_set_mode_with_data(RIG *rig, vfo_t vfo, rmode_t mode, { TRACE; if (datamode[0] == 0) datamode[1]=0; // the only good combo possible according to manual - + rig_debug(RIG_DEBUG_TRACE, "%s(%d) mode_icom=%d, datamode[0]=%d, filter=%d\n", __func__, __LINE__, mode_icom, datamode[0], datamode[1]); retval = icom_set_mode_x26(rig, vfo, mode_icom, datamode[0], datamode[1]); if (retval != RIG_OK) @@ -2220,64 +2220,61 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) // if we already set width we won't update with except during set_vfo or set_mode // reason is we can't get width without swapping vfos -- yuck!! - if (width != NULL) + if (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_SUB_A | RIG_VFO_MAIN_A | + RIG_VFO_CURR)) { - if (vfo & (RIG_VFO_A | RIG_VFO_MAIN | RIG_VFO_SUB_A | RIG_VFO_MAIN_A | - RIG_VFO_CURR)) + // then we get what was asked for + if (vfo == RIG_VFO_NONE && rig->state.current_vfo == RIG_VFO_NONE) { - // then we get what was asked for - if (vfo == RIG_VFO_NONE && rig->state.current_vfo == RIG_VFO_NONE) - { - rig_debug(RIG_DEBUG_TRACE, "%s(%d): forcing default VFO_A\n", __func__, - __LINE__); - TRACE; - rig_set_vfo(rig, RIG_VFO_A); // force VFOA - } + rig_debug(RIG_DEBUG_TRACE, "%s(%d): forcing default VFO_A\n", __func__, + __LINE__); + TRACE; + rig_set_vfo(rig, RIG_VFO_A); // force VFOA + } + + retval = icom_get_dsp_flt(rig, *mode); + *width = retval; + + if (retval == 0) + { + rig_debug(RIG_DEBUG_TRACE, + "%s: vfo=%s returning mode=%s, width not available\n", __func__, + rig_strvfo(vfo), rig_strrmode(*mode)); + } + } + else if (rig->state.cache.widthMainB == 0) + { + // we need to swap vfos to get the bandwidth -- yuck + // so we read it once and will let set_mode and transceive capability (4.3 hamlib) update it + vfo_t vfosave = rig->state.current_vfo; + if (vfosave != vfo) + { + // right now forcing VFOA/B arrangement -- reverse not supported yet + // If VFOB width is ever different than VFOA + // we need to figure out how to read VFOB without swapping VFOs + //TRACE; + //rig_set_vfo(rig, RIG_VFO_B); retval = icom_get_dsp_flt(rig, *mode); *width = retval; - if (retval == 0) - { - rig_debug(RIG_DEBUG_TRACE, - "%s: vfo=%s returning mode=%s, width not available\n", __func__, - rig_strvfo(vfo), rig_strrmode(*mode)); - } + if (*width == 0) { *width = rig->state.cache.widthMainA; } // we'll use VFOA's width + + // dont' really care about cache time here + // this is just to prevent vfo swapping while getting width + rig->state.cache.widthMainB = retval; + rig_debug(RIG_DEBUG_TRACE, "%s(%d): vfosave=%s, currvfo=%s\n", __func__, + __LINE__, rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo)); + //TRACE; + //rig_set_vfo(rig, RIG_VFO_A); + rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s returning mode=%s, width=%d\n", __func__, + rig_strvfo(vfo), rig_strrmode(*mode), (int)*width); } - else if (rig->state.cache.widthMainB == 0) + else { - // we need to swap vfos to get the bandwidth -- yuck - // so we read it once and will let set_mode and transceive capability (4.3 hamlib) update it - vfo_t vfosave = rig->state.current_vfo; - - if (vfosave != vfo) - { - // right now forcing VFOA/B arrangement -- reverse not supported yet - // If VFOB width is ever different than VFOA - // we need to figure out how to read VFOB without swapping VFOs - //TRACE; - //rig_set_vfo(rig, RIG_VFO_B); - retval = icom_get_dsp_flt(rig, *mode); - *width = retval; - - if (*width == 0) { *width = rig->state.cache.widthMainA; } // we'll use VFOA's width - - // dont' really care about cache time here - // this is just to prevent vfo swapping while getting width - rig->state.cache.widthMainB = retval; - rig_debug(RIG_DEBUG_TRACE, "%s(%d): vfosave=%s, currvfo=%s\n", __func__, - __LINE__, rig_strvfo(vfo), rig_strvfo(rig->state.current_vfo)); - //TRACE; - //rig_set_vfo(rig, RIG_VFO_A); - rig_debug(RIG_DEBUG_TRACE, "%s: vfo=%s returning mode=%s, width=%d\n", __func__, - rig_strvfo(vfo), rig_strrmode(*mode), (int)*width); - } - else - { - rig_debug(RIG_DEBUG_WARN, - "%s: vfo arrangement not supported yet, vfo=%s, currvfo=%s\n", __func__, - rig_strvfo(vfo), rig_strvfo(vfosave)); - } + rig_debug(RIG_DEBUG_WARN, + "%s: vfo arrangement not supported yet, vfo=%s, currvfo=%s\n", __func__, + rig_strvfo(vfo), rig_strvfo(vfosave)); } } @@ -5016,7 +5013,7 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq) { RETURNFUNC(retval); } - + TRACE; if (VFO_HAS_MAIN_SUB_A_B_ONLY) { @@ -7864,7 +7861,7 @@ int icom_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch) scan_sc = S_SCAN_STOP; break; - case RIG_SCAN_MEM: + case RIG_SCAN_MEM: TRACE; retval = rig_set_vfo(rig, RIG_VFO_MEM); commit 51d4473ef0610fe85ad545ff00aba833e4d1429f Author: Wouter van Gulik <pa...@gm...> Date: Sat Aug 21 20:30:03 2021 +0200 newcat.c: Drop width check; the only call site (get_mode) uses it before the call. Besides most other rigs assume it is != NULL. So having width == NULL would cause a crash for all other rigs. diff --git a/rigs/yaesu/newcat.c b/rigs/yaesu/newcat.c index bc63e96c..851f70b5 100644 --- a/rigs/yaesu/newcat.c +++ b/rigs/yaesu/newcat.c @@ -10080,16 +10080,13 @@ rmode_t newcat_rmode_width(RIG *rig, vfo_t vfo, char mode, pbwidth_t *width) ENTERFUNC; - if (width != NULL) - { - *width = RIG_PASSBAND_NORMAL; - } + *width = RIG_PASSBAND_NORMAL; for (i = 0; i < sizeof(newcat_mode_conv) / sizeof(newcat_mode_conv[0]); i++) { if (newcat_mode_conv[i].modechar == mode) { - if (newcat_mode_conv[i].chk_width == TRUE && width != NULL) + if (newcat_mode_conv[i].chk_width == TRUE) { if (newcat_is_rig(rig, RIG_MODEL_FT991) && mode == 'E') // crude fix because 991 hangs on NA0; command while in C4FM ----------------------------------------------------------------------- Summary of changes: rigs/icom/icom.c | 107 +++++++++++++++++++++++++--------------------------- rigs/yaesu/ft600.c | 5 +-- rigs/yaesu/newcat.c | 7 +--- src/misc.c | 30 +++++++-------- src/rig.c | 5 ++- 5 files changed, 74 insertions(+), 80 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |