From: Lars Op den Kamp Date: Sun, 12 Feb 2012 14:04:07 +0000 (+0100) Subject: cec: don't send 'image view on' to LG unless needed, or the tv will get caught in... X-Git-Tag: upstream/2.2.0~1^2~35^2~93 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=49c8f2e44d5f34e98ab669e1c132d9ccd669468f;p=deb_libcec.git cec: don't send 'image view on' to LG unless needed, or the tv will get caught in a loop --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 00b25a2..230f2ab 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -461,7 +461,8 @@ bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RE m_busDevices[addr]->SetActiveSource(); if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF) { - bReturn = m_busDevices[addr]->TransmitActiveSource(); + bReturn = m_busDevices[addr]->TransmitImageViewOn() && + m_busDevices[addr]->TransmitActiveSource(); if (bReturn) { diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 0fc486f..8795422 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -683,7 +683,7 @@ bool CCECBusDevice::TransmitActiveSource(void) { CLockObject lock(m_mutex); - if (m_powerStatus != CEC_POWER_STATUS_ON) + if (m_powerStatus != CEC_POWER_STATUS_ON && m_powerStatus != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON) CLibCEC::AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress); else if (m_bActiveSource) { @@ -697,7 +697,6 @@ bool CCECBusDevice::TransmitActiveSource(void) if (bSendActiveSource) { MarkBusy(); - m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV); m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress); MarkReady(); return true; @@ -721,6 +720,23 @@ bool CCECBusDevice::TransmitCECVersion(cec_logical_address dest) return bReturn; } +bool CCECBusDevice::TransmitImageViewOn(void) +{ + CLockObject lock(m_mutex); + if (m_powerStatus != CEC_POWER_STATUS_ON && m_powerStatus != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON) + { + CLibCEC::AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress); + return false; + } + else + { + MarkBusy(); + m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV); + MarkReady(); + return true; + } +} + bool CCECBusDevice::TransmitInactiveSource(void) { uint16_t iPhysicalAddress; diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 3de307d..16b6e08 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -96,6 +96,7 @@ namespace CEC virtual bool TransmitActiveSource(void); virtual bool TransmitCECVersion(cec_logical_address dest); + virtual bool TransmitImageViewOn(void); virtual bool TransmitInactiveSource(void); virtual bool TransmitMenuState(cec_logical_address dest); virtual bool TransmitOSDName(cec_logical_address dest); diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index b8dd25f..561819f 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -339,6 +339,7 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command) { device->SetActiveSource(); return device->TransmitPhysicalAddress() && + device->TransmitImageViewOn() && device->TransmitActiveSource(); } } @@ -506,6 +507,7 @@ bool CCECCommandHandler::HandleSetStreamPath(const cec_command &command) if (device && m_busDevice->MyLogicalAddressContains(device->GetLogicalAddress())) { device->SetActiveSource(); + device->TransmitImageViewOn(); device->TransmitActiveSource(); device->SetMenuState(CEC_MENU_STATE_ACTIVATED); @@ -605,6 +607,7 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command) if (device->MyLogicalAddressContains(device->GetLogicalAddress())) { device->SetActiveSource(); + device->TransmitImageViewOn(); device->TransmitActiveSource(); if (device->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || diff --git a/src/lib/implementations/SLCommandHandler.cpp b/src/lib/implementations/SLCommandHandler.cpp index 2475e14..0de151d 100644 --- a/src/lib/implementations/SLCommandHandler.cpp +++ b/src/lib/implementations/SLCommandHandler.cpp @@ -89,6 +89,7 @@ bool CSLCommandHandler::ActivateSource(void) { CCECBusDevice *primary = m_processor->GetPrimaryDevice(); primary->SetActiveSource(); + primary->TransmitImageViewOn(); primary->TransmitActiveSource(); return true; } @@ -219,7 +220,6 @@ void CSLCommandHandler::HandleVendorCommandSLConnect(const cec_command &command) CCECBusDevice *primary = m_processor->GetPrimaryDevice(); primary->SetActiveSource(); - TransmitImageViewOn(primary->GetLogicalAddress(), command.initiator); TransmitVendorCommand05(primary->GetLogicalAddress(), command.initiator); }