From: Lars Op den Kamp Date: Sun, 4 Dec 2011 19:02:06 +0000 (+0100) Subject: cec: don't block when clearing input and no data is received X-Git-Tag: upstream/2.2.0~1^2~44^2~46 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=aee82ba0b729a4ba6e64912435639cc8be49c200;p=deb_libcec.git cec: don't block when clearing input and no data is received --- diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index 6cc482f..df803f5 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -289,8 +289,8 @@ bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38 m_processor->AddLog(CEC_LOG_DEBUG, "connection opened"); //clear any input bytes - uint8_t buff[1024]; - while (m_port->Read(buff, sizeof(buff), 1000) > 0) {} + uint8_t buff[1]; + while (m_port->Read(buff, 1, 5) == 1) {} if (CreateThread()) {