From e214bfe4860b2085d0b786bf18ed59fbdcb65562 Mon Sep 17 00:00:00 2001 From: Michael Black W9MDB Date: Thu, 28 May 2020 12:03:18 -0500 Subject: [PATCH] Fix netrotctl.c to flush network/serial before every transaction https://github.com/Hamlib/Hamlib/issues/259 --- dummy/netrotctl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dummy/netrotctl.c b/dummy/netrotctl.c index e8e944663..08fd3393d 100644 --- a/dummy/netrotctl.c +++ b/dummy/netrotctl.c @@ -32,6 +32,8 @@ #include "hamlib/rotator.h" #include "iofunc.h" #include "misc.h" +#include "network.h" +#include "serial.h" #include "rot_dummy.h" @@ -45,6 +47,17 @@ static int netrotctl_transaction(ROT *rot, char *cmd, int len, char *buf) { int ret; + /* flush anything in the read buffer before command is sent */ + if (rot->state.rotport.type.rig == RIG_PORT_NETWORK + || rot->state.rotport.type.rig == RIG_PORT_UDP_NETWORK) + { + network_flush(&rot->state.rotport); + } + else + { + serial_flush(&rot->state.rotport); + } + ret = write_block(&rot->state.rotport, cmd, len); if (ret != RIG_OK)