cec: call SetControlledMode(false) as last command when closing the connection in...
[deb_libcec.git] / src / lib / adapter / USBCECAdapterCommunication.cpp
index e51a861f28579ebe6d5685c883032626e05add52..f56bdf4b1f029a233cce849e74df727ba905918f 100644 (file)
@@ -252,6 +252,9 @@ void *CUSBCECAdapterCommunication::Process(void)
   /* set the ackmask to 0 before closing the connection */
   SetAckMaskInternal(0, true);
 
+  if (m_iFirmwareVersion >= 2)
+    SetControlledMode(false);
+
   if (m_port)
   {
     delete m_port;
@@ -571,7 +574,7 @@ bool CUSBCECAdapterCommunication::SetControlledMode(bool controlled)
   output->isTransmission = false;
 
   SendMessageToAdapter(output);
-  bool bWriteOk = output->state == ADAPTER_MESSAGE_STATE_SENT;
+  bool bWriteOk = output->state == ADAPTER_MESSAGE_STATE_SENT_ACKED;
   delete output;
   if (!bWriteOk)
   {