From: Lars Op den Kamp Date: Sat, 8 Oct 2011 18:29:36 +0000 (+0200) Subject: Revert "cec: fix timeout" X-Git-Tag: upstream/2.2.0~1^2~263 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=88c05b08388985d752f86ed1451a20e9f4f3e22c;p=deb_libcec.git Revert "cec: fix timeout" This reverts commit 48787f390d45671622aa74a05a9235a08577345d. --- diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index a281ecd..cc83320 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -188,7 +188,6 @@ 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 997de65..964f359 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -241,6 +241,8 @@ 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 d8ac5a7..8ba3919 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 = (time_t) ( (iTimeout % (uint32_t)1000) * (uint32_t)1000); + abstime.tv_nsec = (int32_t)((iTimeout % (uint32_t)1000) * (uint32_t)1000000); bReturn = (pthread_cond_timedwait(&m_cond, &mutex->m_mutex, &abstime) == 0); } else