cec: changed all Handle...() commands to return a cec_abort_reason and send the corre...
[deb_libcec.git] / src / lib / implementations / VLCommandHandler.cpp
index 3d96004a7f401bdbf5874ac1a0cf69484b74b857..65f6c157cf7dec6fa36f097bc7e040ead1d7d853 100644 (file)
@@ -76,7 +76,7 @@ bool CVLCommandHandler::InitHandler(void)
   return CCECCommandHandler::InitHandler();
 }
 
-bool CVLCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
+int CVLCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
 {
   if (command.initiator == CECDEVICE_TV &&
       command.destination == CECDEVICE_BROADCAST &&
@@ -96,7 +96,7 @@ bool CVLCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &comma
     else if (command.parameters.At(4) == VL_POWERED_DOWN)
       LIB_CEC->AddLog(CEC_LOG_DEBUG, "unknown vendor command");
 
-    return true;
+    return COMMAND_HANDLED;
   }
 
   return CCECCommandHandler::HandleDeviceVendorCommandWithId(command);
@@ -111,6 +111,7 @@ bool CVLCommandHandler::TransmitActiveSource(const cec_logical_address iInitiato
   {
     CVLCommandHandler *handler = static_cast<CVLCommandHandler *>(tv->GetHandler());
     bPowerUpEventReceived = handler ? handler->PowerUpEventReceived() : false;
+    tv->MarkHandlerReady();
   }
 
   if (!bPowerUpEventReceived)
@@ -123,8 +124,7 @@ bool CVLCommandHandler::TransmitActiveSource(const cec_logical_address iInitiato
   else
   {
     // transmit standard active source message
-    return CCECCommandHandler::TransmitActiveSource(iInitiator, iPhysicalAddress) &&
-        TransmitMenuState(iInitiator, CECDEVICE_TV, CEC_MENU_STATE_ACTIVATED);
+    return CCECCommandHandler::TransmitActiveSource(iInitiator, iPhysicalAddress);
   }
 }
 
@@ -154,7 +154,11 @@ bool CVLCommandHandler::PowerUpEventReceived(void)
       return true;
   }
 
-  cec_power_status powerStatus = m_busDevice->GetCurrentPowerStatus();
+  cec_logical_address sourceLA = m_busDevice->GetLogicalAddress();
+  if (sourceLA == CECDEVICE_TV)
+    sourceLA = m_processor->GetPrimaryDevice()->GetLogicalAddress();
+
+  cec_power_status powerStatus = m_busDevice->GetPowerStatus(sourceLA);
 
   CLockObject lock(m_mutex);
   m_bPowerUpEventReceived = (powerStatus == CEC_POWER_STATUS_ON);