diff --git a/packages/devel/libcec/package.mk b/packages/devel/libcec/package.mk
index 56bd5f3fe4..d4dd527809 100644
--- a/packages/devel/libcec/package.mk
+++ b/packages/devel/libcec/package.mk
@@ -1,24 +1,25 @@
################################################################################
-# This file is part of OpenELEC - http://www.openelec.tv
+# This file is part of LibreELEC - https://libreelec.tv
+# Copyright (C) 2018-present Team LibreELEC
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
#
-# OpenELEC is free software: you can redistribute it and/or modify
+# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
-# OpenELEC is distributed in the hope that it will be useful,
+# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with OpenELEC. If not, see .
+# along with LibreELEC. If not, see .
################################################################################
PKG_NAME="libcec"
-PKG_VERSION="5250931"
-PKG_SHA256="22c746602e85ea575bd247adfb17181849fb54d97428a25ccd29a064e43e6cde"
+PKG_VERSION="8adc786"
+PKG_SHA256="742efcc24e8949d822effdd06cfebfd0d62babab826be33c1686c7bfea52f455"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://libcec.pulse-eight.com/"
diff --git a/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch b/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch
index 392820a2e3..5a871d36f9 100644
--- a/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch
+++ b/packages/devel/libcec/patches/cec-framework/libcec-0001-PR380.patch
@@ -1,4 +1,4 @@
-From f4db70392c9bfe3bb7b551fd9eb79d58d0588a50 Mon Sep 17 00:00:00 2001
+From 93908ac97c496447e47182945dd17dd64fadb73a Mon Sep 17 00:00:00 2001
From: Jonas Karlman
Date: Wed, 6 Sep 2017 17:37:05 +0200
Subject: [PATCH] Add Linux CEC Adapter
@@ -43,10 +43,11 @@ diff --git a/include/cectypes.h b/include/cectypes.h
index 9c918427..2c32e4d9 100644
--- a/include/cectypes.h
+++ b/include/cectypes.h
-@@ -282,6 +282,16 @@ namespace CEC {
+@@ -281,6 +281,16 @@ namespace CEC {
+ */
#define CEC_MAX_DATA_PACKET_SIZE (16 * 4)
- /*!
++/*!
+ * the path to use for the Linux CEC device
+ */
+#define CEC_LINUX_PATH "/dev/cec0"
@@ -56,10 +57,9 @@ index 9c918427..2c32e4d9 100644
+ */
+#define CEC_LINUX_VIRTUAL_COM "Linux"
+
-+/*!
+ /*!
* the path to use for the AOCEC HDMI CEC device
*/
- #define CEC_AOCEC_PATH "/dev/aocec"
@@ -861,6 +871,7 @@ typedef enum cec_adapter_type
ADAPTERTYPE_RPI = 0x100,
ADAPTERTYPE_TDA995x = 0x200,
@@ -69,7 +69,7 @@ index 9c918427..2c32e4d9 100644
} cec_adapter_type;
diff --git a/src/libcec/CECTypeUtils.h b/src/libcec/CECTypeUtils.h
-index 0d0cf178..49be8fbe 100644
+index 25c1c6e3..15f9543f 100644
--- a/src/libcec/CECTypeUtils.h
+++ b/src/libcec/CECTypeUtils.h
@@ -766,6 +766,8 @@ namespace CEC
@@ -82,10 +82,10 @@ index 0d0cf178..49be8fbe 100644
return "unknown";
}
diff --git a/src/libcec/CMakeLists.txt b/src/libcec/CMakeLists.txt
-index d3eefa34..8d5bdede 100644
+index 5c888070..eb1c7ee3 100644
--- a/src/libcec/CMakeLists.txt
+++ b/src/libcec/CMakeLists.txt
-@@ -87,6 +87,8 @@ set(CEC_HEADERS devices/CECRecordingDevice.h
+@@ -88,6 +88,8 @@ set(CEC_HEADERS devices/CECRecordingDevice.h
adapter/Exynos/ExynosCEC.h
adapter/Exynos/ExynosCECAdapterDetection.h
adapter/Exynos/ExynosCECAdapterCommunication.h
@@ -161,14 +161,14 @@ index 91195ea0..323c2724 100644
}
diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp
new file mode 100644
-index 00000000..400abde4
+index 00000000..878c572f
--- /dev/null
+++ b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.cpp
@@ -0,0 +1,367 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
-+ * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman
++ * libCEC Linux CEC Adapter is Copyright (C) 2017-2018 Jonas Karlman
+ * based heavily on:
+ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs
+ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea
@@ -209,7 +209,7 @@ index 00000000..400abde4
+#include "LinuxCECAdapterCommunication.h"
+#include "CECTypeUtils.h"
+#include "LibCEC.h"
-+#include
++#include "p8-platform/util/buffer.h"
+#include
+
+using namespace CEC;
@@ -420,12 +420,12 @@ index 00000000..400abde4
+ return false;
+}
+
-+cec_logical_addresses CLinuxCECAdapterCommunication::GetLogicalAddresses(void)
++cec_logical_addresses CLinuxCECAdapterCommunication::GetLogicalAddresses(void) const
+{
+ cec_logical_addresses addresses;
+ addresses.Clear();
+
-+ if (IsOpen())
++ if (m_fd != INVALID_SOCKET_VALUE)
+ {
+ struct cec_log_addrs log_addrs = {};
+ if (ioctl(m_fd, CEC_ADAP_G_LOG_ADDRS, &log_addrs))
@@ -534,7 +534,7 @@ index 00000000..400abde4
+#endif
diff --git a/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h
new file mode 100644
-index 00000000..66d3e57d
+index 00000000..0453bb26
--- /dev/null
+++ b/src/libcec/adapter/Linux/LinuxCECAdapterCommunication.h
@@ -0,0 +1,94 @@
@@ -542,7 +542,7 @@ index 00000000..66d3e57d
+/*
+ * This file is part of the libCEC(R) library.
+ *
-+ * libCEC Linux CEC Adapter is Copyright (C) 2017 Jonas Karlman
++ * libCEC Linux CEC Adapter is Copyright (C) 2017-2018 Jonas Karlman
+ * based heavily on:
+ * libCEC AOCEC Code is Copyright (C) 2016 Gerald Dachs
+ * libCEC Exynos Code is Copyright (C) 2014 Valentin Manea
@@ -578,7 +578,7 @@ index 00000000..66d3e57d
+#include "env.h"
+
+#if defined(HAVE_LINUX_API)
-+#include
++#include "p8-platform/threads/threads.h"
+#include "../AdapterCommunication.h"
+
+namespace CEC
@@ -603,7 +603,7 @@ index 00000000..66d3e57d
+ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) override { return true; }
+ bool StartBootloader(void) override { return false; }
+ bool SetLogicalAddresses(const cec_logical_addresses &addresses) override;
-+ cec_logical_addresses GetLogicalAddresses(void) override;
++ cec_logical_addresses GetLogicalAddresses(void) const override;
+ bool PingAdapter(void) override { return true; }
+ uint16_t GetFirmwareVersion(void) override { return 0; }
+ uint32_t GetFirmwareBuildDate(void) override { return 0; }
@@ -746,7 +746,7 @@ index 00000000..f5ea2c47
+
+#endif
diff --git a/src/libcec/cmake/CheckPlatformSupport.cmake b/src/libcec/cmake/CheckPlatformSupport.cmake
-index 532f2132..a9f1def5 100644
+index 73612dec..c1c182a6 100644
--- a/src/libcec/cmake/CheckPlatformSupport.cmake
+++ b/src/libcec/cmake/CheckPlatformSupport.cmake
@@ -9,6 +9,7 @@
@@ -757,7 +757,7 @@ index 532f2132..a9f1def5 100644
# HAVE_AOCEC_API ON if AOCEC is supported
# HAVE_P8_USB ON if Pulse-Eight devices are supported
# HAVE_P8_USB_DETECT ON if Pulse-Eight devices can be auto-detected
-@@ -29,6 +30,7 @@ SET(HAVE_LIBUDEV OFF CACHE BOOL "udev not supported")
+@@ -30,6 +31,7 @@ SET(HAVE_LIBUDEV OFF CACHE BOOL "udev not supported")
SET(HAVE_RPI_API OFF CACHE BOOL "raspberry pi not supported")
SET(HAVE_TDA995X_API OFF CACHE BOOL "tda995x not supported")
SET(HAVE_EXYNOS_API OFF CACHE BOOL "exynos not supported")
@@ -765,7 +765,7 @@ index 532f2132..a9f1def5 100644
SET(HAVE_AOCEC_API OFF CACHE BOOL "aocec not supported")
# Pulse-Eight devices are always supported
set(HAVE_P8_USB ON CACHE BOOL "p8 usb-cec supported" FORCE)
-@@ -137,6 +139,16 @@ else()
+@@ -139,6 +141,16 @@ else()
list(APPEND CEC_SOURCES ${CEC_SOURCES_ADAPTER_EXYNOS})
endif()
@@ -783,7 +783,7 @@ index 532f2132..a9f1def5 100644
if (${HAVE_AOCEC_API})
set(LIB_INFO "${LIB_INFO}, AOCEC")
diff --git a/src/libcec/cmake/DisplayPlatformSupport.cmake b/src/libcec/cmake/DisplayPlatformSupport.cmake
-index 7ec10f5d..8ca8119d 100644
+index 83a778af..f47b1f7b 100644
--- a/src/libcec/cmake/DisplayPlatformSupport.cmake
+++ b/src/libcec/cmake/DisplayPlatformSupport.cmake
@@ -44,6 +44,12 @@ else()
@@ -797,10 +797,10 @@ index 7ec10f5d..8ca8119d 100644
+endif()
+
if (HAVE_AOCEC_API)
- message(STATUS "AOCEC support: yes")
+ message(STATUS "AOCEC support: yes")
else()
diff --git a/src/libcec/env.h.in b/src/libcec/env.h.in
-index 0774a1c7..6ee352ae 100644
+index 456a2e75..71895a86 100644
--- a/src/libcec/env.h.in
+++ b/src/libcec/env.h.in
@@ -76,6 +76,9 @@
diff --git a/packages/devel/libcec/patches/libcec-001-drop-tinfo.patch b/packages/devel/libcec/patches/libcec-001-drop-tinfo.patch
new file mode 100644
index 0000000000..281f4c73cf
--- /dev/null
+++ b/packages/devel/libcec/patches/libcec-001-drop-tinfo.patch
@@ -0,0 +1,12 @@
+diff --git a/src/cec-client/CMakeLists.txt b/src/cec-client/CMakeLists.txt
+index 37c733b..2cb42bb 100644
+--- a/src/cec-client/CMakeLists.txt
++++ b/src/cec-client/CMakeLists.txt
+@@ -44,7 +44,6 @@ if (NOT WIN32)
+ # curses
+ if (HAVE_CURSES_API)
+ target_link_libraries(cec-client curses)
+- target_link_libraries(cec-client tinfo)
+ endif()
+
+ # rt
diff --git a/packages/devel/libcec/patches/libcec-002-PR390.patch b/packages/devel/libcec/patches/libcec-002-PR390.patch
index 09b37524c5..88272d4173 100644
--- a/packages/devel/libcec/patches/libcec-002-PR390.patch
+++ b/packages/devel/libcec/patches/libcec-002-PR390.patch
@@ -17,7 +17,7 @@ index dbdd01ce..83e78bd8 100644
else if (command.parameters.size == 1 &&
command.parameters[0] == SL_COMMAND_REQUEST_RECONNECT)
{
-- HandleVendorCommandPowerOn(command);
+- HandleVendorCommandPowerOn(command, false);
+ HandleVendorCommandPowerOnStatus(command);
return COMMAND_HANDLED;
}
diff --git a/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch b/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch
new file mode 100644
index 0000000000..8457c54288
--- /dev/null
+++ b/projects/WeTek_Core/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch
@@ -0,0 +1,49 @@
+From 2b29cb0830548d4957f1d5ca86640831d224670e Mon Sep 17 00:00:00 2001
+From: Sam Nazarko
+Date: Sun, 9 Apr 2017 17:34:36 +0100
+Subject: [PATCH] Make p8platform mutex mutable without changing libplatform
+
+Signed-off-by: Sam Nazarko
+---
+ src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp | 2 +-
+ src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
+index 60813ed..798454e 100644
+--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
+@@ -193,7 +193,7 @@ uint16_t CAmlogicCECAdapterCommunication::GetPhysicalAddress(void)
+ }
+
+
+-cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void)
++cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) const
+ {
+ CLockObject lock(m_mutex);
+ return m_logicalAddresses;
+diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
+index 0e99cf8..635bb81 100644
+--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
+@@ -66,7 +66,7 @@ namespace CEC
+ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; }
+ bool StartBootloader(void) { return false; }
+ bool SetLogicalAddresses(const cec_logical_addresses &addresses);
+- cec_logical_addresses GetLogicalAddresses(void);
++ cec_logical_addresses GetLogicalAddresses(void) const;
+ bool PingAdapter(void) { return IsInitialised(); }
+ uint16_t GetFirmwareVersion(void);
+ uint32_t GetFirmwareBuildDate(void) { return 0; }
+@@ -98,7 +98,7 @@ namespace CEC
+
+ bool m_bLogicalAddressChanged;
+ cec_logical_addresses m_logicalAddresses;
+- P8PLATFORM::CMutex m_mutex;
++ mutable P8PLATFORM::CMutex m_mutex;
+ int m_fd;
+ };
+ };
+--
+2.7.4
+
diff --git a/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch b/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch
new file mode 100644
index 0000000000..8457c54288
--- /dev/null
+++ b/projects/WeTek_Play/patches/libcec/libcec-01-amlogic-make-p8platform-mutex-mutable.patch
@@ -0,0 +1,49 @@
+From 2b29cb0830548d4957f1d5ca86640831d224670e Mon Sep 17 00:00:00 2001
+From: Sam Nazarko
+Date: Sun, 9 Apr 2017 17:34:36 +0100
+Subject: [PATCH] Make p8platform mutex mutable without changing libplatform
+
+Signed-off-by: Sam Nazarko
+---
+ src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp | 2 +-
+ src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
+index 60813ed..798454e 100644
+--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.cpp
+@@ -193,7 +193,7 @@ uint16_t CAmlogicCECAdapterCommunication::GetPhysicalAddress(void)
+ }
+
+
+-cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void)
++cec_logical_addresses CAmlogicCECAdapterCommunication::GetLogicalAddresses(void) const
+ {
+ CLockObject lock(m_mutex);
+ return m_logicalAddresses;
+diff --git a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
+index 0e99cf8..635bb81 100644
+--- a/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
++++ b/src/libcec/adapter/Amlogic/AmlogicCECAdapterCommunication.h
+@@ -66,7 +66,7 @@ namespace CEC
+ bool SetLineTimeout(uint8_t UNUSED(iTimeout)) { return true; }
+ bool StartBootloader(void) { return false; }
+ bool SetLogicalAddresses(const cec_logical_addresses &addresses);
+- cec_logical_addresses GetLogicalAddresses(void);
++ cec_logical_addresses GetLogicalAddresses(void) const;
+ bool PingAdapter(void) { return IsInitialised(); }
+ uint16_t GetFirmwareVersion(void);
+ uint32_t GetFirmwareBuildDate(void) { return 0; }
+@@ -98,7 +98,7 @@ namespace CEC
+
+ bool m_bLogicalAddressChanged;
+ cec_logical_addresses m_logicalAddresses;
+- P8PLATFORM::CMutex m_mutex;
++ mutable P8PLATFORM::CMutex m_mutex;
+ int m_fd;
+ };
+ };
+--
+2.7.4
+