Baconday 2021

This year was our 10 year anniversary, so we had re-runs of some of the dishes from the last 10 years (with some twists). For the canapes, we this year did a contest.

Running cec-client with Raspberry PI on Debian or Ubuntu 64-bit

Using cec-client with a raspberry pi on debian or ubuntu does not work out of the box, as the cec-client in the debian and ubuntu repositories has not been compiled with support for the propriary raspberry libraries. In addition, these libraries are 32-bit only. This is a guide in how to get this working.

First you need to set up a 32-bit chroot environment. Install debootstrap and then run

debootstrap --variant=buildd --arch=armhf bullseye /opt/cec-client/

You will then need to download the raspberry pi libraries. Unpack /opt/vc from the tarball into /opt/cec-client (replace url with newer version if needed):

cd /tmp
curl -L | tar zxf -
cp -r firmware*/opt/ /opt/cec-client/

Add the raspberry pi lib to ldconfig by running

echo "/opt/vc/lib" > /opt/cec-client/etc/

You can now compile libcec and cec-utils:

chroot /opt/cec-client
apt-get update
apt-get install cmake libudev-dev libxrandr-dev python3-dev swig git 
cd /tmp/ 
git clone
mkdir platform/build
cd platform/build
cmake .. 
make install
cd /tmp/
git clone
mkdir libcec/build
cd libcec/build
cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib ..
make -j4 
make install
cd /tmp/
mkdir libcec/src/cec-client/build/
cd libcec/src/cec-client/build/
make install

In order to run cec-client inside the chroot, you will also need access to devices. You can do this by mounting this up before running chroot, but an easier and better way is to use systemd. Many of the examples you will find of how to use cec-client adds the -s flag to run a single command, but without this, cec-client runs until told to quit and listens on commands on stdin. We will use this and let systemd set up a fifo for commands for us. Create the socket and service files:

Description=CEC client socket


Description=CEC client

ExecStart=/usr/local/bin/cec-client -d 1
ExecStop=/bin/bash -c "echo q > /run/cec.fifo"


Then reload systemd, enable and start:

systemctl daemon-reload
systemctl enable cec-client.socket
systemctl start cec-client.socket

You can now send cec-client commands by writing to /run/cec.fifo, for instance to turn on the tv with address run

echo 'on' > /run/cec.fifo

Baconday 2019

Baconday 2018