Revert "rpi: don't try to release the logical address (and fail). fix verified by...
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 25 Feb 2013 00:49:34 +0000 (01:49 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 25 Feb 2013 00:54:15 +0000 (01:54 +0100)
This reverts commits ab2ab9ee1ac85713acdd5c29f1c35a5992fae214 and 644b3ecf926e3745d9119ace2acc971e94e2925a.

src/lib/adapter/RPi/RPiCECAdapterCommunication.cpp

index f15b1c0baad3b1dd9f8404182f229992c064d122..145e42ba34b96f57229a1bc38b40791a6e562b44 100644 (file)
@@ -293,7 +293,7 @@ int CRPiCECAdapterCommunication::InitHostCEC(void)
   return VCHIQ_SUCCESS;
 }
 
-bool CRPiCECAdapterCommunication::Open(uint32_t UNUSED(iTimeoutMs) /* = CEC_DEFAULT_CONNECT_TIMEOUT */, bool UNUSED(bSkipChecks) /* = false */, bool bStartListening)
+bool CRPiCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */, bool UNUSED(bSkipChecks) /* = false */, bool bStartListening)
 {
   Close();
 
@@ -309,6 +309,14 @@ bool CRPiCECAdapterCommunication::Open(uint32_t UNUSED(iTimeoutMs) /* = CEC_DEFA
     vc_cec_register_callback(rpi_cec_callback, (void*)this);
     vc_tv_register_callback(rpi_tv_callback, (void*)this);
 
+    // release previous LA
+    vc_cec_release_logical_address();
+    if (!m_logicalAddressCondition.Wait(m_mutex, m_bLogicalAddressChanged, iTimeoutMs))
+    {
+      LIB_CEC->AddLog(CEC_LOG_ERROR, "failed to release the previous LA");
+      return false;
+    }
+
     // register LA "freeuse"
     if (RegisterLogicalAddress(CECDEVICE_FREEUSE))
     {