bool CTDA995xCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) { unsigned char log_addr = addresses.primary; if (m_dev->Ioctl(CEC_IOCTL_RX_ADDR, &log_addr) != 0) { LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: CEC_IOCTL_RX_ADDR failed !", __func__); return false; } cec_rx_mask all_addresses; all_addresses.SwitchOn = addresses.AckMask() & 0x7fff; all_addresses.SwitchOff = ~all_addresses.SwitchOn; if (all_addresses.SwitchOn != (1 << addresses.primary) && m_dev->Ioctl(CEC_IOCTL_SET_RX_ADDR_MASK, &all_addresses) != 0) { LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: CEC_IOCTL_SET_RX_ADDR_MASK failed !", __func__); return false; } m_bLogicalAddressChanged = true; return true; }
bool CUSBCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses) { { CLockObject lock(m_mutex); if (m_logicalAddresses == addresses) return true; } if (IsOpen() && m_commands->SetAckMask(addresses.AckMask())) { CLockObject lock(m_mutex); m_logicalAddresses = addresses; return true; } LIB_CEC->AddLog(CEC_LOG_DEBUG, "couldn't change the ackmask: the connection is closed"); return false; }