From: Lars Op den Kamp Date: Sun, 4 Dec 2011 23:58:50 +0000 (+0100) Subject: cec: set the retry timeout to 3 (default) X-Git-Tag: upstream/2.2.0~1^2~44^2~38 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=dcd240b2ff72a78dd43f265d6e1adaf0223f7a7d;p=deb_libcec.git cec: set the retry timeout to 3 (default) --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 11065eb..3db53f6 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -55,7 +55,9 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec m_strDeviceName(strDeviceName), m_controller(controller), m_bMonitor(false), - m_busScan(NULL) + m_busScan(NULL), + m_iStandardLineTimeout(3), + m_iRetryLineTimeout(3) { m_communication = new CAdapterCommunication(this); m_logicalAddresses.Clear(); @@ -72,7 +74,9 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, con m_strDeviceName(strDeviceName), m_types(types), m_controller(controller), - m_bMonitor(false) + m_bMonitor(false), + m_iStandardLineTimeout(3), + m_iRetryLineTimeout(3) { m_communication = new CAdapterCommunication(this); m_logicalAddresses.Clear(); @@ -333,6 +337,18 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE return bReturn; } +void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout) +{ + CLockObject lock(&m_mutex); + m_iStandardLineTimeout = iTimeout; +} + +void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout) +{ + CLockObject lock(&m_mutex); + m_iRetryLineTimeout = iTimeout; +} + bool CCECProcessor::SetActiveSource(cec_logical_address iAddress) { return SetStreamPath(m_busDevices[iAddress]->GetPhysicalAddress(false)); @@ -674,12 +690,12 @@ bool CCECProcessor::Transmit(CCECAdapterMessage *output) bool bReturn(false); CLockObject lock(&m_mutex); { - m_communication->SetLineTimeout(3); + m_communication->SetLineTimeout(m_iStandardLineTimeout); do { if (output->tries > 0) - m_communication->SetLineTimeout(5); + m_communication->SetLineTimeout(m_iRetryLineTimeout); CLockObject msgLock(&output->mutex); if (!m_communication || !m_communication->Write(output)) @@ -704,7 +720,7 @@ bool CCECProcessor::Transmit(CCECAdapterMessage *output) }while (output->transmit_timeout > 0 && output->needs_retry() && ++output->tries <= output->maxTries); } - m_communication->SetLineTimeout(3); + m_communication->SetLineTimeout(m_iStandardLineTimeout); return bReturn; } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 052dc99..37a7739 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -92,6 +92,8 @@ namespace CEC virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false); virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false); virtual bool EnablePhysicalAddressDetection(void) { return false; }; + void SetStandardLineTimeout(uint8_t iTimeout); + void SetRetryLineTimeout(uint8_t iTimeout); bool SetLineTimeout(uint8_t iTimeout); @@ -155,6 +157,8 @@ namespace CEC cec_keypress m_previousKey; CThread * m_busScan; uint8_t m_iLineTimeout; + uint8_t m_iStandardLineTimeout; + uint8_t m_iRetryLineTimeout; }; class CCECBusScan : public CThread diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 05cbf51..e3789c6 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -198,6 +198,9 @@ bool CSLCommandHandler::InitHandler(void) return true; m_bSLEnabled = true; + m_busDevice->GetProcessor()->SetStandardLineTimeout(3); + m_busDevice->GetProcessor()->SetRetryLineTimeout(3); + CCECBusDevice *primary = m_busDevice->GetProcessor()->m_busDevices[m_busDevice->GetProcessor()->GetLogicalAddresses().primary]; if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) primary->SetVendorId(CEC_VENDOR_LG, false);