Skip to contentSkip to conversation

package/libcec: Add option to use kernel framework

PATCH In review Stefan Ott via buildroot 2 participants 2 messages Jun 29 – Oct 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libcec: Add option to use kernel framework

As explained in libcec's README.raspberrypi.md:

On a recent Raspberry Pi that's using the vc4_kms_3d dtoverlay, you have to use the Linux Kernel driver and disable the Raspberry Pi driver with -DHAVE_RPI_API=0 to use CEC.

This patch adds an option to do just that to the libcec package.

---
 package/libcec/Config.in | 9 +++++++++
 package/libcec/libcec.mk | 6 ++++++
 2 files changed, 15 insertions(+)
package/libcec/Config.in +9 -0
index 2dddc53635..136891a6e3 100644
@@ -13,6 +13,15 @@ config BR2_PACKAGE_LIBCEC
 
 	  http://libcec.pulse-eight.com
 
+config BR2_PACKAGE_LIBCEC_LINUX_API
+	bool "enable Linux kernel CEC framework support"
+	default y if BR2_arm || BR2_aarch64
+	depends on BR2_PACKAGE_LIBCEC
+	help
+	  enable modern Linux Kernel CEC Framework support
+
+	  This is needed to use CEC on the Raspberry Pi
+
 comment "libcec needs a toolchain w/ C++, wchar, threads, dynamic library, gcc >= 4.7"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || \
package/libcec/libcec.mk +6 -0
index 0e730503da..f7c5bce204 100644
@@ -24,6 +24,12 @@ ifeq ($(BR2_PACKAGE_XLIB_LIBXRANDR),y)
 LIBCEC_DEPENDENCIES += xlib_libXrandr
 endif
 
+ifeq ($(BR2_PACKAGE_LIBCEC_LINUX_API),y)
+LIBCEC_CONF_OPTS += \
+	-DHAVE_RPI_API=0 \
+	-DHAVE_LINUX_API=1
+endif
+
 # Disable information about how libCEC is compiled.
 LIBCEC_CONF_OPTS += -DHAVE_GIT_BIN="" \
 	-DHAVE_WHOAMI_BIN="" \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Stefan" == Stefan Ott via buildroot <[email protected]> writes:

Hi,

Quoted 6 lines

As explained in libcec's README.raspberrypi.md:
On a recent Raspberry Pi that's using the vc4_kms_3d dtoverlay, you have to use the Linux Kernel driver and disable the Raspberry Pi driver with -DHAVE_RPI_API=0 to use CEC.

This patch adds an option to do just that to the libcec package.

..

package/libcec/libcec.mk ifeq ($(BR2_PACKAGE_XLIB_LIBXRANDR),y) · line 30

Quoted 4 lines
package/libcec/libcec.mk +4 -0
+ifeq ($(BR2_PACKAGE_LIBCEC_LINUX_API),y)
+LIBCEC_CONF_OPTS += \
+	-DHAVE_RPI_API=0 \
+	-DHAVE_LINUX_API=1

HAVE_RPI_API defaults to off, so no need to explicitly set it 0. The Linux API needs the linux/cec.h header which was added in 4.10, so we need a dependency on >= 4.10 headers.

The Linux API support only adds around ~3% to the build size, so I think it makes most sense to automatically enable it if the kernel headers are new enough rather than an option:

-rwxr-xr-x 1 peko peko 594K Oct 10 18:53 target/usr/lib/libcec.so.8.1.7.without -rwxr-xr-x 1 peko peko 614K Oct 10 18:53 target/usr/lib/libcec.so.8.1.7.with

Committed with that changed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot