X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fadapter%2FUSBCECAdapterCommunication.cpp;h=5e4a1740bfc0d285c37a69dcf0503eefdcd6218e;hb=a4d657c732f346b8831a145e1dfada654d94c385;hp=a74194369029665969f01de31ab8783b70b997d5;hpb=a75e3a5a63546d6f7e670bc2a7a1931887a5d2a0;p=deb_libcec.git 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;