cec-config-gui: make the progress bar invisible when done. disable the physical addre...
[deb_libcec.git] / src / lib / adapter / USBCECAdapterCommunication.cpp
index 3b32ebd3b259af9b312c4922e09843f741472949..96571cc3dc52bcb5fb4df06ea55e7fdfcae4d17c 100644 (file)
@@ -173,12 +173,12 @@ bool CUSBCECAdapterCommunication::Open(IAdapterCommunicationCallback *cb, uint32
 
 void CUSBCECAdapterCommunication::Close(void)
 {
-  SetAckMask(0);
   {
     CLockObject lock(m_mutex);
     m_bHasData = true;
     m_rcvCondition.Broadcast();
   }
+  SetAckMask(0);
   StopThread();
 }
 
@@ -663,6 +663,7 @@ bool CUSBCECAdapterCommunication::ReadFromDevice(uint32_t iTimeout, size_t iSize
   if (iBytesRead < 0 || iBytesRead > 256)
   {
     CLibCEC::AddLog(CEC_LOG_ERROR, "error reading from serial port: %s", m_port->GetError().c_str());
+    StopThread(false);
     return false;
   }
   else if (iBytesRead > 0)
@@ -706,3 +707,10 @@ void CUSBCECAdapterCommunication::WriteNextCommand(void)
   if (m_outBuffer.Pop(msg))
     SendMessageToAdapter(msg);
 }
+
+CStdString CUSBCECAdapterCommunication::GetPortName(void)
+{
+  CStdString strName;
+  strName = m_port->GetName();
+  return strName;
+}