Mike Black W9MDB 2023-10-08 17:16:10 -05:00
rodzic dfc04d49c4
commit d3edab3759
11 zmienionych plików z 64 dodań i 48 usunięć

Wyświetl plik

@ -83,7 +83,7 @@ static int gomx_set(RIG *rig, int table, char *varname, char *varvalue);
/**
* Get variable from the GS100 configuration table
*/
static int gomx_get(RIG *rig, int table, char *varname, char *varvalue);
static int gomx_get(RIG *rig, int table, char *varname, char *varvalue, int varvalue_len);
/**
* Sends a message to the GS100 and parses response lines
@ -261,7 +261,7 @@ static int gs100_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
ENTERFUNC;
// perform the get command
retval = gomx_get(rig, GOM_CONFIG_TAB_RX, "freq", resp);
retval = gomx_get(rig, GOM_CONFIG_TAB_RX, "freq", resp, sizeof(resp));
if (retval != RIG_OK) { RETURNFUNC(retval); }
@ -331,7 +331,7 @@ static int gs100_get_tx_freq(RIG *rig, vfo_t vfo, freq_t *freq)
ENTERFUNC;
// perform the get command
retval = gomx_get(rig, GOM_CONFIG_TAB_TX, "freq", resp);
retval = gomx_get(rig, GOM_CONFIG_TAB_TX, "freq", resp, sizeof(resp));
if (retval != RIG_OK) { RETURNFUNC(retval); }
@ -470,12 +470,13 @@ static int gomx_set(RIG *rig, int table, char *varname, char *varvalue)
/* Get variable from the GS100 configuration table */
static int gomx_get(RIG *rig, int table, char *varname, char *varvalue)
static int gomx_get(RIG *rig, int table, char *varname, char *varvalue, int varvalue_len)
{
__attribute__((unused)) struct gs100_priv_data *priv = (struct gs100_priv_data
*)rig->state.priv;
int retval;
char msg[BUFSZ], resp[BUFSZ], *c;
char fmt[32];
assert(rig != NULL);
assert(varname != NULL);
@ -502,7 +503,8 @@ static int gomx_get(RIG *rig, int table, char *varname, char *varvalue)
// check response and extract the value
if ((c = strchr(resp, '=')) == NULL) { return (-RIG_EPROTO); }
if (sscanf(c + 1, "%s", varvalue) != 1) { return (-RIG_EPROTO); }
snprintf(fmt, sizeof(fmt), "%%%ds", varvalue_len);
if (sscanf(c + 1, fmt, varvalue_len) != 1) { return (-RIG_EPROTO); }
return (RIG_OK);
}

Wyświetl plik

@ -281,6 +281,10 @@ int ic7100_get_clock(RIG *rig, int *year, int *month, int *day, int *hour,
prmbuf[0] = 0x01;
prmbuf[1] = 0x21;
retval = icom_transaction(rig, cmd, subcmd, prmbuf, 2, respbuf, &resplen);
if (retval != RIG_OK)
{
return retval;
}
*hour = from_bcd(&respbuf[4], 2);
*min = from_bcd(&respbuf[5], 2);
*sec = 0;
@ -312,7 +316,7 @@ const struct rig_caps ic7100_caps =
RIG_MODEL(RIG_MODEL_IC7100),
.model_name = "IC-7100",
.mfg_name = "Icom",
.version = BACKEND_VER ".5",
.version = BACKEND_VER ".6",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -1873,7 +1873,8 @@ int ic7300_set_parm(RIG *rig, setting_t parm, value_t val)
int ic7300_get_parm(RIG *rig, setting_t parm, value_t *val)
{
unsigned char prmbuf[MAXFRAMELEN], resbuf[MAXFRAMELEN];
const unsigned char prmbuf[MAXFRAMELEN];
unsigned char resbuf[MAXFRAMELEN];
int prm_len = 0, res_len;
int prm_cn = 0, prm_sc = 0;
int icom_val = 0;

Wyświetl plik

@ -99,7 +99,15 @@ static int icf8101_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
int modebuf_len;
rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s\n", __func__, rig_strvfo(vfo));
if (retval != RIG_OK)
{
return retval;
}
retval = icom_transaction(rig, 0x1A, 0x34, NULL, 0, modebuf, &modebuf_len);
if (retval != RIG_OK)
{
return retval;
}
dump_hex(modebuf, modebuf_len);
switch (modebuf[1])
@ -377,7 +385,7 @@ const struct rig_caps icf8101_caps =
RIG_MODEL(RIG_MODEL_ICF8101),
.model_name = "IC-F8101",
.mfg_name = "Icom",
.version = BACKEND_VER ".2",
.version = BACKEND_VER ".3",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_TRANSCEIVER,

Wyświetl plik

@ -1392,6 +1392,11 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
// temporary fix for ID5100 not giving ACK/NAK on 0x00 freq on E8 firmware
retval = icom_transaction(rig, cmd, subcmd, freqbuf, freq_len, NULL,
NULL);
if (retval != RIG_OK)
{
rig_debug(RIG_DEBUG_ERR, "%s: set_freq failed: %s\n", __func__, rigerror(retval));
return retval;
}
return RIG_OK;
}
else
@ -2300,7 +2305,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;
struct icom_priv_data *priv = rig->state.priv;
const struct icom_priv_data *priv = rig->state.priv;
HAMLIB_TRACE;
@ -2675,6 +2680,7 @@ int icom_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
if (--mode_len == 3)
{
// cppcheck-suppress redundantAssignment
priv_data->filter = modebuf[2];
rig_debug(RIG_DEBUG_TRACE,
"%s(%d): modebuf[0]=0x%02x, modebuf[1]=0x%02x, modebuf[2]=0x%02x, mode_len=%d, filter=%d\n",
@ -5626,13 +5632,6 @@ int icom_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
priv->x25cmdfails = 0;
RETURNFUNC2(retval);
}
else
{
if (priv->x25cmdfails < 0)
{
priv->x25cmdfails = 1;
}
}
}
// Rig is in SATMODE and the command 0x25 fails in SATMODE
@ -6714,7 +6713,7 @@ int icom_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
if (priv_caps->dualwatch_split)
{
int wvfo = tx_vfo & (RIG_VFO_A | RIG_VFO_MAIN) ? S_SUB : S_MAIN;
int wvfo = (tx_vfo & (RIG_VFO_A | RIG_VFO_MAIN)) ? S_SUB : S_MAIN;
if (RIG_OK != (retval = icom_set_func(rig, RIG_VFO_CURR, RIG_FUNC_DUAL_WATCH,
split_sc)))
@ -7644,7 +7643,8 @@ int icom_get_parm(RIG *rig, setting_t parm, value_t *val)
int retval = icom_get_cmd(rig, RIG_VFO_NONE, (struct cmdparams *)&cmd[i], val);
if (parm == RIG_PARM_BANDSELECT)
{
val->s = (char*)icom_get_band(rig, val->i);
char *s = (char*)icom_get_band(rig, val->i);
val->s = s;
}
RETURNFUNC(retval);
}
@ -8102,7 +8102,7 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
int fe_max = 150;
unsigned char fe_buf[fe_max]; // for FE's to power up
int i;
int retry, retry_save;
int retry;
short timeout_retry_save;
struct rig_state *rs = &rig->state;
struct icom_priv_data *priv = (struct icom_priv_data *) rs->priv;
@ -8112,7 +8112,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
// elimininate retries to speed this up
// especially important when rig is not turned on
retry_save = rs->rigport.retry;
timeout_retry_save = rs->rigport.timeout_retry;
rs->rigport.retry = 0;
@ -8182,7 +8181,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
priv->poweron = 1;
}
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
return RIG_OK;
}
@ -8222,7 +8220,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
if (retval == RIG_OK)
{
rig->state.current_vfo = icom_current_vfo(rig);
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
RETURNFUNC2(retval);
}
@ -8237,7 +8234,6 @@ int icom_set_powerstat(RIG *rig, powerstat_t status)
}
}
rs->rigport.retry = retry_save;
rs->rigport.retry = timeout_retry_save;
if (i == retry)

Wyświetl plik

@ -35,7 +35,7 @@
#include <sys/time.h>
#endif
#define BACKEND_VER "20231001"
#define BACKEND_VER "20231007"
#define ICOM_IS_ID31 rig_is_model(rig, RIG_MODEL_ID31)
#define ICOM_IS_ID51 rig_is_model(rig, RIG_MODEL_ID51)

Wyświetl plik

@ -53,7 +53,7 @@ const struct confparams opto_ext_parms[] =
};
static int optoscan_get_status_block(RIG *rig, struct optostat *status_block);
static int optoscan_send_freq(RIG *rig, vfo_t vfo, pltstate_t *state);
static int optoscan_send_freq(RIG *rig, vfo_t vfo, const pltstate_t *state);
static int optoscan_RTS_toggle(RIG *rig);
static int optoscan_start_timer(RIG *rig, pltstate_t *state);
static int optoscan_wait_timer(RIG *rig, pltstate_t *state);
@ -767,7 +767,7 @@ static int optoscan_get_status_block(RIG *rig, struct optostat *status_block)
}
static int optoscan_send_freq(RIG *rig, vfo_t vfo, pltstate_t *state)
static int optoscan_send_freq(RIG *rig, vfo_t vfo, const pltstate_t *state)
{
unsigned char buff[OPTO_BUFF_SIZE];
char md, pd;

Wyświetl plik

@ -285,7 +285,7 @@ int jrc_close(RIG *rig)
*/
int jrc_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char freqbuf[BUFSZ];
if (freq >= (freq_t)pow(10, priv->max_freq_len))
@ -324,7 +324,7 @@ static int get_current_istate(RIG *rig, char *buf, int *buf_len)
*/
int jrc_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int retval;
char freqbuf[BUFSZ];
int freq_len;
@ -429,7 +429,7 @@ int jrc_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
*/
int jrc_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int md_len, retval;
char mdbuf[BUFSZ];
char cmode;
@ -524,7 +524,7 @@ int jrc_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
*/
int jrc_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int retval, func_len;
char funcbuf[BUFSZ];
@ -671,7 +671,7 @@ int jrc_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
*/
int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char cmdbuf[BUFSZ];
/* Optimize:
@ -775,7 +775,7 @@ int jrc_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
*/
int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int retval, lvl_len, lvl;
char lvlbuf[BUFSZ];
char cwbuf[BUFSZ];
@ -1101,7 +1101,7 @@ int jrc_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
*/
int jrc_set_parm(RIG *rig, setting_t parm, value_t val)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char cmdbuf[BUFSZ];
int minutes;
@ -1144,7 +1144,7 @@ int jrc_set_parm(RIG *rig, setting_t parm, value_t val)
*/
int jrc_get_parm(RIG *rig, setting_t parm, value_t *val)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int retval, lvl_len, i;
char lvlbuf[BUFSZ];
char cmdbuf[BUFSZ];
@ -1362,7 +1362,7 @@ int jrc_set_mem(RIG *rig, vfo_t vfo, int ch)
*/
int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
int mem_len, retval;
char membuf[BUFSZ];
int chan;
@ -1397,7 +1397,7 @@ int jrc_get_mem(RIG *rig, vfo_t vfo, int *ch)
*/
int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char cmdbuf[BUFSZ];
int retval;
rmode_t mode;
@ -1462,7 +1462,7 @@ int jrc_set_chan(RIG *rig, vfo_t vfo, const channel_t *chan)
*/
int jrc_get_chan(RIG *rig, vfo_t vfo, channel_t *chan, int read_only)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
char membuf[BUFSZ], cmdbuf[BUFSZ];
int mem_len, retval;
@ -1611,7 +1611,7 @@ int jrc_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
*/
int jrc_decode_event(RIG *rig)
{
struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
const struct jrc_priv_caps *priv = (struct jrc_priv_caps *)rig->caps->priv;
struct rig_state *rs;
freq_t freq;
rmode_t mode;

Wyświetl plik

@ -392,7 +392,7 @@ int elecraft_open(RIG *rig)
int elecraft_close(RIG *rig)
{
struct kenwood_priv_data *priv = rig->state.priv;
const struct kenwood_priv_data *priv = rig->state.priv;
if (priv->save_k2_ext_lvl >= 0)
{

Wyświetl plik

@ -76,6 +76,11 @@ int ic10_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
int retry_cmd = 0;
struct rig_state *rs;
if (cmd == NULL)
{
rig_debug(RIG_DEBUG_ERR, "%s: cmd==NULL?\n", __func__);
return -RIG_EARG;
}
rig_debug(RIG_DEBUG_TRACE,
"%s: called cmd='%s', len=%d, data=%p, data_len=%p\n", __func__, cmd, cmd_len,
data, data_len);
@ -95,7 +100,7 @@ transaction:
if (!data)
{
char buffer[50];
struct kenwood_priv_data *priv = rig->state.priv;
const struct kenwood_priv_data *priv = rig->state.priv;
if (RIG_OK != (retval = write_block(&rs->rigport,
(unsigned char *) priv->verify_cmd, strlen(priv->verify_cmd))))
@ -146,7 +151,7 @@ transaction:
*/
static int get_ic10_if(RIG *rig, char *data)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
int i, data_len, retval = RIG_EINVAL;
rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__);
@ -216,7 +221,7 @@ int ic10_set_vfo(RIG *rig, vfo_t vfo)
*/
int ic10_get_vfo(RIG *rig, vfo_t *vfo)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char vfobuf[50];
unsigned char c;
int retval, iflen;
@ -283,7 +288,7 @@ int ic10_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
int ic10_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char infobuf[50];
int retval, iflen;
@ -312,7 +317,7 @@ int ic10_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *txvfo)
*/
int ic10_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char modebuf[50];
unsigned char c;
int retval, iflen;
@ -526,7 +531,7 @@ int ic10_get_ant(RIG *rig, vfo_t vfo, ant_t dummy, value_t *option,
*/
int ic10_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char infobuf[50];
int retval, iflen, offset;
@ -595,7 +600,7 @@ int ic10_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
*/
int ic10_get_mem(RIG *rig, vfo_t vfo, int *ch)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char membuf[50];
int retval, iflen;
@ -1150,7 +1155,7 @@ const char *ic10_get_info(RIG *rig)
*/
int ic10_decode_event(RIG *rig)
{
struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
const struct kenwood_priv_caps *priv = (struct kenwood_priv_caps *)rig->caps->priv;
char asyncbuf[128], c;
int retval, async_len = 128, iflen;
vfo_t vfo;

Wyświetl plik

@ -291,7 +291,7 @@ int k2_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
int err;
char f = '*';
struct k2_filt_lst_s *flt;
struct kenwood_priv_data *priv = rig->state.priv;
const struct kenwood_priv_data *priv = rig->state.priv;
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);