Reduce error messages about RIG_VFO_OTHER which only applies to some rigs like Icom rigs with the 0x25 command

Add a flush_flag to read_string so that the new serial_flush will not produce a timeout value when flushing
https://github.com/Hamlib/Hamlib/issues/835
pull/875/head
Mike Black W9MDB 2021-11-01 23:43:45 -05:00
rodzic 57bb2b15d6
commit 8fe190d622
66 zmienionych plików z 181 dodań i 147 usunięć

Wyświetl plik

@ -126,7 +126,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, response, response_len, ";", 1);
len = read_string(&rs->ampport, response, response_len, ";", 1, 0);
if (len < 0) { return len; }
}
@ -140,7 +140,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (response) // if response expected get it
{
response[0] = 0;
len = read_string(&rs->ampport, response, response_len, ";", 1);
len = read_string(&rs->ampport, response, response_len, ";", 1, 0);
if (len < 0)
{
@ -166,7 +166,7 @@ int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len)
if (err != RIG_OK) { return err; }
len = read_string(&rs->ampport, responsebuf, KPABUFSZ, ";", 1);
len = read_string(&rs->ampport, responsebuf, KPABUFSZ, ";", 1, 0);
if (len < 0) { return len; }
}
@ -369,7 +369,7 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
//
do
{
retval = read_string(&rs->ampport, responsebuf, sizeof(responsebuf), ";", 1);
retval = read_string(&rs->ampport, responsebuf, sizeof(responsebuf), ";", 1, 0);
if (retval != RIG_OK) { return retval; }

Wyświetl plik

@ -1294,7 +1294,7 @@ int adat_receive(RIG *pRig,
"*** ADAT: %d %s (%s:%d): ENTRY. Params: pRig = %p\n",
gFnLevel, __func__, __FILE__, __LINE__, pRig);
nRC = read_string(&pRigState->rigport, pcData, ADAT_RESPSZ, ADAT_EOL, 1);
nRC = read_string(&pRigState->rigport, pcData, ADAT_RESPSZ, ADAT_EOL, 1, 0);
if (nRC > 0)
{
@ -3726,7 +3726,7 @@ DECLARE_PROBERIG_BACKEND(adat)
nRC = write_block(port,
ADAT_CMD_DEF_STRING_GET_ID_CODE,
strlen(ADAT_CMD_DEF_STRING_GET_ID_CODE));
nRead = read_string(port, acBuf, ADAT_RESPSZ, ADAT_EOM, 1);
nRead = read_string(port, acBuf, ADAT_RESPSZ, ADAT_EOM, 1, 0);
close(port->fd);
if ((nRC != RIG_OK || nRead < 0))

Wyświetl plik

@ -321,7 +321,7 @@ int dx77_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{
@ -337,7 +337,7 @@ int dx77_transaction(RIG *rig,
/* no data expected, check for OK returned */
if (data == NULL)
{
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, echobuf, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{
@ -358,7 +358,7 @@ int dx77_transaction(RIG *rig,
}
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{

Wyświetl plik

@ -264,7 +264,7 @@ int dxsr8_transaction(RIG *rig,
* Transceiver sends an echo of cmd followed by a CR/LF
* TODO: check whether cmd and echobuf match (optional)
*/
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{
@ -272,7 +272,7 @@ int dxsr8_transaction(RIG *rig,
}
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, replybuf, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{

Wyświetl plik

@ -102,7 +102,7 @@ static int aor_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
if (retval < 0)
{
@ -1428,7 +1428,7 @@ int aor_get_chan_all_cb(RIG *rig, vfo_t vfo, chan_cb_t chan_cb, rig_ptr_t arg)
/*
* get next line
*/
retval = read_string(&rig->state.rigport, chanbuf, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rig->state.rigport, chanbuf, BUFSZ, EOM, strlen(EOM), 0);
if (retval < 0)
{

Wyświetl plik

@ -211,7 +211,7 @@ static int ar3k_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -247,7 +247,7 @@ static int ar3030_transaction(RIG *rig, const char *cmd, int cmd_len,
if (data)
{
/* expecting 0x0d0x0a on all commands so wait for the 0x0a */
retval = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1);
retval = read_string(&rs->rigport, data, BUFSZ, "\x0a", 1, 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -307,7 +307,7 @@ static int sr2200_transaction(RIG *rig, const char *cmd, int cmd_len,
/*
* Do wait for a reply
*/
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
if (retval < 0)
{

Wyświetl plik

@ -244,7 +244,7 @@ int barrett_transaction(RIG *rig, char *cmd, int expected, char **result)
{
// response format is 0x11,data...,0x0d,0x0a,0x13
retval = read_string(&rs->rigport, priv->ret_data, sizeof(priv->ret_data),
"\x11", 1);
"\x11", 1, 0);
rig_debug(RIG_DEBUG_VERBOSE, "%s: resultlen=%d\n", __func__,
(int)strlen(priv->ret_data));

Wyświetl plik

@ -60,7 +60,7 @@ struct dra818_priv
static int dra818_response(RIG *rig, const char *expected)
{
char response[80];
int r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1);
int r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0);
if (r != strlen(expected))
{
@ -294,7 +294,7 @@ int dra818_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
(int)(priv->rx_freq / 1000000), (int)((priv->rx_freq % 1000000) / 100));
write_block(&rig->state.rigport, cmd, strlen(cmd));
r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1);
r = read_string(&rig->state.rigport, response, sizeof(response), "\n", 1, 0);
if (r != 5)
{

Wyświetl plik

@ -84,7 +84,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, 1);
retval = read_string(&rs->rigport, data, BUFSZ, LF, 1, 0);
if (retval == -RIG_ETIMEOUT)
{
@ -1252,7 +1252,7 @@ DECLARE_PROBERIG_BACKEND(drake)
}
retval = write_block(port, "ID" EOM, 3);
id_len = read_string(port, idbuf, BUFSZ, LF, 1);
id_len = read_string(port, idbuf, BUFSZ, LF, 1, 0);
close(port->fd);

Wyświetl plik

@ -456,7 +456,7 @@ static int read_transaction(RIG *rig, char *xml, int xml_len)
}
int len = read_string(&rs->rigport, tmp_buf, sizeof(tmp_buf), delims,
strlen(delims));
strlen(delims), 0);
rig_debug(RIG_DEBUG_TRACE, "%s: string='%s'\n", __func__, tmp_buf);
// if our first response we should see the HTTP header

Wyświetl plik

@ -52,7 +52,7 @@ static int netampctl_transaction(AMP *amp, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret < 0)
{
@ -95,7 +95,7 @@ static int netampctl_open(AMP *amp)
return -RIG_EPROTO;
}
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
@ -104,7 +104,7 @@ static int netampctl_open(AMP *amp)
do
{
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&amp->state.ampport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret > 0)
{

Wyświetl plik

@ -77,7 +77,7 @@ static int netrigctl_transaction(RIG *rig, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret < 0)
{
@ -305,14 +305,14 @@ static int netrigctl_open(RIG *rig)
return -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -323,7 +323,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -353,7 +353,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FRQRANGESIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -395,7 +395,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_TSLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -419,7 +419,7 @@ static int netrigctl_open(RIG *rig)
for (i = 0; i < HAMLIB_FLTLSTSIZ; i++)
{
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -446,7 +446,7 @@ static int netrigctl_open(RIG *rig)
chan_t chan_list[HAMLIB_CHANLSTSIZ]; /*!< Channel list, zero ended */
#endif
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -455,7 +455,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_rit = rs->max_rit = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -464,7 +464,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_xit = rs->max_xit = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -473,7 +473,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->max_ifshift = rs->max_ifshift = atol(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -482,7 +482,7 @@ static int netrigctl_open(RIG *rig)
rs->announces = atoi(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -509,7 +509,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->preamp[ret] = rs->preamp[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -536,7 +536,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->attenuator[ret] = rs->attenuator[ret] = RIG_DBLST_END;
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -545,7 +545,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_get_func = rs->has_get_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -554,7 +554,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_func = rs->has_set_func = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -576,7 +576,7 @@ static int netrigctl_open(RIG *rig)
#endif
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -585,7 +585,7 @@ static int netrigctl_open(RIG *rig)
rig->caps->has_set_level = rs->has_set_level = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -594,7 +594,7 @@ static int netrigctl_open(RIG *rig)
rs->has_get_parm = strtoll(buf, NULL, 0);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -630,7 +630,7 @@ static int netrigctl_open(RIG *rig)
do
{
char setting[32], value[1024];
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
strtok(buf, "\r\n"); // chop the EOL
if (ret <= 0)
@ -881,7 +881,7 @@ static int netrigctl_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
CHKSCN1ARG(num_sscanf(buf, "%"SCNfreq, freq));
#if 0 // implement set_freq VFO later if it can be detected
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -952,7 +952,7 @@ static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
*mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -1565,7 +1565,7 @@ static int netrigctl_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
*tx_mode = rig_parse_mode(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -1631,7 +1631,7 @@ static int netrigctl_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split,
*split = atoi(buf);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{
@ -2153,7 +2153,7 @@ static int netrigctl_get_ant(RIG *rig, vfo_t vfo, ant_t ant, value_t *option,
ret);
}
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1);
ret = read_string(&rig->state.rigport, buf, BUF_MAX, "\n", 1, 0);
if (ret <= 0)
{

Wyświetl plik

@ -57,7 +57,7 @@ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret < 0)
{
@ -100,14 +100,14 @@ static int netrotctl_open(ROT *rot)
return -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
return (ret < 0) ? ret : -RIG_EPROTO;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
@ -116,7 +116,7 @@ static int netrotctl_open(ROT *rot)
rs->min_az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
@ -125,7 +125,7 @@ static int netrotctl_open(ROT *rot)
rs->max_az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
@ -134,7 +134,7 @@ static int netrotctl_open(ROT *rot)
rs->min_el = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{
@ -198,7 +198,7 @@ static int netrotctl_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
*az = atof(buf);
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
if (ret <= 0)
{

Wyświetl plik

@ -243,7 +243,7 @@ static int read_transaction(RIG *rig, char *response, int response_len)
rig_debug(RIG_DEBUG_TRACE, "%s\n", __func__);
len = read_string(&rs->rigport, response, response_len, delims,
strlen(delims));
strlen(delims), 0);
if (len <= 0)
{

Wyświetl plik

@ -253,7 +253,7 @@ transaction_read:
/* allow one extra byte for terminator we don't return */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 13,
ELAD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm));
retval = read_string(&rs->rigport, buffer, len, cmdtrm, strlen(cmdtrm), 0);
if (retval < 0)
{
@ -3739,7 +3739,7 @@ DECLARE_PROBERIG_BACKEND(elad)
}
retval = write_block(port, "ID;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
close(port->fd);
if (retval != RIG_OK || id_len < 0)
@ -3800,7 +3800,7 @@ DECLARE_PROBERIG_BACKEND(elad)
}
retval = write_block(port, "K2;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
close(port->fd);
if (retval != RIG_OK)

Wyświetl plik

@ -288,7 +288,7 @@ int icmarine_transaction(RIG *rig, const char *cmd, const char *param,
/*
* Transceiver sends an echo of cmd followed by a CR/LF
*/
retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, respbuf, BUFSZ, LF, strlen(LF), 0);
if (retval < 0)
{

Wyświetl plik

@ -467,7 +467,7 @@ int read_icom_frame(hamlib_port_t *p, unsigned char rxbuffer[],
do
{
int i = read_string(p, rx_ptr, MAXFRAMELEN - read,
icom_block_end, icom_block_end_length);
icom_block_end, icom_block_end_length, 0);
if (i < 0 && i != RIG_BUSBUSY) /* die on errors */
{

Wyświetl plik

@ -1342,6 +1342,8 @@ int icom_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
case RIG_VFO_SUB: priv->sub_freq = freq; break;
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
rig->state.current_vfo = RIG_VFO_CURR;
case RIG_VFO_CURR: priv->curr_freq = freq; break;
case RIG_VFO_OTHER: priv->other_freq = freq; break;
@ -1618,6 +1620,8 @@ int icom_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
case RIG_VFO_OTHER: priv->other_freq = *freq; break;
case RIG_VFO_NONE: // VFO_NONE will become VFO_CURR
rig->state.current_vfo = RIG_VFO_CURR;
case RIG_VFO_CURR: priv->curr_freq = *freq; break;
default:
@ -2842,6 +2846,7 @@ int icom_set_vfo(RIG *rig, vfo_t vfo)
break;
default:
if (!priv->x25cmdfails)
rig_debug(RIG_DEBUG_ERR, "%s: unsupported VFO %s\n", __func__,
rig_strvfo(vfo));
RETURNFUNC(-RIG_EINVAL);

Wyświetl plik

@ -93,7 +93,7 @@ static int jrc_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
Unhold_Decode(rig);
@ -1632,7 +1632,7 @@ int jrc_decode_event(RIG *rig)
//#define SETUP_STATUS_LEN 17
//count = read_string(&rs->rigport, buf, SETUP_STATUS_LEN, "", 0);
count = read_string(&rs->rigport, buf, priv->info_len, "", 0);
count = read_string(&rs->rigport, buf, priv->info_len, "", 0, 0);
if (count < 0)
{

Wyświetl plik

@ -93,7 +93,7 @@ static int kachina_transaction(RIG *rig, unsigned char cmd1, unsigned char cmd2)
return retval;
}
count = read_string(&rs->rigport, (char *) buf4, 1, "", 0);
count = read_string(&rs->rigport, (char *) buf4, 1, "", 0, 0);
if (count != 1)
{
@ -128,7 +128,7 @@ static int kachina_trans_n(RIG *rig, unsigned char cmd1, const char *data,
return retval;
}
count = read_string(&rs->rigport, (char *) buf, 1, "", 0);
count = read_string(&rs->rigport, (char *) buf, 1, "", 0, 0);
if (count != 1)
{
@ -273,7 +273,7 @@ int kachina_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
rig_flush(&rig->state.rigport);
count = read_string(&rig->state.rigport, (char *) buf, 31, rcv_signal_range,
128);
128, 0);
if (count < 1)
{

Wyświetl plik

@ -135,7 +135,7 @@ int elecraft_open(RIG *rig)
return err;
}
err = read_string(&rs->rigport, buf, sizeof(buf), ";", 1);
err = read_string(&rs->rigport, buf, sizeof(buf), ";", 1, 0);
if (err < 0)
{

Wyświetl plik

@ -110,7 +110,7 @@ transaction:
}
// this should be the ID response
retval = read_string(&rs->rigport, buffer, sizeof(buffer), ";", 1);
retval = read_string(&rs->rigport, buffer, sizeof(buffer), ";", 1, 0);
// might be ?; too
if (buffer[0] == '?' && retry_cmd++ < rs->rigport.retry)
@ -129,7 +129,7 @@ transaction:
return RIG_OK;
}
retval = read_string(&rs->rigport, data, 50, ";", 1);
retval = read_string(&rs->rigport, data, 50, ";", 1, 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -369,7 +369,7 @@ transaction_read:
/* allow room for most any response */
len = min(datasize ? datasize + 1 : strlen(priv->verify_cmd) + 48,
KENWOOD_MAX_BUF_LEN);
retval = read_string(&rs->rigport, buffer, len, cmdtrm_str, strlen(cmdtrm_str));
retval = read_string(&rs->rigport, buffer, len, cmdtrm_str, strlen(cmdtrm_str), 0);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string(len=%d)='%s'\n", __func__,
(int)strlen(buffer), buffer);
@ -2487,7 +2487,7 @@ static int kenwood_get_micgain_minmax(RIG *rig, int *micgain_now,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0);
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -2586,7 +2586,7 @@ static int kenwood_get_power_minmax(RIG *rig, int *power_now, int *power_min,
if (retval != RIG_OK) { RETURNFUNC(retval); }
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0);
retval = read_string(&rs->rigport, levelbuf, sizeof(levelbuf), NULL, 0, 0);
rig_debug(RIG_DEBUG_TRACE, "%s: retval=%d\n", __func__, retval);
@ -5253,7 +5253,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
}
retval = write_block(port, "ID;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
close(port->fd);
if (retval != RIG_OK || id_len < 0)
@ -5320,7 +5320,7 @@ DECLARE_PROBERIG_BACKEND(kenwood)
}
retval = write_block(port, "K2;", 3);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2);
id_len = read_string(port, idbuf, IDBUFSZ, ";\r", 2, 0);
close(port->fd);
if (retval != RIG_OK)

Wyświetl plik

@ -442,7 +442,7 @@ static int ts480_read_meters(RIG *rig, int *swr, int *comp, int *alc)
// TS-480 returns values for all meters at the same time, for example: RM10000;RM20000;RM30000;
retval = read_string(&rs->rigport, ackbuf, expected_len + 1, NULL, 0);
retval = read_string(&rs->rigport, ackbuf, expected_len + 1, NULL, 0, 0);
rig_debug(RIG_DEBUG_TRACE, "%s: read_string retval=%d\n", __func__, retval);

Wyświetl plik

@ -285,7 +285,7 @@ int xg3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
return retval;
}
retval = read_string(&rs->rigport, replybuf, replysize, ";", 1);
retval = read_string(&rs->rigport, replybuf, replysize, ";", 1, 0);
if (retval < 0)
{
@ -462,7 +462,7 @@ int xg3_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval;
}
retval = read_string(&rs->rigport, freqbuf, freqsize, ";", 1);
retval = read_string(&rs->rigport, freqbuf, freqsize, ";", 1, 0);
if (retval < 0)
{
@ -514,7 +514,7 @@ int xg3_get_powerstat(RIG *rig, powerstat_t *status)
if (retval == RIG_OK)
{
char reply[32];
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0);
*status = RIG_POWER_ON;
priv->powerstat = RIG_POWER_ON;
}
@ -578,7 +578,7 @@ int xg3_get_mem(RIG *rig, vfo_t vfo, int *ch)
return retval;
}
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1);
retval = read_string(&rs->rigport, reply, sizeof(reply), ";", 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -102,7 +102,7 @@ static int rshfiq_open(RIG *rig)
return retval;
}
retval = read_string(&rig->state.rigport, versionstr, 20, stopset, 2);
retval = read_string(&rig->state.rigport, versionstr, 20, stopset, 2, 0);
}
if (retval <= 0)
@ -191,7 +191,7 @@ static int rshfiq_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
return retval;
}
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
if (retval <= 0)
{
@ -276,7 +276,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_RFPOWER_METER reply=%s\n", cmdstr);
@ -314,7 +314,7 @@ static int rshfiq_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
stopset[0] = '\r';
stopset[1] = '\n';
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2);
retval = read_string(&rig->state.rigport, cmdstr, 9, stopset, 2, 0);
rig_debug(RIG_DEBUG_TRACE, "RIG_LEVEL_TEMP_METER reply=%s\n", cmdstr);

Wyświetl plik

@ -79,7 +79,7 @@ int lowe_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
if (retval == -RIG_ETIMEOUT)
{
@ -342,7 +342,7 @@ DECLARE_PROBERIG_BACKEND(lowe)
}
retval = write_block(port, "TYP?" EOM, 4);
id_len = read_string(port, idbuf, BUFSZ, CR, 2);
id_len = read_string(port, idbuf, BUFSZ, CR, 2, 0);
close(port->fd);

Wyświetl plik

@ -170,7 +170,7 @@ static int read_prompt_and_send(hamlib_port_t *rigport,
buflen = (data_len == NULL) ? sizeof(buf) : *data_len;
retval = read_string(rigport, data, buflen, delimiter, 1);
retval = read_string(rigport, data, buflen, delimiter, 1, 0);
if (retval < 0)
{
@ -230,7 +230,7 @@ static int prm80_wait_for_prompt(hamlib_port_t *rigport)
int retval;
// Read up to the '>' prompt and discard content.
retval = read_string(rigport, buf, sizeof(buf), ">", 1);
retval = read_string(rigport, buf, sizeof(buf), ">", 1, 0);
if (retval < 0)
{
@ -910,7 +910,7 @@ int prm80_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
if (ret == 3 && buf[2] == 'T')
{
// Read the question
ret = read_string(&rs->rigport, buf, sizeof(buf), "?", 1);
ret = read_string(&rs->rigport, buf, sizeof(buf), "?", 1, 0);
if (ret < 0)
{
@ -1126,7 +1126,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
}
// Read CRLF
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1);
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
if (ret < 0)
{
@ -1142,7 +1142,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
for (i = 0; i < (RSSI_HOLD_ADDR / 16) + 1; i++)
{
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1);
ret = read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
if (ret < 0)
{
@ -1158,7 +1158,7 @@ static int prm80_get_rawstr_RAM(RIG *rig, value_t *val)
// discard the remaining content of RAM print
for (i = 0; i < (16 - RSSI_HOLD_ADDR / 16) - 1; i++)
{
read_string(&rs->rigport, buf, BUFSZ, "\n", 1);
read_string(&rs->rigport, buf, BUFSZ, "\n", 1, 0);
}
prm80_wait_for_prompt(&rs->rigport);
@ -1281,7 +1281,7 @@ const char *prm80_get_info(RIG *rig)
return NULL;
}
ret = read_string(&rs->rigport, s_buf, BUFSZ, ">", 1);
ret = read_string(&rs->rigport, s_buf, BUFSZ, ">", 1, 0);
if (ret < 0)
{

Wyświetl plik

@ -122,7 +122,7 @@ static int ra37xx_one_transaction(RIG *rig, const char *cmd, char *data,
do
{
retval = read_string(&rs->rigport, respbuf, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, respbuf, BUFSZ, EOM, strlen(EOM), 0);
if (retval < 0)
{

Wyświetl plik

@ -100,7 +100,7 @@ static int racal_transaction(RIG *rig, const char *cmd, char *data,
return retval;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, BUFSZ, EOM, strlen(EOM), 0);
if (retval <= 0)
{

Wyświetl plik

@ -71,7 +71,7 @@ int rft_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -89,7 +89,7 @@ gp2000_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, RESPSZ, CR, 1);
retval = read_string(&rs->rigport, data, RESPSZ, CR, 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -80,7 +80,7 @@ int rs_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1);
retval = read_string(&rs->rigport, data, BUFSZ, CR, 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -88,7 +88,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
* Transceiver sends back ">"
*/
char retbuf[BUFSZ + 1];
retval = read_string(&rs->rigport, retbuf, BUFSZ, PROMPT, strlen(PROMPT));
retval = read_string(&rs->rigport, retbuf, BUFSZ, PROMPT, strlen(PROMPT), 0);
if (retval < 0)
{
@ -107,7 +107,7 @@ static int skanti_transaction(RIG *rig, const char *cmd, int cmd_len,
}
}
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF));
retval = read_string(&rs->rigport, data, BUFSZ, LF, strlen(LF), 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -288,7 +288,7 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
if (data)
{
retval = read_string(&rs->rigport, data, (*data_len) + 1, term, strlen(term));
retval = read_string(&rs->rigport, data, (*data_len) + 1, term, strlen(term), 0);
if (retval != -RIG_ETIMEOUT)
{
@ -310,7 +310,7 @@ static int tt588_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
write_block(&rs->rigport, "XX" EOM,
3); // we wont' worry about the response here
retval = read_string(&rs->rigport, xxbuf, sizeof(xxbuf), "",
0); // this should timeout
0, 0); // this should timeout
if (retval != RIG_OK)
{

Wyświetl plik

@ -156,7 +156,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
#endif
*data_len = data_len_init; /* restore orig. buffer length */
*data_len = read_string(&rs->rigport, data, *data_len,
EOM, strlen(EOM));
EOM, strlen(EOM), 0);
if (!strncmp(data, "Z!", 2)) // command unrecognized??
{
@ -197,7 +197,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
passcount, itry);
*data_len = data_len_init; /* restore orig. buffer length */
read_string(&rs->rigport, data, *data_len,
EOM, strlen(EOM)); // purge the input stream...
EOM, strlen(EOM), 0); // purge the input stream...
continue; // now go retry the full command
}
}

Wyświetl plik

@ -269,7 +269,7 @@ static int rx331_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -219,7 +219,7 @@ static int rx340_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return RIG_OK;
}
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1);
retval = read_string(&rs->rigport, data, BUFSZ, EOM, 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -85,7 +85,7 @@ int tentec_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, *data_len, NULL, 0);
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0);
if (retval == -RIG_ETIMEOUT)
{

Wyświetl plik

@ -103,7 +103,7 @@ tt550_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
return 0;
}
retval = read_string(&rs->rigport, data, *data_len, NULL, 0);
retval = read_string(&rs->rigport, data, *data_len, NULL, 0, 0);
if (retval == -RIG_ETIMEOUT)
{
@ -1699,7 +1699,7 @@ tt550_decode_event(RIG *rig)
priv = (struct tt550_priv_data *) rs->priv;
data_len = read_string(&rs->rigport, (char *) buf, MAXFRAMELEN, "\n\r", 2);
data_len = read_string(&rs->rigport, (char *) buf, MAXFRAMELEN, "\n\r", 2, 0);
if (data_len == -RIG_ETIMEOUT)

Wyświetl plik

@ -156,7 +156,7 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0);
if (retval < 0)
{
@ -838,7 +838,7 @@ DECLARE_PROBERIG_BACKEND(uniden)
}
retval = write_block(port, "SI"EOM, 3);
id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1);
id_len = read_string(port, idbuf, IDBUFSZ, EOM, 1, 0);
close(port->fd);
if (retval != RIG_OK || id_len < 0)

Wyświetl plik

@ -138,7 +138,7 @@ transaction_write:
}
memset(data, 0, *datasize);
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM));
retval = read_string(&rs->rigport, data, *datasize, EOM, strlen(EOM), 0);
if (retval < 0)
{

Wyświetl plik

@ -9639,7 +9639,7 @@ int newcat_get_cmd(RIG *rig)
/* read the reply */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term))) <= 0)
&cat_term, sizeof(cat_term), 0)) <= 0)
{
continue; /* usually a timeout - retry */
}
@ -9827,7 +9827,7 @@ int newcat_set_cmd_validate(RIG *rig)
if (strlen(valcmd) == 0) { RETURNFUNC(RIG_OK); }
bytes = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term));
&cat_term, sizeof(cat_term), 0);
// FA and FB success is now verified in rig.c with a followup query
// so no validation is needed
@ -9955,7 +9955,7 @@ int newcat_set_cmd(RIG *rig)
/* read the reply */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term))) <= 0)
&cat_term, sizeof(cat_term), 0)) <= 0)
{
continue; /* usually a timeout - retry */
}
@ -10025,7 +10025,7 @@ int newcat_set_cmd(RIG *rig)
/* read/flush the verify command reply which should still be there */
if ((rc = read_string(&state->rigport, priv->ret_data, sizeof(priv->ret_data),
&cat_term, sizeof(cat_term))) > 0)
&cat_term, sizeof(cat_term), 0)) > 0)
{
rig_debug(RIG_DEBUG_TRACE, "%s: read count = %d, ret_data = %s\n",
__func__, rc, priv->ret_data);

Wyświetl plik

@ -92,7 +92,7 @@ transaction_write:
/* the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK));
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK), 0);
if (retval < 0)
{

Wyświetl plik

@ -79,7 +79,7 @@ easycomm_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
return RIG_OK; /* don't want a reply */
}
retval = read_string(&rs->rotport, data, data_len, "\n", 1);
retval = read_string(&rs->rotport, data, data_len, "\n", 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -60,7 +60,7 @@ static int ether_transaction(ROT *rot, char *cmd, int len, char *buf)
return ret;
}
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"));
ret = read_string(&rot->state.rotport, buf, BUF_MAX, "\n", sizeof("\n"), 0);
rig_debug(RIG_DEBUG_VERBOSE, "function %s(2): ret=%d || receive=%s\n", __func__,
ret, buf);

Wyświetl plik

@ -94,7 +94,7 @@ transaction_write:
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, REPLY_EOM,
strlen(REPLY_EOM));
strlen(REPLY_EOM), 0);
if (retval < 0)
{

Wyświetl plik

@ -104,7 +104,7 @@ transaction_write:
{
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, REPLY_EOM,
strlen(REPLY_EOM));
strlen(REPLY_EOM), 0);
if (strncmp(data, "\r\n", 2) == 0
|| strchr(data, '>'))

Wyświetl plik

@ -104,7 +104,7 @@ transaction_write:
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, REPLY_EOM,
strlen(REPLY_EOM));
strlen(REPLY_EOM), 0);
if (strncmp(data, "\r\n", 2) == 0 || strchr(data, '>'))
{

Wyświetl plik

@ -108,7 +108,7 @@ transaction_write:
/** the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK));
retval = read_string(&rs->rotport, data, data_len, ACK, strlen(ACK), 0);
if (retval < 0)
{

Wyświetl plik

@ -204,13 +204,13 @@ transaction_write:
/* then comes the answer */
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, CR, strlen(CR));
retval = read_string(&rs->rotport, data, data_len, CR, strlen(CR), 0);
// some models seem to echo -- so we'll check and read again if echoed
if (cmdstr && strcmp(data, cmdstr) == 0)
{
memset(data, 0, data_len);
retval = read_string(&rs->rotport, data, data_len, CR, strlen(CR));
retval = read_string(&rs->rotport, data, data_len, CR, strlen(CR), 0);
}
if (retval < 0)

Wyświetl plik

@ -129,7 +129,7 @@ transaction:
if (data != NULL)
{
return_value = read_string(&rs->rotport, data, expected_return_length + 1,
"\r\n", strlen("\r\n"));
"\r\n", strlen("\r\n"), 0);
if (return_value > 0)
{

Wyświetl plik

@ -98,7 +98,7 @@ transaction_write:
}
// Remember to check for STXA,G,R or STXA,?,XXX,R 10 bytes
retval = read_string(&rs->rotport, data, 20, CR, strlen(CR));
retval = read_string(&rs->rotport, data, 20, CR, strlen(CR), 0);
if (retval < 0)
{

Wyświetl plik

@ -79,7 +79,7 @@ radant_transaction(ROT *rot, const char *cmdstr, char *data, size_t data_len)
return RIG_OK; /* don't want a reply */
}
retval = read_string(&rs->rotport, data, data_len, "\n", 1);
retval = read_string(&rs->rotport, data, data_len, "\n", 1, 0);
if (retval < 0)
{

Wyświetl plik

@ -763,7 +763,7 @@ static int rt21_rot_get_position(ROT *rot, azimuth_t *azimuth,
rs = &rot->state;
err = read_string(&rs->rotport, az, RT21_AZ_LEN + 1, ";", strlen(";"));
err = read_string(&rs->rotport, az, RT21_AZ_LEN + 1, ";", strlen(";"), 0);
if (err < 0) /* read_string returns negative on error. */
{

Wyświetl plik

@ -137,7 +137,7 @@ static int satel_cmd(ROT *rot, char *cmd, int cmdlen, char *res, int reslen)
if (reslen > 0 && res != NULL)
{
ret = read_string(&rs->rotport, res, reslen, "\n", 1);
ret = read_string(&rs->rotport, res, reslen, "\n", 1, 0);
if (ret < 0)
{
@ -163,7 +163,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
// read motion state
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -173,7 +173,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->motion_enabled = strcmp(resbuf, "Motion ENABLED") == 0 ? true : false;
// XXX skip mode
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -181,7 +181,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// XXX skip time
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -189,7 +189,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// read azimuth line
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -201,7 +201,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->az = (int)strtof(p, NULL);
// read elevation line
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -213,7 +213,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
stat->el = (int)strtof(p, NULL);
// skip blank line
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{
@ -221,7 +221,7 @@ static int satel_read_status(ROT *rot, satel_stat_t *stat)
}
// XXX skip stored position count
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1, 0);
if (ret < 0)
{

Wyświetl plik

@ -671,7 +671,8 @@ int HAMLIB_API read_string(hamlib_port_t *p,
char *rxbuffer,
size_t rxmax,
const char *stopset,
int stopset_len)
int stopset_len,
int flush_flag)
{
fd_set rfds, efds;
struct timeval tv, tv_timeout, start_time, end_time, elapsed_time;
@ -725,12 +726,14 @@ int HAMLIB_API read_string(hamlib_port_t *p,
timersub(&end_time, &start_time, &elapsed_time);
dump_hex((unsigned char *) rxbuffer, total_count);
if (!flush_flag) {
rig_debug(RIG_DEBUG_WARN,
"%s(): Timed out %d.%03d seconds after %d chars\n",
__func__,
(int)elapsed_time.tv_sec,
(int)elapsed_time.tv_usec / 1000,
total_count);
}
return -RIG_ETIMEOUT;
}

Wyświetl plik

@ -42,6 +42,7 @@ extern HAMLIB_EXPORT(int) read_string(hamlib_port_t *p,
char *rxbuffer,
size_t rxmax,
const char *stopset,
int stopset_len);
int stopset_len,
int flush_flag);
#endif /* _IOFUNC_H */

Wyświetl plik

@ -1631,6 +1631,9 @@ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq,
{
switch (vfo)
{
case RIG_VFO_OTHER:
vfo = RIG_VFO_OTHER;
break;
case RIG_VFO_A:
vfo = RIG_VFO_B;
break;
@ -1665,6 +1668,28 @@ int rig_get_cache(RIG *rig, vfo_t vfo, freq_t *freq, int *cache_ms_freq,
switch (vfo)
{
case RIG_VFO_CURR:
*freq = rig->state.cache.freqCurr;
*mode = rig->state.cache.modeCurr;
*width = rig->state.cache.widthCurr;
*cache_ms_freq = elapsed_ms(&rig->state.cache.time_freqCurr,
HAMLIB_ELAPSED_GET);
*cache_ms_mode = elapsed_ms(&rig->state.cache.time_modeCurr,
HAMLIB_ELAPSED_GET);
*cache_ms_width = elapsed_ms(&rig->state.cache.time_widthCurr,
HAMLIB_ELAPSED_GET);
break;
case RIG_VFO_OTHER:
*freq = rig->state.cache.freqOther;
*mode = rig->state.cache.modeOther;
*width = rig->state.cache.widthOther;
*cache_ms_freq = elapsed_ms(&rig->state.cache.time_freqOther,
HAMLIB_ELAPSED_GET);
*cache_ms_mode = elapsed_ms(&rig->state.cache.time_modeOther,
HAMLIB_ELAPSED_GET);
*cache_ms_width = elapsed_ms(&rig->state.cache.time_widthOther,
HAMLIB_ELAPSED_GET);
break;
case RIG_VFO_A:
case RIG_VFO_MAIN:
case RIG_VFO_MAIN_A:

Wyświetl plik

@ -646,7 +646,6 @@ int HAMLIB_API serial_flush(hamlib_port_t *p)
if (p->fd == uh_ptt_fd || p->fd == uh_radio_fd || p->flushx)
{
unsigned char buf[32];
/*
* Catch microHam case:
* if fd corresponds to a microHam device drain the line
@ -656,7 +655,7 @@ int HAMLIB_API serial_flush(hamlib_port_t *p)
rig_debug(RIG_DEBUG_TRACE, "%s: flushing\n", __func__);
while ((n = read(p->fd, buf, 32)) > 0)
while ((n = read(p->fd, buf, sizeof(buf))) > 0)
{
nbytes += n;
//int i;
@ -679,7 +678,7 @@ int HAMLIB_API serial_flush(hamlib_port_t *p)
// we pass an empty stopset so read_string can determine
// the appropriate stopset for async data
char stopset[1];
len = read_string(p, (char*)buf, sizeof(buf)-1, stopset, 0);
len = read_string(p, (char*)buf, sizeof(buf)-1, stopset, 0, 1);
if (len > 0)
{
int i, binary=0;

Wyświetl plik

@ -1957,7 +1957,7 @@ declare_proto_amp(send_cmd)
* assumes CR or LF is end of line char
* for all ascii protocols
*/
retval = read_string(&rs->ampport, buf, BUFSZ, eom_buf, strlen(eom_buf));
retval = read_string(&rs->ampport, buf, BUFSZ, eom_buf, strlen(eom_buf), 0);
if (retval < 0)
{

Wyświetl plik

@ -4958,7 +4958,7 @@ declare_proto_rig(send_cmd)
/* Assumes CR or LF is end of line char for all ASCII protocols. */
retval = read_string(&rs->rigport, (char *)buf, rxbytes, eom_buf,
strlen(eom_buf));
strlen(eom_buf), 0);
if (retval < 0)
{

Wyświetl plik

@ -625,7 +625,8 @@ int main(int argc, char *argv[])
ts2000,
sizeof(ts2000),
stop_set,
strlen(stop_set));
strlen(stop_set),
0);
rig_debug(RIG_DEBUG_TRACE, "%s: status=%d\n", __func__, status);

Wyświetl plik

@ -2499,7 +2499,7 @@ declare_proto_rot(send_cmd)
* assumes CR or LF is end of line char
* for all ascii protocols
*/
retval = read_string(&rs->rotport, buf, BUFSZ, eom_buf, strlen(eom_buf));
retval = read_string(&rs->rotport, buf, BUFSZ, eom_buf, strlen(eom_buf), 0);
if (retval < 0)
{