From: Lars Op den Kamp Date: Wed, 25 Jan 2012 11:21:46 +0000 (+0100) Subject: cec: fixed return value from CAdapterCommunication::Write() when CCECAdapterMessage... X-Git-Tag: upstream/2.2.0~1^2~39^2~13 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4060d525db2e96103a134bf4383cc5a73db5703f;p=deb_libcec.git cec: fixed return value from CAdapterCommunication::Write() when CCECAdapterMessage::expectControllerAck is false --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 659eae3..0c409eb 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -860,7 +860,7 @@ bool CCECProcessor::Transmit(const cec_command &data) bReturn = Transmit(output); /* set to "not present" on failed ack */ - if (output->IsError() && output->reply == MSGCODE_TRANSMIT_FAILED_ACK && + if (output->state == ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED && output->Destination() != CECDEVICE_BROADCAST) m_busDevices[output->Destination()]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT); diff --git a/src/lib/adapter/AdapterCommunication.cpp b/src/lib/adapter/AdapterCommunication.cpp index cc8507f..15b6851 100644 --- a/src/lib/adapter/AdapterCommunication.cpp +++ b/src/lib/adapter/AdapterCommunication.cpp @@ -152,16 +152,24 @@ bool CAdapterCommunication::Write(CCECAdapterMessage *data) { m_processor->AddLog(CEC_LOG_ERROR, "command was not sent"); } - if (data->expectControllerAck && WaitForTransmitSucceeded(data)) + + if (data->expectControllerAck) { - if (data->isTransmission) - data->state = ADAPTER_MESSAGE_STATE_SENT_ACKED; - bReturn = true; + bReturn = WaitForTransmitSucceeded(data); + if (bReturn) + { + if (data->isTransmission) + data->state = ADAPTER_MESSAGE_STATE_SENT_ACKED; + } + else + { + data->state = ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED; + m_processor->AddLog(CEC_LOG_DEBUG, "did not receive ack"); + } } else { - data->state = ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED; - m_processor->AddLog(CEC_LOG_DEBUG, "did not receive ack"); + bReturn = true; } return bReturn;