cec: mark the tv as powered up for panasonic once it sends the audiomode request
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 25 Jun 2012 14:48:18 +0000 (16:48 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 25 Jun 2012 14:58:30 +0000 (16:58 +0200)
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h

index c347649c9c0b9989ca7be74fc82b3fee8713f804..d8d7f6c205ac52148a1ca8eada8b279130d1c4c4 100644 (file)
@@ -41,6 +41,7 @@
 #define VL_POWER_CHANGE 0x20
 #define VL_POWERED_UP   0x00
 #define VL_POWERED_DOWN 0x01
+#define VL_UNKNOWN1     0x06
 
 using namespace CEC;
 using namespace PLATFORM;
@@ -90,6 +91,18 @@ int CVLCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &comman
     return CEC_ABORT_REASON_INVALID_OPERAND;
 
   if (command.initiator == CECDEVICE_TV &&
+      command.parameters.At(3) == VL_UNKNOWN1)
+  {
+    // set the power up event time
+    {
+      CLockObject lock(m_mutex);
+      if (m_iPowerUpEventReceived == 0)
+        m_iPowerUpEventReceived = GetTimeMs();
+    }
+    // mark the TV as powered on
+    m_processor->GetTV()->SetPowerStatus(CEC_POWER_STATUS_ON);
+  }
+  else if (command.initiator == CECDEVICE_TV &&
       command.destination == CECDEVICE_BROADCAST &&
       command.parameters.At(3) == VL_POWER_CHANGE)
   {
@@ -195,3 +208,20 @@ bool CVLCommandHandler::SourceSwitchAllowed(void)
 {
   return PowerUpEventReceived();
 }
+
+int CVLCommandHandler::HandleSystemAudioModeRequest(const cec_command &command)
+{
+  if (command.initiator == CECDEVICE_TV)
+  {
+    // set the power up event time
+    {
+      CLockObject lock(m_mutex);
+      if (m_iPowerUpEventReceived == 0)
+        m_iPowerUpEventReceived = GetTimeMs();
+    }
+    // mark the TV as powered on
+    m_processor->GetTV()->SetPowerStatus(CEC_POWER_STATUS_ON);
+  }
+
+  return CCECCommandHandler::HandleSystemAudioModeRequest(command);
+}
index 433a3944427fa06b4a59c99752a00965e6343e8e..6f417e8e14f415774804658ec9ca2fc016f8a25d 100644 (file)
@@ -45,6 +45,7 @@ namespace CEC
 
     int HandleDeviceVendorCommandWithId(const cec_command &command);
     int HandleStandby(const cec_command &command);
+    int HandleSystemAudioModeRequest(const cec_command &command);
 
     int HandleVendorCommand(const cec_command &command);
     bool PowerUpEventReceived(void);