cec: only set the osd name for the primary device. use default values for others
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 03:17:54 +0000 (04:17 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 6 Nov 2011 03:17:54 +0000 (04:17 +0100)
src/lib/CECProcessor.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h

index e46f48be4b133432d95910abb568c1569fc6b077..b9f2c5188c6f72a89db86286ad42b4c1119012bc 100644 (file)
@@ -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
index 2a0dc89b552476061e8ff47e2f9d89e0766c96a1..f9f1a2ac0a8bbee84769a7be9e516b491acb3766 100644 (file)
@@ -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);
 }
index 8d5eafb92a2c2b86423c797a349efcb6a365be2a..ef2db219e0f74c19b4c72edea5e9d5ae14aa795b 100644 (file)
@@ -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);