cec: fixed return value from CAdapterCommunication::Write() when CCECAdapterMessage...
authorLars Op den Kamp <lars@opdenkamp.eu>
Wed, 25 Jan 2012 11:21:46 +0000 (12:21 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Wed, 25 Jan 2012 11:29:35 +0000 (12:29 +0100)
src/lib/CECProcessor.cpp
src/lib/adapter/AdapterCommunication.cpp

index 659eae3ecf88376ef158bd01ef28ec13b89ce25d..0c409eb6eee23073393373c1ce27d424946d4647 100644 (file)
@@ -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);
 
index cc8507fe849290bfb60fade2a1d0aa528031b7a8..15b6851ae5abcf843d00d516626095ad85ae7ee5 100644 (file)
@@ -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;