cosmetics
[deb_libcec.git] / src / lib / implementations / CECCommandHandler.cpp
index b43d2b0ed87262f9723ad1b349319f07f7b910a1..3906060691712eb822137a5c0dc2978b7e433351 100644 (file)
@@ -299,7 +299,11 @@ bool CCECCommandHandler::HandleGivePhysicalAddress(const cec_command &command)
   {
     CCECBusDevice *device = GetDevice(command.destination);
     if (device)
-      return device->TransmitPhysicalAddress();
+    {
+      device->SetActiveSource();
+      return device->TransmitPhysicalAddress() &&
+          device->TransmitActiveSource();
+    }
   }
 
   return false;
@@ -577,7 +581,10 @@ bool CCECCommandHandler::HandleUserControlPressed(const cec_command &command)
           }
         }
       }
-      m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
+      else
+      {
+        m_processor->SetCurrentButton((cec_user_control_code) command.parameters[0]);
+      }
       return true;
     }
   }
@@ -919,3 +926,17 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bExpectResponse /*
 
   return false;
 }
+
+bool CCECCommandHandler::InitHandler(void)
+{
+  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  {
+    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+    primary->SetPowerStatus(CEC_POWER_STATUS_ON);
+    primary->SetMenuState(CEC_MENU_STATE_ACTIVATED);
+
+    m_processor->SetActiveSource();
+    primary->TransmitMenuState(m_busDevice->GetLogicalAddress());
+  }
+  return true;
+}