cec: added some more logging about what was received exactly when requesting settings...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 15:26:25 +0000 (17:26 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 23 Apr 2012 15:26:25 +0000 (17:26 +0200)
src/lib/adapter/USBCECAdapterCommands.cpp
src/lib/adapter/USBCECAdapterMessage.cpp
src/lib/adapter/USBCECAdapterMessageQueue.cpp

index 8f4d4c3d1f2d20d554025491023b3564c5786b55..c34713c9c7bb1518e737f76bd9eee2236abc5e75 100644 (file)
@@ -100,6 +100,7 @@ bool CUSBCECAdapterCommands::RequestSettingAutoEnabled(void)
   if (response.size == 1)
   {
     m_bSettingAutoEnabled = response[0] == 1;
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted autonomous mode setting: '%s'", m_bSettingAutoEnabled ? "enabled" : "disabled");
     return true;
   }
   return false;
@@ -113,6 +114,7 @@ bool CUSBCECAdapterCommands::RequestSettingCECVersion(void)
   if (response.size == 1)
   {
     m_settingCecVersion = (cec_version)response[0];
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted CEC version setting: '%s'", CLibCEC::GetInstance()->ToString(m_settingCecVersion));
     return true;
   }
   return false;
@@ -126,6 +128,7 @@ bool CUSBCECAdapterCommands::RequestSettingDefaultLogicalAddress(void)
   if (response.size == 1)
   {
     m_persistedConfiguration.logicalAddresses.primary = (cec_logical_address)response[0];
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted logical address setting: '%s'", CLibCEC::GetInstance()->ToString(m_persistedConfiguration.logicalAddresses.primary));
     return true;
   }
   return false;
@@ -140,7 +143,7 @@ bool CUSBCECAdapterCommands::RequestSettingDeviceType(void)
   if (response.size == 1)
   {
     m_persistedConfiguration.deviceTypes.Add((cec_device_type)response[0]);
-    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device type setting %s", CLibCEC::GetInstance()->ToString((cec_device_type)response[0]));
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device type setting: '%s'", CLibCEC::GetInstance()->ToString((cec_device_type)response[0]));
     return true;
   }
   CLibCEC::AddLog(CEC_LOG_DEBUG, "no persisted device type setting");
@@ -155,6 +158,7 @@ bool CUSBCECAdapterCommands::RequestSettingLogicalAddressMask(void)
   if (response.size == 2)
   {
     m_iSettingLAMask = ((uint16_t)response[0] << 8) | ((uint16_t)response[1]);
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted logical address mask setting: '%x'", m_iSettingLAMask);
     return true;
   }
   return false;
@@ -178,7 +182,7 @@ bool CUSBCECAdapterCommands::RequestSettingOSDName(void)
   buf[response.size] = 0;
 
   snprintf(m_persistedConfiguration.strDeviceName, 13, "%s", buf);
-  CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device name setting %s", buf);
+  CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted device name setting: '%s'", buf);
   return true;
 }
 
@@ -190,7 +194,7 @@ bool CUSBCECAdapterCommands::RequestSettingPhysicalAddress(void)
   if (response.size == 2)
   {
     m_persistedConfiguration.iPhysicalAddress = ((uint16_t)response[0] << 8) | ((uint16_t)response[1]);
-    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted physical address setting %4x", m_persistedConfiguration.iPhysicalAddress);
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "using persisted physical address setting: '%4x'", m_persistedConfiguration.iPhysicalAddress);
     return true;
   }
   CLibCEC::AddLog(CEC_LOG_DEBUG, "no persisted physical address setting");
index e8c575da1a637416ec8510b379d7acbaf428e11f..8b9569da0f3e06afdf284cb17d22939e9d119c36 100644 (file)
@@ -123,6 +123,9 @@ CStdString CCECAdapterMessage::ToString(void) const
         strMsg.AppendFormat(" %02x %s", At(2), IsEOM() ? "eom" : "");
       break;
     default:
+      for (uint8_t iPtr = 2; iPtr < Size(); iPtr++)
+        if (At(iPtr) != MSGEND)
+          strMsg.AppendFormat(" %02x", At(iPtr));
       break;
     }
   }
index 60625796c05f063fe58e6d295ec89a2402c7fbf1..56c81a6e4709438eef082d9aaf066a8380382856 100644 (file)
@@ -196,7 +196,7 @@ bool CCECAdapterMessageQueueEntry::MessageReceivedResponse(const CCECAdapterMess
 {
   {
     CLockObject lock(m_mutex);
-    CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - received response '%s'", ToString(), CCECAdapterMessage::ToString(message.Message()));
+    CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - received response - %s", ToString(), message.ToString().c_str());
     m_message->response = message.packet;
     if (m_message->IsTranmission())
       m_message->state = message.Message() == MSGCODE_TRANSMIT_SUCCEEDED ? ADAPTER_MESSAGE_STATE_SENT_ACKED : ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED;