X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECProcessor.cpp;h=76c2465fb2dd74419822d63cf5991e4c4814af95;hb=a38292a3c2ec93a21d74da778516276e92d431c0;hp=71e5c6960ac8d643f5ba98de374843685dcafacf;hpb=c8b0c13af4cace0686177af6aa808cf24a6fa789;p=deb_libcec.git diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 71e5c69..76c2465 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -660,6 +660,9 @@ bool CCECProcessor::RegisterClient(CCECClient *client) 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)) @@ -784,7 +787,17 @@ bool CCECProcessor::UnregisterClient(CCECClient *client) } // 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)