Skip to content

Instantly share code, notes, and snippets.

@meanderer-tech
Forked from quelleck/rpi-hdmi.sh
Created September 13, 2019 04:36
Show Gist options
  • Save meanderer-tech/bde87cf7f929285d38f55ea3416d7f79 to your computer and use it in GitHub Desktop.
Save meanderer-tech/bde87cf7f929285d38f55ea3416d7f79 to your computer and use it in GitHub Desktop.
Enable and disable the HDMI port on the Raspberry Pi: `rpi-hdmi on` to turn on, `rpi-hdmi off` to turn off.
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
is_off ()
{
vcgencmd display_power | grep "display_power=0" >/dev/null
}
case $1 in
off)
if is_off
then
echo Already off...
else
vcgencmd display_power 0
fi
;;
on)
if is_off
then
vcgencmd display_power 1
else
echo Already on...
fi
;;
status)
if is_off
then
echo off
else
echo on
fi
;;
*)
echo "Usage: $0 on|off|status" >&2
exit 2
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment