From: Josef Fruehwirth Date: Sat, 18 Aug 2012 12:07:04 +0000 (+0200) Subject: Retry m_port->Read(..) if an EINTR errror occurs instead of closing the connection... X-Git-Tag: upstream/2.2.0~1^2~18^2^2~11 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1e597e6c181faa24f0ae2170224832c174e749a4;p=deb_libcec.git Retry m_port->Read(..) if an EINTR errror occurs instead of closing the connection. closes #38 --- diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp index 80f7714..ae4c8ac 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp @@ -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()) {