From: Lars Op den Kamp Date: Mon, 31 Oct 2011 00:40:13 +0000 (+0100) Subject: cec: removed framebuffer in CCECProcessor. any other packet is an unexpected reply X-Git-Tag: upstream/2.2.0~1^2~152 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=88c43521c98366880d9ea218aa476f278607b322;p=deb_libcec.git cec: removed framebuffer in CCECProcessor. any other packet is an unexpected reply --- diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index 7459766..0fee28b 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -85,6 +85,7 @@ CCECAdapterMessage::CCECAdapterMessage(const cec_command &command) CCECAdapterMessage &CCECAdapterMessage::operator =(const CCECAdapterMessage &msg) { packet = msg.packet; + state = msg.state; return *this; } diff --git a/src/lib/AdapterCommunication.h b/src/lib/AdapterCommunication.h index 2ec6e3b..73b3bd2 100644 --- a/src/lib/AdapterCommunication.h +++ b/src/lib/AdapterCommunication.h @@ -55,6 +55,7 @@ namespace CEC public: CCECAdapterMessage(void) { clear(); } CCECAdapterMessage(const cec_command &command); + CCECAdapterMessage &operator =(const CCECAdapterMessage &msg); bool empty(void) const { return packet.empty(); } uint8_t operator[](uint8_t pos) const { return packet[pos]; } @@ -74,9 +75,6 @@ namespace CEC cec_adapter_message_state state; CMutex mutex; CCondition condition; - - private: - CCECAdapterMessage &operator =(const CCECAdapterMessage &msg); }; typedef boost::shared_ptr CCECAdapterMessagePtr; diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 79cee66..f0f951e 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -114,13 +114,9 @@ void *CCECProcessor::Process(void) { CLockObject lock(&m_mutex); - CCECAdapterMessagePtr msgPtr; - if (m_frameBuffer.Pop(msgPtr)) - bParseFrame = ParseMessage(*msgPtr.get()); - else if (m_communication->IsOpen() && m_communication->Read(msg, 50)) - bParseFrame = ParseMessage(msg); + if (m_communication->IsOpen() && m_communication->Read(msg, 50)) + bParseFrame = ParseMessage(msg) && !IsStopped(); - bParseFrame &= !IsStopped(); if (bParseFrame) command = m_currentframe; } @@ -365,8 +361,10 @@ bool CCECProcessor::WaitForAck(bool *bError, uint8_t iLength, uint32_t iTimeout *bError = true; break; default: - CCECAdapterMessagePtr msgPtr = CCECAdapterMessagePtr(new CCECAdapterMessage(msg)); - m_frameBuffer.Push(msgPtr); + CStdString strLog; + strLog.Format("received unexpected reply '%2x'", msg.message()); + m_controller->AddLog(CEC_LOG_WARNING, strLog); + *bError = true; break; } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 6c62c9f..fa5d6fe 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -87,7 +87,6 @@ namespace CEC cec_command m_currentframe; cec_logical_address m_iLogicalAddress; - CecBuffer m_frameBuffer; std::string m_strDeviceName; CMutex m_mutex; CCondition m_startCondition;