From: Lars Op den Kamp Date: Fri, 27 Apr 2012 23:44:37 +0000 (+0200) Subject: cec: persist the configuration after switching sources X-Git-Tag: upstream/2.2.0~1^2~29^2^2~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=43b2dfdd4114c06318381567202ec57063db20ca;p=deb_libcec.git cec: persist the configuration after switching sources --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index b4f612b..861a9ac 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -1689,18 +1689,15 @@ bool CCECProcessor::SetConfiguration(const libcec_configuration *configuration) if (m_configuration.deviceTypes.IsEmpty()) m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); - // persist the configuration - if (IsRunning()) - m_communication->PersistConfiguration(&m_configuration); - + bool bReturn(true); if (bReinit || m_configuration.logicalAddresses.IsEmpty()) { if (bDeviceTypeChanged) - return ChangeDeviceType(oldPrimaryType, m_configuration.deviceTypes[0]); + bReturn = ChangeDeviceType(oldPrimaryType, m_configuration.deviceTypes[0]); else if (IsValidPhysicalAddress(m_configuration.iPhysicalAddress)) - return SetPhysicalAddress(m_configuration.iPhysicalAddress); + bReturn = SetPhysicalAddress(m_configuration.iPhysicalAddress); else if (m_configuration.baseDevice != CECDEVICE_UNKNOWN && m_configuration.iHDMIPort != CEC_HDMI_PORTNUMBER_NONE) - return SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort); + bReturn = SetHDMIPort(m_configuration.baseDevice, m_configuration.iHDMIPort); } else if (m_configuration.bActivateSource == 1 && IsRunning() && !IsActiveSource(m_configuration.logicalAddresses.primary)) { @@ -1708,7 +1705,11 @@ bool CCECProcessor::SetConfiguration(const libcec_configuration *configuration) SetActiveSource(m_configuration.deviceTypes.types[0]); } - return true; + // persist the configuration + if (IsRunning()) + m_communication->PersistConfiguration(&m_configuration); + + return bReturn; } bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration)