From: Lars Op den Kamp Date: Thu, 11 Oct 2012 10:41:26 +0000 (+0200) Subject: fixed - don't keep trying to send 'image view on' commands to the TV when no TV is... X-Git-Tag: upstream/2.2.0~1^2~15^2^2~16 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=c4a070bea25853e9532008117bf47720ce0cfa50 fixed - don't keep trying to send 'image view on' commands to the TV when no TV is connected, and just send the 'set active source' command. fixes source switch and debug log spam for people without a TV connected --- diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 269cbde..796f7ab 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -1121,7 +1121,13 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f VendorPreActivateSourceHook(); // power on the TV - bool bActiveSourceFailed = !m_busDevice->TransmitImageViewOn(); + CCECBusDevice* tv = m_processor->GetDevice(CECDEVICE_TV); + bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT); + bool bActiveSourceFailed(false); + if (bTvPresent) + bActiveSourceFailed = !m_busDevice->TransmitImageViewOn(); + else + LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'"); // check if we're allowed to switch sources bool bSourceSwitchAllowed = SourceSwitchAllowed(); @@ -1131,11 +1137,12 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f // switch sources (if allowed) if (!bActiveSourceFailed && bSourceSwitchAllowed) { - bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false) || - !m_busDevice->TransmitMenuState(CECDEVICE_TV, false); + bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false); + if (bTvPresent && !bActiveSourceFailed) + bActiveSourceFailed = !m_busDevice->TransmitMenuState(CECDEVICE_TV, false); // update the deck status for playback devices - if (!bActiveSourceFailed) + if (bTvPresent && !bActiveSourceFailed) { CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice(); if (playbackDevice && SendDeckStatusUpdateOnActiveSource()) diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index 227d8a0..00e062b 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -162,8 +162,11 @@ bool CVLCommandHandler::PowerUpEventReceived(void) if (m_busDevice->GetLogicalAddress() != CECDEVICE_TV) { + CCECBusDevice* tv = m_processor->GetTV(); + if (tv && tv->GetStatus() != CEC_DEVICE_STATUS_PRESENT) + return true; + // get the status from the TV - CCECBusDevice *tv = m_processor->GetTV(); if (tv && tv->GetCurrentVendorId() == CEC_VENDOR_PANASONIC) { CVLCommandHandler *handler = static_cast(tv->GetHandler());