Skip to content

Instantly share code, notes, and snippets.

@arionl
Forked from AGWA/rpi-hdmi.sh
Created March 30, 2014 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arionl/9877860 to your computer and use it in GitHub Desktop.
Save arionl/9877860 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Enable and disable HDMI output on the Raspberry Pi
is_off ()
{
tvservice -s | grep "TV is off" >/dev/null
}
case $1 in
off)
tvservice -o
;;
on)
if is_off
then
tvservice -p
curr_vt=`fgconsole`
if [ "$curr_vt" = "1" ]
then
chvt 2
sleep 2
chvt 1
else
chvt 1
sleep 2
chvt "$curr_vt"
fi
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