From: Lars Op den Kamp Date: Tue, 1 Nov 2011 00:45:38 +0000 (+0100) Subject: cec: only send unhandled and selected commands to the command buffer X-Git-Tag: upstream/2.2.0~1^2~146 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a9e03a86e80816cc64a10df33cff8fc296b2656e;p=deb_libcec.git cec: only send unhandled and selected commands to the command buffer --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 0ae2250..8b8532d 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -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) diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index 7faa5fb..0678ce3 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -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); } } diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index 9320682..ac00ebf 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -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 { diff --git a/src/lib/implementations/CECCommandHandler.h b/src/lib/implementations/CECCommandHandler.h index e7184df..0505c7c 100644 --- a/src/lib/implementations/CECCommandHandler.h +++ b/src/lib/implementations/CECCommandHandler.h @@ -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;