close the port connection if a command couldn't be written. this will trigger an...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 14 May 2012 20:04:12 +0000 (22:04 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 14 May 2012 20:04:12 +0000 (22:04 +0200)
src/lib/adapter/USBCECAdapterCommunication.cpp

index 08ae62c701e681250a4948d59b16ccd908269ddc..70eddb84c0cb4755cada60539bf67460194f05fd 100644 (file)
@@ -386,7 +386,7 @@ bool CUSBCECAdapterCommunication::ReadFromDevice(uint32_t iTimeout, size_t iSize
 
 CCECAdapterMessage *CUSBCECAdapterCommunication::SendCommand(cec_adapter_messagecode msgCode, CCECAdapterMessage &params, bool bIsRetry /* = false */)
 {
-  if (!m_port->IsOpen() || !m_adapterMessageQueue)
+  if (!IsOpen() || !m_adapterMessageQueue)
     return NULL;
 
   /* create the adapter message for this command */
@@ -399,14 +399,9 @@ CCECAdapterMessage *CUSBCECAdapterCommunication::SendCommand(cec_adapter_message
   /* write the command */
   if (!m_adapterMessageQueue->Write(output))
   {
+    // this will trigger an alert in the reader thread
     if (output->state == ADAPTER_MESSAGE_STATE_ERROR)
-    {
-      libcec_parameter param;
-      param.paramData = NULL; param.paramType = CEC_PARAMETER_TYPE_UNKOWN;
-      LIB_CEC->Alert(CEC_ALERT_CONNECTION_LOST, param);
-
-      Close();
-    }
+      m_port->Close();
     return output;
   }
   else