Pulse-Eight / libcec

USB CEC Adapter communication Library http://libcec.pulse-eight.com/
Other
705 stars 282 forks source link

Adapter detection fails on non-RPI device if libCEC is compiled with multiple cmake flags #572

Open boszme opened 3 years ago

boszme commented 3 years ago
 ...
     && if [[ "armhf armv7 aarch64" = *"$BUILD_ARCH"* ]]; then \
                    cmake \
                        -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \
                        -DRPI_INCLUDE_DIR=/opt/vc/include \
                        -DRPI_LIB_DIR=/opt/vc/lib \
                        -DHAVE_EXYNOS_API=1 \
                        -DHAVE_AOCEC_API=1 \      
                        -DHAVE_LINUX_API=1 \
...

Adapter detection is failing due to the RPI userland code. The AdapterFactory.cpp doesn't detect in runtime which OS/HW combination is currently running on; if the RPI cmake flag is compiled in, it will try to invoke those adapter calls anyways. However the bcm_host_init() function calls an exit(-1); if the initialization fails which causing failure if libCEC is invoked on non-RPI based boards (Odroid for example).

https://github.com/Pulse-Eight/libcec/blob/76551ea1dd9a55f0ce1533e440dc12dbc594f7ba/src/libcec/adapter/AdapterFactory.cpp#L232

https://github.com/Pulse-Eight/libcec/blob/76551ea1dd9a55f0ce1533e440dc12dbc594f7ba/src/libcec/adapter/RPi/RPiCECAdapterCommunication.cpp#L458

https://github.com/raspberrypi/userland/blob/master/host_applications/linux/libs/bcm_host/bcm_host.c#L99

boszme commented 3 years ago

I think the easiest solution for this would be an adapter parameter in cec-client so one could manually override the used adapter