Skip to content

Instantly share code, notes, and snippets.

@macninja
macninja / rpi-hdmi.sh
Last active October 22, 2023 12:32
Enable and disable the HDMI port on the Raspberry Pi. Uses cec-hdmi. Works on Raspberry Pi 4 as well.
View rpi-hdmi.sh
#!/bin/bash
# Enable and disable HDMI output on the Raspberry Pi
# The script uses the cec-hdmi command to manage the hdmi interface.
# https://pimylifeup.com/raspberrypi-hdmi-cec/
# On a Raspberry Pi 4 i could only get this to work if i used the hdmi 2 port.
# To setup the script run "echo 'scan' | cec-client -s -d 1" to identify the adress of the HDMI unit.