mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
projects/Cuboxi/patches/libcec: update libCcec support patch (see https://github.com/mk01/libcec-1)
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
95f480d20e
commit
399d7af6ea
@ -1,214 +0,0 @@
|
|||||||
From d821a5f9b03a436950570ee9d7741452248f72e8 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wolfgar <stephan.rafin@laposte.net>
|
|
||||||
Date: Wed, 23 Apr 2014 03:16:04 +0200
|
|
||||||
Subject: [PATCH 1/2] Fix physical address retrieval and notify new address
|
|
||||||
after unplug/plug
|
|
||||||
|
|
||||||
---
|
|
||||||
src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp | 13 ++++++++++++-
|
|
||||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp b/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
index 54e5662..a226a70 100644
|
|
||||||
--- a/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
+++ b/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
@@ -189,14 +189,18 @@ cec_vendor_id CIMXCECAdapterCommunication::GetVendorId(void)
|
|
||||||
uint16_t CIMXCECAdapterCommunication::GetPhysicalAddress(void)
|
|
||||||
{
|
|
||||||
uint32_t info;
|
|
||||||
+ uint16_t phy_addr;
|
|
||||||
|
|
||||||
if (m_dev->Ioctl(HDMICEC_IOC_GETPHYADDRESS, &info) != 0)
|
|
||||||
{
|
|
||||||
LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: HDMICEC_IOC_GETPHYADDRESS failed !", __func__);
|
|
||||||
return CEC_INVALID_PHYSICAL_ADDRESS;
|
|
||||||
}
|
|
||||||
+ /* Rebuild 16 bit raw value from fsl 32 bits value */
|
|
||||||
+ phy_addr = ((info & 0x0f) << 12) | (info & 0x0f00) |
|
|
||||||
+ ((info & 0x0f0000) >> 12) | ((info & 0x0f000000) >> 24);
|
|
||||||
|
|
||||||
- return info;
|
|
||||||
+ return phy_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -266,6 +270,13 @@ void *CIMXCECAdapterCommunication::Process(void)
|
|
||||||
if (!IsStopped())
|
|
||||||
m_callback->OnCommandReceived(cmd);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (event.event_type == MESSAGE_TYPE_CONNECTED)
|
|
||||||
+ /* HDMI has just been reconnected - Notify phy address*/
|
|
||||||
+ {
|
|
||||||
+ uint16_t iNewAddress = GetPhysicalAddress();
|
|
||||||
+ m_callback->HandlePhysicalAddressChanged(iNewAddress);
|
|
||||||
+ }
|
|
||||||
/* We are not interested in other events */
|
|
||||||
} /*else {
|
|
||||||
LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s: Read returned %d", __func__, ret);
|
|
||||||
--
|
|
||||||
1.7.9.5
|
|
||||||
|
|
||||||
|
|
||||||
From 42c3c07a79b8155635851c2eed9558b221b89047 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wolfgar <stephan.rafin@laposte.net>
|
|
||||||
Date: Sat, 26 Apr 2014 01:48:06 +0200
|
|
||||||
Subject: [PATCH 2/2] Grab enhancements from mk01 commit
|
|
||||||
https://github.com/mk01/libcec/commit/40ac7550fe22a9fed665eec0aec1882498f838d6#diff-f2ea3f151edca2fc91b2f3cea1159c9bR336
|
|
||||||
|
|
||||||
---
|
|
||||||
src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp | 58 ++++++++++++++++----
|
|
||||||
src/lib/adapter/IMX/IMXCECAdapterCommunication.h | 9 ++-
|
|
||||||
2 files changed, 55 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp b/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
index a226a70..1f70989 100644
|
|
||||||
--- a/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
+++ b/src/lib/adapter/IMX/IMXCECAdapterCommunication.cpp
|
|
||||||
@@ -88,6 +88,8 @@ CIMXCECAdapterCommunication::CIMXCECAdapterCommunication(IAdapterCommunicationCa
|
|
||||||
m_iNextMessage = 0;
|
|
||||||
//m_logicalAddresses.Clear();
|
|
||||||
m_logicalAddress = CECDEVICE_UNKNOWN;
|
|
||||||
+ m_bLogicalAddressRegistered = false;
|
|
||||||
+ m_bInitialised = false;
|
|
||||||
m_dev = new CCDevSocket(CEC_IMX_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -110,10 +112,11 @@ bool CIMXCECAdapterCommunication::Open(uint32_t iTimeoutMs, bool UNUSED(bSkipChe
|
|
||||||
if (m_dev->Open(iTimeoutMs))
|
|
||||||
{
|
|
||||||
if (!bStartListening || CreateThread()) {
|
|
||||||
- if (m_dev->Ioctl(HDMICEC_IOC_STARTDEVICE, NULL) != 0) {
|
|
||||||
- LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: Unable to start device\n", __func__);
|
|
||||||
+ if (m_dev->Ioctl(HDMICEC_IOC_STARTDEVICE, NULL) == 0) {
|
|
||||||
+ m_bInitialised = true;
|
|
||||||
+ return true;
|
|
||||||
}
|
|
||||||
- return true;
|
|
||||||
+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: Unable to start device\n", __func__);
|
|
||||||
}
|
|
||||||
m_dev->Close();
|
|
||||||
}
|
|
||||||
@@ -125,10 +128,16 @@ bool CIMXCECAdapterCommunication::Open(uint32_t iTimeoutMs, bool UNUSED(bSkipChe
|
|
||||||
void CIMXCECAdapterCommunication::Close(void)
|
|
||||||
{
|
|
||||||
StopThread(0);
|
|
||||||
+
|
|
||||||
+ CLockObject lock(m_mutex);
|
|
||||||
+ if (!m_bInitialised) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
if (m_dev->Ioctl(HDMICEC_IOC_STOPDEVICE, NULL) != 0) {
|
|
||||||
LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: Unable to stop device\n", __func__);
|
|
||||||
}
|
|
||||||
m_dev->Close();
|
|
||||||
+ m_bInitialised = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -210,31 +219,60 @@ cec_logical_addresses CIMXCECAdapterCommunication::GetLogicalAddresses(void)
|
|
||||||
addresses.Clear();
|
|
||||||
|
|
||||||
CLockObject lock(m_mutex);
|
|
||||||
- if ( m_logicalAddress != CECDEVICE_UNKNOWN)
|
|
||||||
+ if ((m_logicalAddress & (CECDEVICE_UNKNOWN | CECDEVICE_UNREGISTERED)) == 0)
|
|
||||||
addresses.Set(m_logicalAddress);
|
|
||||||
|
|
||||||
return addresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void CIMXCECAdapterCommunication::HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress))
|
|
||||||
+{
|
|
||||||
+ UnregisterLogicalAddress();
|
|
||||||
+}
|
|
||||||
|
|
||||||
-bool CIMXCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses)
|
|
||||||
+bool CIMXCECAdapterCommunication::UnregisterLogicalAddress(void)
|
|
||||||
{
|
|
||||||
- int log_addr = addresses.primary;
|
|
||||||
+ CLockObject lock(m_mutex);
|
|
||||||
+ if (!m_bLogicalAddressRegistered)
|
|
||||||
+ return true;
|
|
||||||
+
|
|
||||||
+ if (m_dev->Ioctl(HDMICEC_IOC_SETLOGICALADDRESS, (void *)CECDEVICE_BROADCAST) != 0)
|
|
||||||
+ {
|
|
||||||
+ LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: HDMICEC_IOC_SETLOGICALADDRESS failed !", __func__);
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
+ m_logicalAddress = CECDEVICE_UNKNOWN;
|
|
||||||
+ m_bLogicalAddressRegistered = false;
|
|
||||||
+ return true;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+bool CIMXCECAdapterCommunication::RegisterLogicalAddress(const cec_logical_address address)
|
|
||||||
+{
|
|
||||||
CLockObject lock(m_mutex);
|
|
||||||
- if (m_logicalAddress == log_addr)
|
|
||||||
- return true;
|
|
||||||
|
|
||||||
- if (m_dev->Ioctl(HDMICEC_IOC_SETLOGICALADDRESS, (void *)log_addr) != 0)
|
|
||||||
+ if (m_logicalAddress == address && m_bLogicalAddressRegistered)
|
|
||||||
+ {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (m_dev->Ioctl(HDMICEC_IOC_SETLOGICALADDRESS, (void *)address) != 0)
|
|
||||||
{
|
|
||||||
LIB_CEC->AddLog(CEC_LOG_ERROR, "%s: HDMICEC_IOC_SETLOGICALADDRESS failed !", __func__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- m_logicalAddress = (cec_logical_address)log_addr;
|
|
||||||
+ m_logicalAddress = address;
|
|
||||||
+ m_bLogicalAddressRegistered = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+bool CIMXCECAdapterCommunication::SetLogicalAddresses(const cec_logical_addresses &addresses)
|
|
||||||
+{
|
|
||||||
+ int log_addr = addresses.primary;
|
|
||||||
+
|
|
||||||
+ return RegisterLogicalAddress((cec_logical_address)log_addr);
|
|
||||||
+}
|
|
||||||
|
|
||||||
void *CIMXCECAdapterCommunication::Process(void)
|
|
||||||
{
|
|
||||||
diff --git a/src/lib/adapter/IMX/IMXCECAdapterCommunication.h b/src/lib/adapter/IMX/IMXCECAdapterCommunication.h
|
|
||||||
index 910dd39..ce5c4cb 100644
|
|
||||||
--- a/src/lib/adapter/IMX/IMXCECAdapterCommunication.h
|
|
||||||
+++ b/src/lib/adapter/IMX/IMXCECAdapterCommunication.h
|
|
||||||
@@ -85,7 +85,9 @@ namespace CEC
|
|
||||||
cec_adapter_type GetAdapterType(void) { return ADAPTERTYPE_IMX; }
|
|
||||||
uint16_t GetAdapterVendorId(void) const { return IMX_ADAPTER_VID; }
|
|
||||||
uint16_t GetAdapterProductId(void) const { return IMX_ADAPTER_PID; }
|
|
||||||
+ void HandleLogicalAddressLost(cec_logical_address UNUSED(oldAddress));
|
|
||||||
void SetActiveSource(bool UNUSED(bSetTo), bool UNUSED(bClientUnregistered)) {}
|
|
||||||
+ bool RegisterLogicalAddress(const cec_logical_address address);
|
|
||||||
///}
|
|
||||||
|
|
||||||
/** @name PLATFORM::CThread implementation */
|
|
||||||
@@ -94,7 +96,8 @@ namespace CEC
|
|
||||||
///}
|
|
||||||
|
|
||||||
private:
|
|
||||||
- bool IsInitialised(void) const { return m_dev != 0; };
|
|
||||||
+ bool IsInitialised(void) const { return m_bInitialised; };
|
|
||||||
+ bool UnregisterLogicalAddress(void);
|
|
||||||
|
|
||||||
std::string m_strError; /**< current error message */
|
|
||||||
|
|
||||||
@@ -103,7 +106,9 @@ namespace CEC
|
|
||||||
|
|
||||||
PLATFORM::CMutex m_mutex;
|
|
||||||
PLATFORM::CCDevSocket *m_dev; /**< the device connection */
|
|
||||||
-
|
|
||||||
+ bool m_bLogicalAddressRegistered;
|
|
||||||
+ bool m_bInitialised;
|
|
||||||
+
|
|
||||||
PLATFORM::CMutex m_messageMutex;
|
|
||||||
uint32_t m_iNextMessage;
|
|
||||||
std::map<uint32_t, CAdapterMessageQueueEntry *> m_messages;
|
|
||||||
--
|
|
||||||
1.7.9.5
|
|
||||||
|
|
1482
projects/Cuboxi/patches/libcec/libcec-03-mk1-cec-fix.patch
Normal file
1482
projects/Cuboxi/patches/libcec/libcec-03-mk1-cec-fix.patch
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user