+CPHCommandHandler::~CPHCommandHandler(void)
+{
+ delete m_imageViewOnCheck;
+}
+
+bool CPHCommandHandler::InitHandler(void)
+{
+ CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+ if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
+ {
+ //XXX hack to use this handler for the primary device
+ if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV &&
+ primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+ {
+ primary->SetVendorId(CEC_VENDOR_PHILIPS);
+ primary->ReplaceHandler(false);
+ }
+ }
+
+ return CCECCommandHandler::InitHandler();
+}
+
+bool CPHCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = false */)
+{
+
+ CCECBusDevice* tv = m_processor->GetDevice(CECDEVICE_TV);
+ if (m_busDevice->IsActiveSource() &&
+ m_busDevice->IsHandledByLibCEC() &&
+ tv && tv->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON &&
+ !bTransmitDelayedCommandsOnly)
+ {
+ // tv sometimes ignores image view on. check the power status of the tv in 5 seconds, and retry when it failed to power up
+ if (m_imageViewOnCheck && !m_imageViewOnCheck->IsRunning())
+ m_imageViewOnCheck->CreateThread(false);
+ }
+
+ return CCECCommandHandler::ActivateSource(bTransmitDelayedCommandsOnly);
+}
+