Skip to content

Instantly share code, notes, and snippets.

@AGWA
Last active January 10, 2025 16:18

Revisions

  1. AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. AGWA renamed this gist Jul 13, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. 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