From: Lars Op den Kamp Date: Sun, 6 Nov 2011 03:17:54 +0000 (+0100) Subject: cec: only set the osd name for the primary device. use default values for others X-Git-Tag: upstream/2.2.0~1^2~110 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=787a3cb882854ee6643a4342cbc2c7558c8082eb;p=deb_libcec.git cec: only set the osd name for the primary device. use default values for others --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index e46f48b..b9f2c51 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -111,9 +111,12 @@ bool CCECProcessor::TryLogicalAddress(cec_logical_address address, const char *s SetAckMask(0x1 << address); if (!m_busDevices[address]->PollDevice(address)) { - strLog.Format("using logical address '%s'", strLabel); AddLog(CEC_LOG_NOTICE, strLog); + + /* only set our OSD name for the primary device */ + if (m_logicalAddresses.empty()) + m_busDevices[address]->m_strDeviceName = m_strDeviceName; m_logicalAddresses.set(address); // TODO diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 2a0dc89..f9f1a2a 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -338,15 +338,14 @@ bool CCECBusDevice::ReportMenuState(cec_logical_address dest, bool bActive /* = bool CCECBusDevice::ReportOSDName(cec_logical_address dest) { - const char *osdname = m_processor->GetDeviceName().c_str(); CStdString strLog; - strLog.Format("<< reporting OSD name as %s", osdname); + strLog.Format("<< reporting OSD name as %s", m_strDeviceName.c_str()); AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_NAME); - for (unsigned int iPtr = 0; iPtr < strlen(osdname); iPtr++) - command.parameters.push_back(osdname[iPtr]); + for (unsigned int iPtr = 0; iPtr < m_strDeviceName.length(); iPtr++) + command.parameters.push_back(m_strDeviceName.at(iPtr)); return m_processor->Transmit(command); } diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 8d5eafb..ef2db21 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -42,6 +42,8 @@ namespace CEC class CCECBusDevice { + friend class CCECProcessor; + public: CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0); virtual ~CCECBusDevice(void);