cec: only report the menu state when the parameter is CEC_MENU_REQUEST_TYPE_QUERY
authorLars Op den Kamp <lars@opdenkamp.eu>
Sat, 8 Oct 2011 16:43:02 +0000 (18:43 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sat, 8 Oct 2011 16:43:02 +0000 (18:43 +0200)
src/lib/AdapterCommunication.cpp
src/lib/CECProcessor.cpp

index aeecf3ad2c5b8674e46687d10630cf60e8cfe33c..cc83320aae0084e55b7499b360a3e5883f8225e2 100644 (file)
@@ -188,8 +188,6 @@ bool CAdapterCommunication::Write(const cec_frame &data)
     }
 
     m_controller->AddLog(CEC_LOG_DEBUG, "command sent");
-
-    CCondition::Sleep((uint32_t) data.size * (uint32_t)24 /*data*/ + (uint32_t)5 /*start bit (4.5 ms)*/);
   }
 
   return true;
index a313e0921c93e1b3d4f072e59405eebd88e41ea6..964f359bce3d11f875f9ea1d1863290d2c292451 100644 (file)
@@ -241,6 +241,8 @@ bool CCECProcessor::TransmitFormatted(const cec_frame &data, bool bWaitForAck /*
   if (!m_communication || !m_communication->Write(data))
     return false;
 
+  CCondition::Sleep((uint32_t) data.size * (uint32_t)24 /*data*/ + (uint32_t)5 /*start bit (4.5 ms)*/);
+
   if (bWaitForAck)
   {
     uint64_t now = GetTimeMs();
@@ -579,7 +581,9 @@ void CCECProcessor::ParseCurrentFrame(cec_frame &frame)
       TransmitAbort((cec_logical_address)initiator, CEC_OPCODE_GIVE_DECK_STATUS);
       break;
     case CEC_OPCODE_MENU_REQUEST:
-      ReportMenuState((cec_logical_address)initiator);
+      frame.shift(2);
+      if (frame.data[0] == CEC_MENU_REQUEST_TYPE_QUERY)
+        ReportMenuState((cec_logical_address)initiator);
       break;
     case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
       ReportPowerState((cec_logical_address)initiator);