From: Lars Op den Kamp Date: Sat, 8 Oct 2011 18:22:59 +0000 (+0200) Subject: cec: fix timeout X-Git-Tag: upstream/2.2.0~1^2~264 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=48787f390d45671622aa74a05a9235a08577345d;p=deb_libcec.git cec: fix timeout --- diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index cc83320..a281ecd 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -188,6 +188,7 @@ bool CAdapterCommunication::Write(const cec_frame &data) } m_controller->AddLog(CEC_LOG_DEBUG, "command sent"); + CCondition::Sleep((uint32_t) data.size * (uint32_t)24 /*data*/ + (uint32_t)5 /*start bit (4.5 ms)*/ + (uint32_t)50); } return true; diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 964f359..997de65 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -241,8 +241,6 @@ bool CCECProcessor::TransmitFormatted(const cec_frame &data, bool bWaitForAck /* if (!m_communication || !m_communication->Write(data)) return false; - CCondition::Sleep((uint32_t) data.size * (uint32_t)24 /*data*/ + (uint32_t)5 /*start bit (4.5 ms)*/); - if (bWaitForAck) { uint64_t now = GetTimeMs(); diff --git a/src/lib/platform/threads.cpp b/src/lib/platform/threads.cpp index 8ba3919..d8ac5a7 100644 --- a/src/lib/platform/threads.cpp +++ b/src/lib/platform/threads.cpp @@ -122,7 +122,7 @@ bool CCondition::Wait(CMutex *mutex, uint32_t iTimeout /* = 0 */) gettimeofday(&now, NULL); iTimeout += now.tv_usec / 1000; abstime.tv_sec = now.tv_sec + (time_t)(iTimeout / 1000); - abstime.tv_nsec = (int32_t)((iTimeout % (uint32_t)1000) * (uint32_t)1000000); + abstime.tv_nsec = (time_t) ( (iTimeout % (uint32_t)1000) * (uint32_t)1000); bReturn = (pthread_cond_timedwait(&m_cond, &mutex->m_mutex, &abstime) == 0); } else