else if (iPhysicalAddress % 0x10 == 0)
iPhysicalAddress += iPort;
- SetPhysicalAddress(iPhysicalAddress);
bReturn = true;
}
if (!bReturn)
m_controller->AddLog(CEC_LOG_ERROR, "failed to set the physical address");
+ else
+ {
+ lock.Leave();
+ SetPhysicalAddress(iPhysicalAddress);
+ }
return bReturn;
}
bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate /* = true */)
{
- bool bWasActiveSource(false);
- CLockObject lock(&m_mutex);
- if (!m_logicalAddresses.IsEmpty())
+ bool bSendActiveView(false);
+ bool bReturn(false);
+
{
- for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
- if (m_logicalAddresses[iPtr])
- {
- bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource();
- m_busDevices[iPtr]->SetInactiveSource();
- m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
- if (bSendUpdate)
- m_busDevices[iPtr]->TransmitPhysicalAddress();
- }
+ CLockObject lock(&m_mutex);
+ if (!m_logicalAddresses.IsEmpty())
+ {
+ bool bWasActiveSource(false);
+ for (uint8_t iPtr = 0; iPtr < 15; iPtr++)
+ if (m_logicalAddresses[iPtr])
+ {
+ bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource();
+ m_busDevices[iPtr]->SetInactiveSource();
+ m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress);
+ if (bSendUpdate)
+ m_busDevices[iPtr]->TransmitPhysicalAddress();
+ }
- return bWasActiveSource && bSendUpdate ? SetActiveView() : true;
+ bSendActiveView = bWasActiveSource && bSendUpdate;
+ bReturn = true;
+ }
}
- return false;
+
+ if (bSendActiveView)
+ SetActiveView();
+
+ return bReturn;
}
bool CCECProcessor::SwitchMonitoring(bool bEnable)