From: Lars Op den Kamp Date: Sun, 15 Apr 2012 12:59:26 +0000 (+0200) Subject: cec: don't wait 1 second when clearing input when there is no input X-Git-Tag: upstream/2.2.0~1^2~31^2~5^2~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4d657c732f346b8831a145e1dfada654d94c385;p=deb_libcec.git cec: don't wait 1 second when clearing input when there is no input --- 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;