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

pull/1245/head
Mikael Nousiainen 2023-03-08 23:35:08 +02:00
rodzic 0e6fd996bc
commit f17f6f0f42
2 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -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);
}

Wyświetl plik

@ -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");