bool bReturn(false);
/* check whether this value was changed */
- if (m_bSettingAutoEnabled == enabled)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_bSettingAutoEnabled == enabled)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "turning autonomous mode %s", enabled ? "on" : "off");
CCECAdapterMessage params;
delete message;
if (bReturn)
+ {
+ CLockObject lock(m_mutex);
m_bSettingAutoEnabled = enabled;
+ }
return bReturn;
}
bool bReturn(false);
/* check whether this value was changed */
- if (m_persistedConfiguration.deviceTypes.types[0] == type)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_persistedConfiguration.deviceTypes.types[0] == type)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the device type to %X (previous: %X)", (uint8_t)type, (uint8_t)m_persistedConfiguration.deviceTypes.types[0]);
CCECAdapterMessage params;
bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED;
delete message;
+ if (bReturn)
+ {
+ CLockObject lock(m_mutex);
+ m_persistedConfiguration.deviceTypes.types[0] = type;
+ }
+
return bReturn;
}
bool bReturn(false);
/* check whether this value was changed */
- if (m_persistedConfiguration.logicalAddresses.primary == address)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_persistedConfiguration.logicalAddresses.primary == address)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the default logical address to %X (previous: %X)", (uint8_t)address, (uint8_t)m_persistedConfiguration.logicalAddresses.primary);
CCECAdapterMessage params;
delete message;
if (bReturn)
+ {
+ CLockObject lock(m_mutex);
m_persistedConfiguration.logicalAddresses.primary = address;
+ }
return bReturn;
}
bool bReturn(false);
/* check whether this value was changed */
- if (m_iSettingLAMask == iMask)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_iSettingLAMask == iMask)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the logical address mask to %2X (previous: %2X)", iMask, m_iSettingLAMask);
CCECAdapterMessage params;
delete message;
if (bReturn)
+ {
+ CLockObject lock(m_mutex);
m_iSettingLAMask = iMask;
+ }
return bReturn;
}
bool bReturn(false);
/* check whether this value was changed */
- if (m_persistedConfiguration.iPhysicalAddress == iPhysicalAddress)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_persistedConfiguration.iPhysicalAddress == iPhysicalAddress)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the physical address to %04X (previous: %04X)", iPhysicalAddress, m_persistedConfiguration.iPhysicalAddress);
CCECAdapterMessage params;
delete message;
if (bReturn)
+ {
+ CLockObject lock(m_mutex);
m_persistedConfiguration.iPhysicalAddress = iPhysicalAddress;
+ }
return bReturn;
}
bool bReturn(false);
/* check whether this value was changed */
- if (m_settingCecVersion == version)
- return bReturn;
+ {
+ CLockObject lock(m_mutex);
+ if (m_settingCecVersion == version)
+ return bReturn;
+ m_bNeedsWrite = true;
+ }
- m_bNeedsWrite = true;
LIB_CEC->AddLog(CEC_LOG_DEBUG, "setting the CEC version to %s (previous: %s)", ToString(version), ToString(m_settingCecVersion));
CCECAdapterMessage params;
delete message;
if (bReturn)
+ {
+ CLockObject lock(m_mutex);
m_settingCecVersion = version;
+ }
return bReturn;
}
bool CUSBCECAdapterCommands::WriteEEPROM(void)
{
- if (!m_bNeedsWrite)
- return true;
+ {
+ CLockObject lock(m_mutex);
+ if (!m_bNeedsWrite)
+ return true;
+ }
LIB_CEC->AddLog(CEC_LOG_DEBUG, "writing settings in the EEPROM");
CCECAdapterMessage params;
CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_WRITE_EEPROM, params);
- m_bNeedsWrite = !(message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED);
+ bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED;
delete message;
- return m_bNeedsWrite;
+
+ if (bReturn)
+ {
+ CLockObject lock(m_mutex);
+ m_bNeedsWrite = false;
+ }
+
+ return bReturn;
}
bool CUSBCECAdapterCommands::PersistConfiguration(const libcec_configuration &configuration)