cec: update m_iLineTimeout correctly in CUSBCECAdapterCommunication::SetLineTimeout()
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 22 Mar 2012 10:44:04 +0000 (11:44 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 22 Mar 2012 10:56:10 +0000 (11:56 +0100)
src/lib/adapter/USBCECAdapterCommunication.cpp

index 49bd9ea5fa40521affe14746eedccff79d7d9fed..e092274457e05bec260b6bd5b27fe9d4150cf763 100644 (file)
@@ -487,15 +487,16 @@ uint16_t CUSBCECAdapterCommunication::GetFirmwareVersion(void)
 
 bool CUSBCECAdapterCommunication::SetLineTimeout(uint8_t iTimeout)
 {
-  m_iLineTimeout = iTimeout;
-  bool bReturn(m_iLineTimeout != iTimeout);
+  bool bReturn(true);
 
-  if (!bReturn)
+  if (m_iLineTimeout != iTimeout)
   {
     CLibCEC::AddLog(CEC_LOG_DEBUG, "setting the line timeout to %d", iTimeout);
     CCECAdapterMessage params;
     params.PushEscaped(iTimeout);
     bReturn = SendCommand(MSGCODE_TRANSMIT_IDLETIME, params);
+    if (bReturn)
+      m_iLineTimeout = iTimeout;
   }
 
   return bReturn;