cec: don't block when clearing input and no data is received
[deb_libcec.git] / src / lib / AdapterCommunication.cpp
index 7f801b62d2bf8162b652f39d25621f9f99631d7c..df803f5c2f47f420b980bcab2ac026ee555d5e8c 100644 (file)
@@ -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), 500) > 0) {}
+  uint8_t buff[1];
+  while (m_port->Read(buff, 1, 5) == 1) {}
 
   if (CreateThread())
   {
@@ -323,7 +323,7 @@ void *CAdapterCommunication::Process(void)
 
   while (!IsStopped())
   {
-    ReadFromDevice(500);
+    ReadFromDevice(50);
     Sleep(5);
     WriteNextCommand();
   }