X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2Fimplementations%2FVLCommandHandler.cpp;h=e8cf7c8c4d01f0aede754d5c2c71f76d94185c50;hb=5806561ef938c6201adf4dccb3f80cebb1aa215b;hp=87a3037e432a4bde4f872b7a820ee7c2e04bcf93;hpb=b78b4e339dd201d11c5e6dbfec36534d6bc5fd69;p=deb_libcec.git diff --git a/src/lib/implementations/VLCommandHandler.cpp b/src/lib/implementations/VLCommandHandler.cpp index 87a3037..e8cf7c8 100644 --- a/src/lib/implementations/VLCommandHandler.cpp +++ b/src/lib/implementations/VLCommandHandler.cpp @@ -48,6 +48,17 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) : m_bPowerUpEventReceived(false) { m_vendorId = CEC_VENDOR_PANASONIC; + + /* use the VL commandhandler for the primary device that is handled by libCEC */ + if (busDevice->GetLogicalAddress() == CECDEVICE_TV) + { + CCECBusDevice *primary = m_processor->GetPrimaryDevice(); + if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress()) + { + primary->SetVendorId(CEC_VENDOR_PANASONIC); + primary->ReplaceHandler(false); + } + } } bool CVLCommandHandler::InitHandler(void) @@ -89,15 +100,11 @@ bool CVLCommandHandler::TransmitActiveSource(const cec_logical_address iInitiato { bool bPowerUpEventReceived(false); + CCECBusDevice *tv = m_processor->m_busDevices[CECDEVICE_TV]; + if (tv && tv->GetVendorId(false) == CEC_VENDOR_PANASONIC) { - CLockObject lock(m_mutex); - if (!m_bPowerUpEventReceived) - { - // just assume it's been sent when the tv is powered on - cec_power_status powerStatus = m_processor->m_busDevices[CECDEVICE_TV]->GetPowerStatus(); - m_bPowerUpEventReceived = (powerStatus == CEC_POWER_STATUS_ON); - } - bPowerUpEventReceived = m_bPowerUpEventReceived; + CVLCommandHandler *handler = static_cast(tv->GetHandler()); + bPowerUpEventReceived = handler ? handler->PowerUpEventReceived() : false; } if (!bPowerUpEventReceived) @@ -126,7 +133,22 @@ bool CVLCommandHandler::TransmitPendingActiveSourceCommands(void) if (bTransmitCommand) { CLibCEC::AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command"); - return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetPhysicalAddress(false, true)); + return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetPhysicalAddress()); } return true; } + +bool CVLCommandHandler::PowerUpEventReceived(void) +{ + { + CLockObject lock(m_mutex); + if (m_bPowerUpEventReceived) + return true; + } + + cec_power_status powerStatus = m_busDevice->GetPowerStatus(); + + CLockObject lock(m_mutex); + m_bPowerUpEventReceived = (powerStatus == CEC_POWER_STATUS_ON); + return m_bPowerUpEventReceived; +}