Retry m_port->Read(..) if an EINTR errror occurs instead of closing the connection...
authorJosef Fruehwirth <fruehwirth@gmail.com>
Sat, 18 Aug 2012 12:07:04 +0000 (14:07 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 5 Sep 2012 13:07:59 +0000 (15:07 +0200)
src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp

index 80f7714a3af1f9651476d143257598ede46ca8c1..ae4c8ac60ebdc210e7706af77d55fac74dcf0bd5 100644 (file)
@@ -393,7 +393,11 @@ bool CUSBCECAdapterCommunication::ReadFromDevice(uint32_t iTimeout, size_t iSize
     if (!IsOpen())
       return false;
 
-    iBytesRead = m_port->Read(buff, sizeof(uint8_t) * iSize, iTimeout);
+    do {
+      /* retry Read() if it was interrupted */
+      iBytesRead = m_port->Read(buff, sizeof(uint8_t) * iSize, iTimeout);
+    } while(m_port->GetErrorNumber() == EINTR);
+
 
     if (m_port->GetErrorNumber())
     {