cec: only send unhandled and selected commands to the command buffer
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 1 Nov 2011 00:45:38 +0000 (01:45 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 1 Nov 2011 00:45:38 +0000 (01:45 +0100)
src/lib/CECProcessor.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h

index 0ae22507ea8bbbc9f51e84b467bccbd7b5e023f7..8b8532d7c1d6d2c30df9673d8369fab56fe43e9b 100644 (file)
@@ -394,7 +394,7 @@ void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode)
 
 void CCECProcessor::AddCommand(const cec_command &command)
 {
-  m_controller->AddCommand(command);
+//  m_controller->AddCommand(command);
 }
 
 void CCECProcessor::AddKey(void)
index 7faa5fb6a10252da1b43e2f6284352b91f7e7673..0678ce393ef8dfe3a1825e8904940af6a9de6b12 100644 (file)
@@ -212,7 +212,8 @@ void CCECBusDevice::PollVendorId(void)
 
     cec_command command;
     cec_command::format(command, GetMyLogicalAddress(), GetLogicalAddress(), CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
-    m_processor->Transmit(command);
+    if (m_processor->Transmit(command))
+      m_condition.Wait(&m_mutex, 1000);
   }
 }
 
index 932068254acd71e8b6864646c58a7c05a3ca8c85..ac00ebf86ab18e9957ce66fcd1a5d9d09d6cb77a 100644 (file)
@@ -57,6 +57,7 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
       break;
     case CEC_OPCODE_SET_MENU_LANGUAGE:
       HandleSetMenuLanguage(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       break;
     case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
       HandleGivePhysicalAddress(command);
@@ -93,11 +94,10 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
       break;
     default:
       UnhandledCommand(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       bHandled = false;
       break;
     }
-
-    m_busDevice->GetProcessor()->AddCommand(command);
   }
   else if (command.destination == CECDEVICE_BROADCAST)
   {
@@ -106,15 +106,18 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
     {
     case CEC_OPCODE_SET_MENU_LANGUAGE:
       HandleSetMenuLanguage(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       break;
     case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
       HandleRequestActiveSource(command);
       break;
     case CEC_OPCODE_SET_STREAM_PATH:
       HandleSetStreamPath(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       break;
     case CEC_OPCODE_ROUTING_CHANGE:
       HandleRoutingChange(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       break;
     case CEC_OPCODE_DEVICE_VENDOR_ID:
       HandleDeviceVendorId(command);
@@ -124,11 +127,10 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
      break;
     default:
       UnhandledCommand(command);
+      m_busDevice->GetProcessor()->AddCommand(command);
       bHandled = false;
       break;
     }
-
-    m_busDevice->GetProcessor()->AddCommand(command);
   }
   else
   {
index e7184dfc8d708836acd22e8d731e36c2d105541d..0505c7cc81ff23e77ec1a78ae0bc825d4d1e152b 100644 (file)
@@ -66,6 +66,8 @@ namespace CEC
     bool HandleUserControlRelease(const cec_command &command);
     void UnhandledCommand(const cec_command &command);
 
+    void SendToCommandBuffer(const cec_command &command);
+
     CCECBusDevice *GetDevice(cec_logical_address iLogicalAddress) const;
     CCECBusDevice *GetThisDevice(void) const;
     CCECBusDevice *m_busDevice;