From 787a3cb882854ee6643a4342cbc2c7558c8082eb Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Sun, 6 Nov 2011 04:17:54 +0100 Subject: [PATCH] cec: only set the osd name for the primary device. use default values for others --- src/lib/CECProcessor.cpp | 5 ++++- src/lib/devices/CECBusDevice.cpp | 7 +++---- src/lib/devices/CECBusDevice.h | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) 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); -- 2.34.1