mark the adapter as (in)active source for firmware v3+
[deb_libcec.git] / src / lib / adapter / Pulse-Eight / USBCECAdapterCommands.cpp
index 944806828ea5553c95d6549c8f006ee22cd00f58..b037e1cab9f9a2d0975a8dc5e8b175648141a228 100644 (file)
@@ -592,6 +592,19 @@ bool CUSBCECAdapterCommands::SetAckMask(uint16_t iMask)
   return bReturn;
 }
 
+void CUSBCECAdapterCommands::SetActiveSource(bool bSetTo, bool bClientUnregistered)
+{
+  if (bClientUnregistered) return;
+  if (m_persistedConfiguration.iFirmwareVersion >= 3)
+  {
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "marking the adapter as %s source", bSetTo ? "active" : "inactive");
+    CCECAdapterMessage params;
+    params.PushEscaped(bSetTo ? 1 : 0);
+    CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_ACTIVE_SOURCE, params);
+    delete message;
+  }
+}
+
 bool CUSBCECAdapterCommands::StartBootloader(void)
 {
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "starting the bootloader");