Merge branch 'development'. closes #67
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 15 Oct 2012 12:11:32 +0000 (14:11 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 15 Oct 2012 12:11:35 +0000 (14:11 +0200)
29 files changed:
ChangeLog
configure.ac
debian/changelog
include/cec.h
include/cectypes.h
project/cec-config.rc
project/libCEC.nsi
project/libcec.rc
project/testclient.rc
src/CecSharpTester/CecSharpClient.cs
src/CecSharpTester/Properties/AssemblyInfo.cs
src/LibCecSharp/AssemblyInfo.cpp
src/LibCecSharp/CecSharpTypes.h
src/LibCecTray/Properties/AssemblyInfo.cs
src/LibCecTray/controller/CECController.cs
src/cec-config/cec-config.cpp
src/lib/CECClient.cpp
src/lib/CECProcessor.cpp
src/lib/CECTypeUtils.h
src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp
src/lib/adapter/RPi/RPiCECAdapterCommunication.cpp
src/lib/adapter/RPi/RPiCECAdapterMessageQueue.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECBusDevice.h
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h
src/testclient/main.cpp

index ccb10d2260ee9077ea1df76bb94783544b90d558..983d0060874144630a92c40773ef24ccc03e2ffe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+libcec (2.0.2-2) unstable; urgency=medium
+
+  * fixed:
+    * updating the device status after a poll was broken and could reset the
+      status of devices that were marked as handled by libCEC to 'not
+      present'
+    * don't keep spamming the bus with a vendor command when an active source
+      switch is pending for panasonic, but only send it when needed
+    * reset CVLCommandHandler::m_bCapabilitiesSent when the TV goes to standby
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Mon, 15 Oct 2012 13:52:00 +0100
+
 libcec (2.0.2-1) unstable; urgency=low
 
   * changed/added:
index d3b17e96b98aaa7932331f8a5b37732e20f403a5..df63c2d3f86e7df4b1aee298020fff1c4d98f378 100644 (file)
@@ -110,7 +110,7 @@ AC_CHECK_FUNCS([pthread_mutexattr_init pthread_cond_init pthread_cond_destroy pt
 AC_SEARCH_LIBS([dlopen], [dl],
   [test "$ac_cv_search_dlopen" = "none required" || LIBS_DL=$ac_cv_search_dlopen],
   AC_MSG_ERROR($msg_dl_missing))
-AC_CHECK_FUNCS([dlopen dlcose dlsym])
+AC_CHECK_FUNCS([dlopen dlclose dlsym])
 
 ## platform specific libs, required by all targets
 case "${host}" in
index ccb10d2260ee9077ea1df76bb94783544b90d558..983d0060874144630a92c40773ef24ccc03e2ffe 100644 (file)
@@ -1,3 +1,15 @@
+libcec (2.0.2-2) unstable; urgency=medium
+
+  * fixed:
+    * updating the device status after a poll was broken and could reset the
+      status of devices that were marked as handled by libCEC to 'not
+      present'
+    * don't keep spamming the bus with a vendor command when an active source
+      switch is pending for panasonic, but only send it when needed
+    * reset CVLCommandHandler::m_bCapabilitiesSent when the TV goes to standby
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Mon, 15 Oct 2012 13:52:00 +0100
+
 libcec (2.0.2-1) unstable; urgency=low
 
   * changed/added:
index d10f4339ff6b775372154abcda37b2226b6602f3..ba12a879c66b61e5db6153a8f8f4d8cea7f33562 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "cectypes.h"
 
-#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_2_0_1
+#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_2_0_2
 
 namespace CEC
 {
index f68007b507e4477619c5d8e2f7346e343b4c887d..6b7f73cbaa149a81549fd8b8be3330d7994d808f 100644 (file)
@@ -1375,6 +1375,7 @@ typedef enum cec_client_version
   CEC_CLIENT_VERSION_1_99_0  = 0x1990,
   CEC_CLIENT_VERSION_2_0_0   = 0x2000,
   CEC_CLIENT_VERSION_2_0_1   = 0x2001,
+  CEC_CLIENT_VERSION_2_0_2   = 0x2002,
 } cec_client_version;
 
 typedef enum cec_server_version
@@ -1398,6 +1399,7 @@ typedef enum cec_server_version
   CEC_SERVER_VERSION_1_99_0  = 0x1990,
   CEC_SERVER_VERSION_2_0_0   = 0x2000,
   CEC_SERVER_VERSION_2_0_1   = 0x2001,
+  CEC_SERVER_VERSION_2_0_2   = 0x2002,
 } cec_server_version;
 
 struct libcec_configuration
index bc1299da66e7e33e3d1a4130ad1735bddef5d756..7a9da22b6c09b69028e223b21d4a2bc581028c0a 100644 (file)
Binary files a/project/cec-config.rc and b/project/cec-config.rc differ
index 514840673440a763c065970fdffd0cfabef1b1ce..5860b2e22203f16a84603b88a74e0122ba93765a 100644 (file)
@@ -7,7 +7,7 @@
 !include "LogicLib.nsh"
 !include "x64.nsh"
 
-Name "Pulse-Eight libCEC version 2.0.0"
+Name "Pulse-Eight libCEC version 2.0.2"
 OutFile "..\build\libCEC-installer.exe"
 
 XPStyle on
index 2f85a67abc451b26408f9ce922ce4dbbf160af07..b925f41863ef6df3b77fdee35a383ed680d5422c 100644 (file)
Binary files a/project/libcec.rc and b/project/libcec.rc differ
index 1d6382b69816b2092cbb7248fbed00136a96c25c..abb8ee4b4e592f709bed20989f032dc76a324f85 100644 (file)
Binary files a/project/testclient.rc and b/project/testclient.rc differ
index 37b04e9cf6c759f58f4b7635de0ea925e541b043..cd9b0e975f5fd9354c63905d3c3c6691eb94c464 100644 (file)
@@ -43,7 +43,7 @@ namespace CecSharpClient
       Config = new LibCECConfiguration();
       Config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
       Config.DeviceName = "CEC Tester";
-      Config.ClientVersion = CecClientVersion.Version2_0_0;
+      Config.ClientVersion = CecClientVersion.Version2_0_2;
       Config.SetCallbacks(this);
       LogLevel = (int)CecLogLevel.All;
 
index 799111ddc3ddbad6d642ec9d1ee7a1797bd11fea..23128fc429bbfcb2e0aaed934528faf4e61e7004 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.1.0")]
-[assembly: AssemblyFileVersion("2.0.1.0")]
+[assembly: AssemblyVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.2.0")]
index bb64ab4413f9244c083a2ba4b9c16a20eeda8a41..fe944b5d7826d71beebdfaf7b7d92cf7d0be4e29 100644 (file)
@@ -13,7 +13,7 @@ using namespace System::Security::Permissions;
 [assembly:AssemblyTrademarkAttribute("")];
 [assembly:AssemblyCultureAttribute("")];
 
-[assembly:AssemblyVersionAttribute("2.0.1.0")];
+[assembly:AssemblyVersionAttribute("2.0.2.0")];
 
 [assembly:ComVisible(false)];
 [assembly:CLSCompliantAttribute(true)];
index 908b3fc767633d51389f1fc71cdbee9481c73135..e183be36d5275091347d3f1202fe99face7bf23c 100644 (file)
@@ -1167,7 +1167,11 @@ namespace CecSharp
     /// <summary>
     /// v2.0.1
     /// </summary>
-    Version2_0_1   = 0x2001
+    Version2_0_1   = 0x2001,
+    /// <summary>
+    /// v2.0.2
+    /// </summary>
+    Version2_0_2   = 0x2002
   };
 
   /// <summary>
@@ -1250,7 +1254,11 @@ namespace CecSharp
     /// <summary>
     /// v2.0.1
     /// </summary>
-    Version2_0_1   = 0x2001
+    Version2_0_1   = 0x2001,
+    /// <summary>
+    /// v2.0.2
+    /// </summary>
+    Version2_0_2   = 0x2002
   };
 
   /// <summary>
index 80c33c6276723cfd9e361f1ad3a2f7f3b70e54d4..aad28dde6e8a8a833de0ede860435fd8c2043356 100644 (file)
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.1.0")]
-[assembly: AssemblyFileVersion("2.0.1.0")]
+[assembly: AssemblyVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.2.0")]
index f81cd94181379d9f1dc9e70edb8648220f91ec4b..ebce4baecc4ce5bc416bd7927eb5f7f459bde275 100644 (file)
@@ -438,7 +438,7 @@ namespace LibCECTray.controller
       {
         if (_config == null)
         {
-          _config = new LibCECConfiguration { DeviceName = "CEC Tray", ClientVersion = CecClientVersion.Version2_0_0 };
+          _config = new LibCECConfiguration { DeviceName = "CEC Tray", ClientVersion = CecClientVersion.Version2_0_2 };
           _config.DeviceTypes.Types[0] = CecDeviceType.RecordingDevice;
           _config.SetCallbacks(this);
 
index 380adeee91475a4585a853c17460004130e0abba..a7cae9c3a2c3501e4dd4ea99277bcb1886520db6 100644 (file)
@@ -160,7 +160,7 @@ bool OpenConnection(cec_device_type type = CEC_DEVICE_TYPE_RECORDING_DEVICE)
   g_config.Clear();
   snprintf(g_config.strDeviceName, 13, "CEC-config");
   g_config.callbackParam      = NULL;
-  g_config.clientVersion      = (uint32_t)CEC_CLIENT_VERSION_2_0_0;
+  g_config.clientVersion      = (uint32_t)CEC_CLIENT_VERSION_2_0_2;
   g_callbacks.CBCecLogMessage = &CecLogMessage;
   g_callbacks.CBCecKeyPress   = &CecKeyPress;
   g_callbacks.CBCecCommand    = &CecCommand;
index f85a53c2a6cae81bae6d17134ffa6b2fc3313f6e..a5a960ea36b00e4c804c3362b088e855550fdde3 100644 (file)
@@ -1255,7 +1255,7 @@ bool CCECClient::PollDevice(const cec_logical_address iAddress)
   CCECBusDevice *primary = GetPrimaryDevice();
   // poll the destination, with the primary as source
   if (primary)
-    return primary->TransmitPoll(iAddress, false);
+    return primary->TransmitPoll(iAddress, true);
 
   return m_processor ? m_processor->PollDevice(iAddress) : false;
 }
index cc6adda8bf4826bfb0c28f63975bae66e60bfd94..73c921d8120f68c0ffff4f440e6e66e2e0443b07 100644 (file)
@@ -315,11 +315,11 @@ bool CCECProcessor::PollDevice(cec_logical_address iAddress)
   CCECBusDevice *primary = GetPrimaryDevice();
   // poll the destination, with the primary as source
   if (primary)
-    return primary->TransmitPoll(iAddress, false);
+    return primary->TransmitPoll(iAddress, true);
 
   CCECBusDevice *device = m_busDevices->At(CECDEVICE_UNREGISTERED);
   if (device)
-    return device->TransmitPoll(iAddress, false);
+    return device->TransmitPoll(iAddress, true);
 
   return false;
 }
index 5d34b466e92580ddfaa85a270792d1abe125edc6..21a651d59fe259fbcabcbb5683aacc3a761143c9 100644 (file)
@@ -559,6 +559,8 @@ namespace CEC
         return "2.0.0";
       case CEC_CLIENT_VERSION_2_0_1:
         return "2.0.1";
+      case CEC_CLIENT_VERSION_2_0_2:
+        return "2.0.2";
       default:
         return "Unknown";
       }
@@ -602,10 +604,12 @@ namespace CEC
         return "1.9.0";
       case CEC_SERVER_VERSION_1_99_0:
         return "2.0.0-pre";
-      case CEC_CLIENT_VERSION_2_0_0:
+      case CEC_SERVER_VERSION_2_0_0:
         return "2.0.0";
-      case CEC_CLIENT_VERSION_2_0_1:
+      case CEC_SERVER_VERSION_2_0_1:
         return "2.0.1";
+      case CEC_SERVER_VERSION_2_0_2:
+        return "2.0.2";
       default:
         return "Unknown";
       }
index cf97ea9f3593e7ab01320f25b7a2deff6811616e..717e7d3f3e7be4225051e9ef12d4e903be5ffe55 100644 (file)
@@ -85,7 +85,9 @@ uint16_t CUSBCECAdapterCommands::RequestFirmwareVersion(void)
 
   while (m_persistedConfiguration.iFirmwareVersion == CEC_FW_VERSION_UNKNOWN && iFwVersionTry++ < 3)
   {
+#ifdef CEC_DEBUGGING
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting the firmware version");
+#endif
     cec_datapacket response = RequestSetting(MSGCODE_FIRMWARE_VERSION);
     if (response.size == 2)
       m_persistedConfiguration.iFirmwareVersion = (response[0] << 8 | response[1]);
@@ -107,7 +109,9 @@ uint16_t CUSBCECAdapterCommands::RequestFirmwareVersion(void)
 
 bool CUSBCECAdapterCommands::RequestSettingAutoEnabled(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting autonomous mode setting");
+#endif
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_AUTO_ENABLED);
   if (response.size == 1)
@@ -121,7 +125,9 @@ bool CUSBCECAdapterCommands::RequestSettingAutoEnabled(void)
 
 bool CUSBCECAdapterCommands::RequestSettingCECVersion(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting CEC version setting");
+#endif
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_HDMI_VERSION);
   if (response.size == 1)
@@ -137,7 +143,9 @@ p8_cec_adapter_type CUSBCECAdapterCommands::RequestAdapterType(void)
 {
   if (m_adapterType == P8_ADAPTERTYPE_UNKNOWN)
   {
+#ifdef CEC_DEBUGGING
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting adapter type");
+#endif
 
     cec_datapacket response = RequestSetting(MSGCODE_GET_ADAPTER_TYPE);
     if (response.size == 1)
@@ -150,7 +158,9 @@ uint32_t CUSBCECAdapterCommands::RequestBuildDate(void)
 {
   if (m_iBuildDate == CEC_FW_BUILD_UNKNOWN)
   {
+#ifdef CEC_DEBUGGING
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting firmware build date");
+#endif
 
     cec_datapacket response = RequestSetting(MSGCODE_GET_BUILDDATE);
     if (response.size == 4)
@@ -161,7 +171,9 @@ uint32_t CUSBCECAdapterCommands::RequestBuildDate(void)
 
 bool CUSBCECAdapterCommands::RequestSettingDefaultLogicalAddress(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting default logical address setting");
+#endif
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_DEFAULT_LOGICAL_ADDRESS);
   if (response.size == 1)
@@ -175,7 +187,9 @@ bool CUSBCECAdapterCommands::RequestSettingDefaultLogicalAddress(void)
 
 bool CUSBCECAdapterCommands::RequestSettingDeviceType(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting device type setting");
+#endif
   m_persistedConfiguration.deviceTypes.Clear();
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_DEVICE_TYPE);
@@ -191,7 +205,9 @@ bool CUSBCECAdapterCommands::RequestSettingDeviceType(void)
 
 bool CUSBCECAdapterCommands::RequestSettingLogicalAddressMask(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting logical address mask setting");
+#endif
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_LOGICAL_ADDRESS_MASK);
   if (response.size == 2)
@@ -205,7 +221,9 @@ bool CUSBCECAdapterCommands::RequestSettingLogicalAddressMask(void)
 
 bool CUSBCECAdapterCommands::RequestSettingOSDName(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting OSD name setting");
+#endif
 
   memset(m_persistedConfiguration.strDeviceName, 0, 13);
   cec_datapacket response = RequestSetting(MSGCODE_GET_OSD_NAME);
@@ -227,7 +245,9 @@ bool CUSBCECAdapterCommands::RequestSettingOSDName(void)
 
 bool CUSBCECAdapterCommands::RequestSettingPhysicalAddress(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "requesting physical address setting");
+#endif
 
   cec_datapacket response = RequestSetting(MSGCODE_GET_PHYSICAL_ADDRESS);
   if (response.size == 2)
@@ -544,7 +564,9 @@ bool CUSBCECAdapterCommands::GetConfiguration(libcec_configuration &configuratio
 
 bool CUSBCECAdapterCommands::PingAdapter(void)
 {
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending ping");
+#endif
 
   CCECAdapterMessage params;
   CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_PING, params);
index daaa72ab17d96eda8c3184c142fa921f05f3de70..e1fcae6af7cd5caf561afe94e918ca6b78f23b06 100644 (file)
@@ -110,7 +110,9 @@ void CRPiCECAdapterCommunication::OnDataReceived(uint32_t header, uint32_t p0, u
 {
   VC_CEC_NOTIFY_T reason = (VC_CEC_NOTIFY_T)CEC_CB_REASON(header);
 
+#ifdef CEC_DEBUGGING
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "received data: header:%08X p0:%08X p1:%08X p2:%08X p3:%08X reason:%x", header, p0, p1, p2, p3, reason);
+#endif
 
   switch (reason)
   {
index df9a374dc4ad07b9746ebcd25a94dc7fff97c980..656a25d0a2d54243983a7b813007481cc4ea18ba 100644 (file)
@@ -151,11 +151,13 @@ bool CRPiCECAdapterMessageQueue::Write(const cec_command &command, bool bIsReply
       message.payload[iPtr + 1] = command.parameters.At(iPtr);
   }
 
+#ifdef CEC_DEBUGGING
   CStdString strDump;
   strDump.Format("len = %d, payload = %X%X", message.length, (int)message.initiator, (int)message.follower);
   for (uint8_t iPtr = 0; iPtr < message.length - 1; iPtr++)
     strDump.AppendFormat(":%02X", message.payload[iPtr]);
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending data: %s", strDump.c_str());
+#endif
 
   int iReturn = vc_cec_send_message2(&message);
 #else
@@ -172,11 +174,13 @@ bool CRPiCECAdapterMessageQueue::Write(const cec_command &command, bool bIsReply
       payload[iPtr + 1] = command.parameters.At(iPtr);
   }
 
+#ifdef CEC_DEBUGGING
   CStdString strDump;
   strDump.Format("len = %d, payload = %X%X", iLength, (int)command.initiator, (int)command.destination);
   for (uint8_t iPtr = 0; iPtr < iLength; iPtr++)
     strDump.AppendFormat(":%02X", payload[iPtr]);
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "sending data: %s", strDump.c_str());
+#endif
 
    int iReturn = vc_cec_send_message((uint32_t)command.destination, (uint8_t*)&payload, iLength, bIsReply);
 #endif
index b42230dd41201913a0331e18f3b9c57aee874ec7..5137cfbc00ad08ce7bf7940cd9fde57e30586484 100644 (file)
@@ -618,7 +618,6 @@ bool CCECBusDevice::RequestPowerStatus(const cec_logical_address initiator, bool
       !IsUnsupportedFeature(CEC_OPCODE_GIVE_DEVICE_POWER_STATUS))
   {
     MarkBusy();
-    LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< requesting power status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
     bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bWaitForResponse);
     MarkReady();
   }
@@ -741,7 +740,8 @@ cec_bus_device_status CCECBusDevice::GetStatus(bool bForcePoll /* = false */, bo
     CLockObject lock(m_mutex);
     status = m_deviceStatus;
     bNeedsPoll = !bSuppressPoll &&
-        (bForcePoll || m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN);
+        (bForcePoll || m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN) &&
+        m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC;
   }
 
   if (bNeedsPoll)
@@ -782,6 +782,7 @@ void CCECBusDevice::SetDeviceStatus(const cec_bus_device_status newStatus, cec_v
       if (m_deviceStatus != newStatus)
         LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): device status changed into 'present'", GetLogicalAddressName(), m_iLogicalAddress);
       m_deviceStatus = newStatus;
+      m_iLastActive = GetTimeMs();
       break;
     case CEC_DEVICE_STATUS_NOT_PRESENT:
       if (m_deviceStatus != newStatus)
@@ -819,7 +820,7 @@ void CCECBusDevice::ResetDeviceStatus(void)
   m_deviceStatus = CEC_DEVICE_STATUS_UNKNOWN;
 }
 
-bool CCECBusDevice::TransmitPoll(const cec_logical_address dest, bool bIsReply)
+bool CCECBusDevice::TransmitPoll(const cec_logical_address dest, bool bUpdateDeviceStatus)
 {
   bool bReturn(false);
   cec_logical_address destination(dest);
@@ -832,17 +833,11 @@ bool CCECBusDevice::TransmitPoll(const cec_logical_address dest, bool bIsReply)
 
   MarkBusy();
   LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< %s (%X) -> %s (%X): POLL", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
-  bReturn = m_handler->TransmitPoll(m_iLogicalAddress, destination, bIsReply);
+  bReturn = m_handler->TransmitPoll(m_iLogicalAddress, destination, false);
   LIB_CEC->AddLog(CEC_LOG_DEBUG, bReturn ? ">> POLL sent" : ">> POLL not sent");
 
-  CLockObject lock(m_mutex);
-  if (bReturn)
-  {
-    m_iLastActive = GetTimeMs();
-    SetDeviceStatus(CEC_DEVICE_STATUS_PRESENT);
-  }
-  else
-    SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT);
+  if (bUpdateDeviceStatus)
+    destDevice->SetDeviceStatus(bReturn ? CEC_DEVICE_STATUS_PRESENT : CEC_DEVICE_STATUS_NOT_PRESENT);
 
   MarkReady();
   return bReturn;
index d208fd933d44bd94b7e6f6c944cff79e2e1fbdb8..fad7191e6be216ac2bd83c7898681acb5e8892c0 100644 (file)
@@ -206,7 +206,7 @@ namespace CEC
     virtual cec_bus_device_status GetStatus(bool bForcePoll = false, bool bSuppressPoll = false);
     virtual void                  SetDeviceStatus(const cec_bus_device_status newStatus, cec_version libCECSpecVersion = CEC_VERSION_1_4);
     virtual void                  ResetDeviceStatus(void);
-    virtual bool                  TransmitPoll(const cec_logical_address destination, bool bIsReply);
+    virtual bool                  TransmitPoll(const cec_logical_address destination, bool bUpdateDeviceStatus);
     virtual void                  HandlePoll(const cec_logical_address destination);
     virtual void                  HandlePollFrom(const cec_logical_address initiator);
     virtual bool                  HandleReceiveFailed(void);
index 8dcc2559dbad3eb8e57cec211dfcef8ad6453132..5398513ab52fa8a5d20ed949d041bcb882091422 100644 (file)
@@ -48,6 +48,7 @@ using namespace PLATFORM;
 
 #define LIB_CEC     m_busDevice->GetProcessor()->GetLib()
 #define ToString(p) CCECTypeUtils::ToString(p)
+#define REQUEST_POWER_STATUS_TIMEOUT 5000
 
 CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice,
                                        int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */,
@@ -62,7 +63,8 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice,
     m_bHandlerInited(false),
     m_bOPTSendDeckStatusUpdateOnActiveSource(false),
     m_vendorId(CEC_VENDOR_UNKNOWN),
-    m_iActiveSourcePending(iActiveSourcePending)
+    m_iActiveSourcePending(iActiveSourcePending),
+    m_iPowerStatusRequested(0)
 {
 }
 
@@ -815,7 +817,14 @@ bool CCECCommandHandler::TransmitImageViewOn(const cec_logical_address iInitiato
   cec_command command;
   cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_IMAGE_VIEW_ON);
 
-  return Transmit(command, false, false);
+  if (Transmit(command, false, false))
+  {
+    CCECBusDevice* dest = m_processor->GetDevice(iDestination);
+    if (dest && dest->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON)
+      dest->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+    return true;
+  }
+  return false;
 }
 
 bool CCECCommandHandler::TransmitStandby(const cec_logical_address iInitiator, const cec_logical_address iDestination)
@@ -868,6 +877,16 @@ bool CCECCommandHandler::TransmitRequestPhysicalAddress(const cec_logical_addres
 
 bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
 {
+  if (iDestination == CECDEVICE_TV)
+  {
+    int64_t now(GetTimeMs());
+    if (now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT)
+      return true;
+    m_iPowerStatusRequested = now;
+  }
+
+  LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< requesting power status of '%s' (%X)", m_busDevice->GetLogicalAddressName(), iDestination);
+
   cec_command command;
   cec_command::Format(command, iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
 
@@ -1100,7 +1119,9 @@ bool CCECCommandHandler::Transmit(cec_command &command, bool bSuppressWait, bool
     {
       if ((bReturn = m_processor->Transmit(command, bIsReply)) == true)
       {
+#ifdef CEC_DEBUGGING
         LIB_CEC->AddLog(CEC_LOG_DEBUG, "command transmitted");
+#endif
         if (bExpectResponse)
         {
           bReturn = m_busDevice->WaitForOpcode(expectedResponse);
@@ -1126,7 +1147,9 @@ bool CCECCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = f
         if (m_iActiveSourcePending == 0 || GetTimeMs() < m_iActiveSourcePending)
           return false;
 
+#ifdef CEC_DEBUGGING
         LIB_CEC->AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
+#endif
       }
     }
 
index fca8a966fa6aca7a4809cce9c9fad9727bf863f8..1a6cd567c264881e2a50f9f2ff27f05cf4429f19 100644 (file)
@@ -152,15 +152,16 @@ namespace CEC
 
     virtual bool SourceSwitchAllowed(void) { return true; }
 
-    CCECBusDevice *                       m_busDevice;
-    CCECProcessor *                       m_processor;
-    int32_t                               m_iTransmitTimeout;
-    int32_t                               m_iTransmitWait;
-    int8_t                                m_iTransmitRetries;
-    bool                                  m_bHandlerInited;
-    bool                                  m_bOPTSendDeckStatusUpdateOnActiveSource;
-    cec_vendor_id                         m_vendorId;
-    int64_t                               m_iActiveSourcePending;
-    PLATFORM::CMutex                      m_mutex;
+    CCECBusDevice *  m_busDevice;
+    CCECProcessor *  m_processor;
+    int32_t          m_iTransmitTimeout;
+    int32_t          m_iTransmitWait;
+    int8_t           m_iTransmitRetries;
+    bool            m_bHandlerInited;
+    bool            m_bOPTSendDeckStatusUpdateOnActiveSource;
+    cec_vendor_id    m_vendorId;
+    int64_t          m_iActiveSourcePending;
+    PLATFORM::CMutex m_mutex;
+    int64_t          m_iPowerStatusRequested;
   };
 };
index 90e87778c4c0a7dd11daa9f55534e5bebfcec95a..b7cdb7a20b166ab84a1ccca5abe27a3d39335dc4 100644 (file)
@@ -45,8 +45,6 @@
 #define VL_POWERED_DOWN 0x01
 #define VL_UNKNOWN1     0x06
 
-#define VL_REQUEST_POWER_STATUS_TIMEOUT 5000
-
 using namespace CEC;
 using namespace PLATFORM;
 
@@ -63,8 +61,7 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice,
                                      int64_t iActiveSourcePending /* = 0 */) :
     CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending),
     m_iPowerUpEventReceived(0),
-    m_bCapabilitiesSent(false),
-    m_iPowerStatusRequested(0)
+    m_bCapabilitiesSent(false)
 {
   m_vendorId = CEC_VENDOR_PANASONIC;
 }
@@ -203,6 +200,7 @@ int CVLCommandHandler::HandleStandby(const cec_command &command)
   {
     CLockObject lock(m_mutex);
     m_iPowerUpEventReceived = 0;
+    m_bCapabilitiesSent = false;
   }
 
   return CCECCommandHandler::HandleStandby(command);
@@ -221,14 +219,14 @@ void CVLCommandHandler::VendorPreActivateSourceHook(void)
 
 void CVLCommandHandler::SendVendorCommandCapabilities(const cec_logical_address initiator, const cec_logical_address destination)
 {
-  cec_command response;
-  cec_command::Format(response, initiator, destination, CEC_OPCODE_VENDOR_COMMAND);
-  uint8_t iResponseData[] = {0x10, 0x02, 0xFF, 0xFF, 0x00, 0x05, 0x05, 0x45, 0x55, 0x5c, 0x58, 0x32};
-  response.PushArray(12, iResponseData);
-
-  if (Transmit(response, false, true))
+  if (PowerUpEventReceived())
   {
-    if (PowerUpEventReceived())
+    cec_command response;
+    cec_command::Format(response, initiator, destination, CEC_OPCODE_VENDOR_COMMAND);
+    uint8_t iResponseData[] = {0x10, 0x02, 0xFF, 0xFF, 0x00, 0x05, 0x05, 0x45, 0x55, 0x5c, 0x58, 0x32};
+    response.PushArray(12, iResponseData);
+
+    if (Transmit(response, false, true))
     {
       CLockObject lock(m_mutex);
       m_bCapabilitiesSent = true;
@@ -252,16 +250,9 @@ int CVLCommandHandler::HandleVendorCommand(const cec_command &command)
   return CEC_ABORT_REASON_INVALID_OPERAND;
 }
 
-bool CVLCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
-{
-  m_iPowerStatusRequested = GetTimeMs();
-  return CCECCommandHandler::TransmitRequestPowerStatus(iInitiator, iDestination, bWaitForResponse);
-}
-
 bool CVLCommandHandler::SourceSwitchAllowed(void)
 {
-  int64_t now(GetTimeMs());
-  if (!PowerUpEventReceived() && now - m_iPowerStatusRequested > VL_REQUEST_POWER_STATUS_TIMEOUT)
+  if (!PowerUpEventReceived())
     TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false);
 
   return PowerUpEventReceived();
index b878ca97bee17da48f243a1d40db99920f12a03d..3ad80b49150b53749bc61d0f306f972631a5a00c 100644 (file)
@@ -55,7 +55,6 @@ namespace CEC
     bool PowerUpEventReceived(void);
     bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; };
     cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; }
-    bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
 
     bool SourceSwitchAllowed(void);
 
@@ -67,6 +66,5 @@ namespace CEC
     PLATFORM::CMutex m_mutex;
     uint64_t         m_iPowerUpEventReceived;
     bool             m_bCapabilitiesSent;
-    int64_t          m_iPowerStatusRequested;
   };
 };
index 24ddde594eb7b9abd67503c6ee3fd453c65012ed..2050ee91000873ed899cdc16f97e2390aeb50aba 100644 (file)
@@ -48,7 +48,7 @@ using namespace CEC;
 using namespace std;
 using namespace PLATFORM;
 
-#define CEC_CONFIG_VERSION CEC_CLIENT_VERSION_2_0_1;
+#define CEC_CONFIG_VERSION CEC_CLIENT_VERSION_2_0_2;
 
 #include "../../include/cecloader.h"