if (client->IsRegistered())
UnregisterClient(client);
+ // ensure that controlled mode is enabled
+ m_communication->SetControlledMode(true);
+
// ensure that we know the vendor id of the TV
CCECBusDevice *tv = GetTV();
if (m_communication->SupportsSourceLogicalAddress(CECDEVICE_UNREGISTERED))
}
// set the new ackmask
- return SetLogicalAddresses(GetLogicalAddresses());;
+ cec_logical_addresses addresses = GetLogicalAddresses();
+ if (SetLogicalAddresses(addresses))
+ {
+ // no more clients left, disable controlled mode
+ if (addresses.IsEmpty())
+ m_communication->SetControlledMode(false);
+
+ return true;
+ }
+
+ return false;
}
void CCECProcessor::UnregisterClients(void)
m_settingCecVersion(CEC_VERSION_UNKNOWN),
m_iSettingLAMask(0),
m_bNeedsWrite(false),
- m_iBuildDate(CEC_FW_BUILD_UNKNOWN)
+ m_iBuildDate(CEC_FW_BUILD_UNKNOWN),
+ m_bControlledMode(false)
{
m_persistedConfiguration.Clear();
}
bool CUSBCECAdapterCommands::SetControlledMode(bool controlled)
{
+ {
+ CLockObject lock(m_mutex);
+ if (m_bControlledMode == controlled)
+ return true;
+ }
+
LIB_CEC->AddLog(CEC_LOG_DEBUG, "turning controlled mode %s", controlled ? "on" : "off");
CCECAdapterMessage params;
CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_CONTROLLED, params);
bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED;
delete message;
+
+ if (bReturn)
+ {
+ CLockObject lock(m_mutex);
+ m_bControlledMode = controlled;
+ }
+
return bReturn;
}
bool m_bNeedsWrite; /**< true when we sent changed settings to the adapter that have not been persisted */
libcec_configuration m_persistedConfiguration; /**< the configuration that is persisted in the eeprom */
uint32_t m_iBuildDate; /**< the build date of the firmware */
+ bool m_bControlledMode; /**< current value of the controlled mode feature */
PLATFORM::CMutex m_mutex;
};
}