我一直在尝试让 CEC-Client 在 docker 内部工作,当不在 docker 映像中时,我得到以下结果:
No device type given. Using 'recording device'
CEC Parser created - libCEC version 4.0.7
no serial port given. trying autodetect:
path: Raspberry Pi
com port: RPI
opening a connection to the CEC adapter...
但是在 docker 容器中,我得到了这个:
No device type given. Using 'recording device'
CEC Parser created - libCEC version 4.0.4
no serial port given. trying autodetect: FAILED
下面是我的 Dockerfile 的一个片段:
FROM arm32v7/python:3.10-buster
RUN apt-get update && apt-get upgrade
RUN apt-get install sudo fbi libcec-dev cec-utils -y
RUN apt-get update && apt-get install -y --no-install-recommends \
libcec-dev cec-utils make git build-essential pkg-config
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN python3 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./app /code/app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
大多数 docker 文件都与我运行的 python 脚本有关,但我知道所有这些都有效。唯一的问题是让 CEC 工作,我知道这是可能的,因为它在这个旧图像https://hub.docker.com/r/blakeblackshear/rpi-hdmi-cec-rest/tags中工作。但是该 dockerfile 非常过时,因此我无法复制它,我还使用特权和主机标志运行容器。