From a4d657c732f346b8831a145e1dfada654d94c385 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Sun, 15 Apr 2012 14:59:26 +0200 Subject: [PATCH] cec: don't wait 1 second when clearing input when there is no input --- src/lib/adapter/USBCECAdapterCommunication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/adapter/USBCECAdapterCommunication.cpp b/src/lib/adapter/USBCECAdapterCommunication.cpp index a741943..5e4a174 100644 --- a/src/lib/adapter/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/USBCECAdapterCommunication.cpp @@ -268,10 +268,11 @@ void CUSBCECAdapterCommunication::ClearInputBytes(uint32_t iTimeout /* = 1000 */ CTimeout timeout(iTimeout); uint8_t buff[1024]; ssize_t iBytesRead(0); - bool bGotMsgEnd(false); + bool bGotMsgEnd(true); while (timeout.TimeLeft() > 0 && ((iBytesRead = m_port->Read(buff, 1024, 5)) > 0 || !bGotMsgEnd)) { + bGotMsgEnd = false; /* if something was received, wait for MSGEND */ for (ssize_t iPtr = 0; iPtr < iBytesRead; iPtr++) bGotMsgEnd = buff[iPtr] == MSGEND; -- 2.34.1