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.

Revisions

  1. @quelleck quelleck revised this gist Apr 6, 2017. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions rpi-hdmi.sh
    Original file line number Diff line number Diff line change
    @@ -9,19 +9,19 @@ is_off ()

    case $1 in
    off)
    if is_off
    then
    echo Already off...
    else
    vcgencmd display_power 0
    fi
    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...
    else
    echo Already on...
    fi
    ;;
    status)
  2. @quelleck quelleck revised this gist Apr 6, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rpi-hdmi.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@

    is_off ()
    {
    vcgencmd display_power | grep "display_power=0"
    vcgencmd display_power | grep "display_power=0" >/dev/null
    }

    case $1 in
  3. @quelleck quelleck revised this gist Apr 6, 2017. No changes.
  4. @quelleck quelleck revised this gist Apr 6, 2017. 1 changed file with 11 additions and 13 deletions.
    24 changes: 11 additions & 13 deletions rpi-hdmi.sh
    Original file line number Diff line number Diff line change
    @@ -4,26 +4,24 @@

    is_off ()
    {
    tvservice -s | grep "TV is off" >/dev/null
    vcgencmd display_power | grep "display_power=0"
    }

    case $1 in
    off)
    tvservice -o
    if is_off
    then
    echo Already off...
    else
    vcgencmd display_power 0
    fi
    ;;
    on)
    if is_off
    then
    tvservice -p
    curr_vt=`fgconsole`
    if [ "$curr_vt" = "1" ]
    then
    chvt 2
    chvt 1
    else
    chvt 1
    chvt "$curr_vt"
    fi
    vcgencmd display_power 1
    else
    echo Already on...
    fi
    ;;
    status)
    @@ -40,4 +38,4 @@ case $1 in
    ;;
    esac

    exit 0
    exit 0
  5. @AGWA AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @AGWA AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. @AGWA AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. @AGWA AGWA created this gist Mar 30, 2014.
    43 changes: 43 additions & 0 deletions rpi-hdmi
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    #!/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
    chvt 1
    else
    chvt 1
    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