Disable rig port flushing when async I/O is enabled. Improve validation of Icom frames.

This commit is contained in:
Mikael Nousiainen 2023-03-08 23:35:08 +02:00
parent 0e6fd996bc
commit f17f6f0f42
2 changed files with 12 additions and 0 deletions

View file

@ -530,6 +530,12 @@ static int read_icom_frame_generic(hamlib_port_t *p,
while ((read < rxbuffer_len) && (rxbuffer[read - 1] != FI)
&& (rxbuffer[read - 1] != COL));
// Check that we have a valid frame preamble (which might be just a single preable character)
if (rxbuffer[0] != PR)
{
return -RIG_EPROTO;
}
return (read);
}

View file

@ -2147,6 +2147,12 @@ int HAMLIB_API parse_hoststr(char *hoststr, int hoststr_len, char host[256],
//#define RIG_FLUSH_REMOVE
int HAMLIB_API rig_flush(hamlib_port_t *port)
{
// Data should never be flushed when using async I/O
if (port->asyncio)
{
return RIG_OK;
}
#ifndef RIG_FLUSH_REMOVE
rig_debug(RIG_DEBUG_TRACE, "%s: called for %s device\n", __func__,
port->type.rig == RIG_PORT_SERIAL ? "serial" : "network");