cec: don't wait 1 second when clearing input when there is no input
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 15 Apr 2012 12:59:26 +0000 (14:59 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 15 Apr 2012 13:03:22 +0000 (15:03 +0200)
src/lib/adapter/USBCECAdapterCommunication.cpp

index a74194369029665969f01de31ab8783b70b997d5..5e4a1740bfc0d285c37a69dcf0503eefdcd6218e 100644 (file)
@@ -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;