From: Lars Op den Kamp Date: Wed, 3 Oct 2012 15:33:58 +0000 (+0200) Subject: fixed - message response signaling and logging X-Git-Tag: upstream/2.2.0~1^2~17^2^2~37 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7ff1180d98816f50d45282032e7f1155faa3e1c9;p=deb_libcec.git fixed - message response signaling and logging --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 4ae1efe..409b30b 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -438,7 +438,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bIsReply) } return bIsReply ? - adapterState != ADAPTER_MESSAGE_STATE_ERROR : + adapterState == ADAPTER_MESSAGE_STATE_SENT_ACKED || adapterState == ADAPTER_MESSAGE_STATE_SENT || adapterState == ADAPTER_MESSAGE_STATE_WAITING_TO_BE_SENT : adapterState == ADAPTER_MESSAGE_STATE_SENT_ACKED; } diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterMessage.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterMessage.cpp index f5d0735..5756283 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterMessage.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterMessage.cpp @@ -174,7 +174,7 @@ const char *CCECAdapterMessage::ToString(cec_adapter_messagecode msgCode) case MSGCODE_TRANSMIT_IDLETIME: return "TRANSMIT_IDLETIME"; case MSGCODE_TRANSMIT_ACK_POLARITY: - return "TRANSMIT_ACK_POLARITY"; + return "CEC transmission"; case MSGCODE_TRANSMIT_LINE_TIMEOUT: return "TRANSMIT_LINE_TIMEOUT"; case MSGCODE_TRANSMIT_SUCCEEDED: diff --git a/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp b/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp index a4924b8..77f93c7 100644 --- a/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp +++ b/src/lib/adapter/Pulse-Eight/USBCECAdapterMessageQueue.cpp @@ -134,6 +134,9 @@ bool CCECAdapterMessageQueueEntry::IsResponseOld(const CCECAdapterMessage &msg) bool CCECAdapterMessageQueueEntry::IsResponse(const CCECAdapterMessage &msg) { + if (m_message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED) + return false; + cec_adapter_messagecode thisMsgCode = m_message->Message(); cec_adapter_messagecode msgCode = msg.Message(); cec_adapter_messagecode msgResponse = msg.ResponseTo(); @@ -231,7 +234,7 @@ bool CCECAdapterMessageQueueEntry::MessageReceivedTransmitSucceeded(const CCECAd if (m_iPacketsLeft == 0) { /* transmission succeeded, so we're done */ - m_queue->m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "%s - transmit succeeded", ToString()); + m_queue->m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "%s - transmit succeeded", m_message->ToString().c_str()); m_message->state = ADAPTER_MESSAGE_STATE_SENT_ACKED; m_message->response = message.packet; } @@ -337,12 +340,7 @@ void CCECAdapterMessageQueue::CheckTimedOutMessages(void) { timedOut.push_back(it->first); if (!it->second->m_bSucceeded) - { - if (it->second->m_message->IsTranmission()) - m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "transmission '%s' was not acked by the controller", it->second->m_message->ToString().c_str()); - else - m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "command '%s' was not acked by the controller", CCECAdapterMessage::ToString(it->second->m_message->Message())); - } + m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "command '%s' was not acked by the controller", CCECAdapterMessage::ToString(it->second->m_message->Message())); delete it->second->m_message; delete it->second; } @@ -441,10 +439,7 @@ bool CCECAdapterMessageQueue::Write(CCECAdapterMessage *msg) { if (!entry->Wait(msg->transmit_timeout <= 5 ? CEC_DEFAULT_TRANSMIT_WAIT : msg->transmit_timeout)) { - if (msg->IsTranmission()) - m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "transmission '%s' was not acked by the controller", msg->ToString().c_str()); - else - m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "command '%s' was not acked by the controller", CCECAdapterMessage::ToString(msg->Message())); + m_com->m_callback->GetLib()->AddLog(CEC_LOG_DEBUG, "command '%s' was not acked by the controller", CCECAdapterMessage::ToString(msg->Message())); msg->state = ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED; bReturn = false; }