cec: poll doesn't have an opcode. bugzid: 591
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 19 Mar 2012 11:46:32 +0000 (12:46 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 19 Mar 2012 11:46:32 +0000 (12:46 +0100)
src/lib/CECProcessor.cpp
src/lib/adapter/USBCECAdapterCommunication.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index a4218406f620013555cb63ee1b0d93bdfbb55907..23afdb623bdfb7c0217fbcd289af5bc1fd129ed7 100644 (file)
@@ -912,7 +912,9 @@ void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode
 void CCECProcessor::ParseCommand(const cec_command &command)
 {
   CStdString dataStr;
-  dataStr.Format(">> %1x%1x:%02x", command.initiator, command.destination, command.opcode);
+  dataStr.Format(">> %1x%1x", command.initiator, command.destination);
+  if (command.opcode_set == 1)
+    dataStr.AppendFormat(":%02x", command.opcode);
   for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
     dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]);
   CLibCEC::AddLog(CEC_LOG_TRAFFIC, dataStr.c_str());
index 2f1247410e6f099013fcce5a20097482ae4b6477..64212cb18a99cb01823c0326d5fd42e88ee8250d 100644 (file)
@@ -415,8 +415,9 @@ bool CUSBCECAdapterCommunication::ParseMessage(const CCECAdapterMessage &msg)
       }
       if (m_currentframe.ack == 0x1)
       {
-        m_lastInitiator = m_currentframe.initiator;
-        m_processor->HandlePoll(m_currentframe.initiator, m_currentframe.destination);
+        m_lastInitiator    = m_currentframe.initiator;
+        m_currentframe.eom = 1;
+        bEom = true;
       }
     }
     break;
@@ -441,7 +442,7 @@ bool CUSBCECAdapterCommunication::ParseMessage(const CCECAdapterMessage &msg)
   }
 
   CLibCEC::AddLog(bIsError ? CEC_LOG_WARNING : CEC_LOG_DEBUG, msg.ToString());
-  return msg.IsEOM();
+  return msg.IsEOM() || bEom;
 }
 
 uint16_t CUSBCECAdapterCommunication::GetFirmwareVersion(void)
index 845cb07d6426af2ab801fa7ba674a439c7628517..429d73fbd162f137870f8c5ed3b479c7fbe80504 100644 (file)
@@ -88,7 +88,7 @@ bool CCECBusDevice::HandleCommand(const cec_command &command)
     m_iLastActive = GetTimeMs();
 
     /* don't call GetStatus() here, just read the value with the mutex locked */
-    if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC)
+    if (m_deviceStatus != CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC && command.opcode_set == 1)
       m_deviceStatus = CEC_DEVICE_STATUS_PRESENT;
 
     MarkBusy();
index a9b4c40c57f2c7f483b9e1036ee60357a233fc88..d0aa2b32937ef3d82785729ee87e4fcc2f33c32f 100644 (file)
@@ -61,6 +61,9 @@ CCECCommandHandler::~CCECCommandHandler(void)
 
 bool CCECCommandHandler::HandleCommand(const cec_command &command)
 {
+  if (command.opcode_set == 0)
+    return HandlePoll(command);
+
   bool bHandled(true);
 
   CLibCEC::AddCommand(command);
@@ -371,6 +374,12 @@ bool CCECCommandHandler::HandleMenuRequest(const cec_command &command)
   return false;
 }
 
+bool CCECCommandHandler::HandlePoll(const cec_command &command)
+{
+  m_busDevice->HandlePoll(command.initiator);
+  return true;
+}
+
 bool CCECCommandHandler::HandleReportAudioStatus(const cec_command &command)
 {
   if (command.parameters.size == 1)
index 4cfb81fbd1510d932777b4e9a10c17554ce3aa3a..6cf16a4b4615290b52507c8833498917406b4701 100644 (file)
@@ -174,6 +174,7 @@ namespace CEC
     virtual bool HandleGiveSystemAudioModeStatus(const cec_command &command);
     virtual bool HandleImageViewOn(const cec_command &command);
     virtual bool HandleMenuRequest(const cec_command &command);
+    virtual bool HandlePoll(const cec_command &command);
     virtual bool HandleReportAudioStatus(const cec_command &command);
     virtual bool HandleReportPhysicalAddress(const cec_command &command);
     virtual bool HandleReportPowerStatus(const cec_command &command);