cec: transmit a keypress and key release as power on command when the target device...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 01:55:06 +0000 (02:55 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 15 Feb 2012 01:55:06 +0000 (02:55 +0100)
src/lib/devices/CECBusDevice.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index ce0c0869173207df92a639a2b1d06de57a503d3c..4ff29a28609c4d359793e9919de136b0ed9ee6bc 100644 (file)
@@ -114,28 +114,13 @@ bool CCECBusDevice::HandleCommand(const cec_command &command)
 bool CCECBusDevice::PowerOn(void)
 {
   bool bReturn(false);
-  GetVendorId(); // ensure that we got the vendor id
+  GetVendorId(); // ensure that we got the vendor id, because the implementations vary per vendor
 
   MarkBusy();
   CLibCEC::AddLog(CEC_LOG_NOTICE, "<< powering on '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
   if (m_handler->PowerOn(GetMyLogicalAddress(), m_iLogicalAddress))
   {
-    {
-//      CLockObject lock(m_mutex);
-//      m_powerStatus = CEC_POWER_STATUS_UNKNOWN;
-      SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
-    }
-//    cec_power_status status = GetPowerStatus();
-//    if (status == CEC_POWER_STATUS_STANDBY || status == CEC_POWER_STATUS_UNKNOWN)
-//    {
-//      /* sending the normal power on command appears to have failed */
-//      CStdString strLog;
-//      strLog.Format("<< sending power on keypress to '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
-//      CLibCEC::AddLog(CEC_LOG_DEBUG, strLog.c_str());
-//
-//      TransmitKeypress(CEC_USER_CONTROL_CODE_POWER);
-//      return TransmitKeyRelease();
-//    }
+    SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
     bReturn = true;
   }
 
index d03ffd936ef23d8f091b8f6dc8ecb3f0f56a5f71..8ec93eee09d22a9902bbc24f55dc776441d61d3d 100644 (file)
@@ -716,6 +716,15 @@ void CCECCommandHandler::SetPhysicalAddress(cec_logical_address iAddress, uint16
   }
 }
 
+bool CCECCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+{
+  if (iDestination == CECDEVICE_TV)
+    return TransmitImageViewOn(iInitiator, iDestination);
+
+  return TransmitKeypress(iInitiator, iDestination, CEC_USER_CONTROL_CODE_POWER) &&
+    TransmitKeyRelease(iInitiator, iDestination);
+}
+
 bool CCECCommandHandler::TransmitImageViewOn(const cec_logical_address iInitiator, const cec_logical_address iDestination)
 {
   cec_command command;
index 14e39fcee3d11f54c8b67f48f1d0231f4c97a815..a60dc731276bb450b4460e4a5e8e6be1b2f43b75 100644 (file)
@@ -56,7 +56,7 @@ namespace CEC
     virtual bool ActivateSource(void);
     virtual uint8_t GetTransmitRetries(void) const { return m_iTransmitRetries; }
 
-    virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) { return TransmitImageViewOn(iInitiator, iDestination); }
+    virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool TransmitImageViewOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination);
     virtual bool TransmitRequestCecVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination);