13 March 2017

RPI Blank/Black Screen

While trying out the latest Raspbian with PIXEL on Raspberry Pi using the Window Manager I noticed that the screen would only go blank/black and never went into standby mode. Now I don't know if this has to do with my cabling setup but I am using an HDMI from the RPi with a converter to DVI into the monitor. After searching for a while I came across a few different suggestions. The following is what I feel is the simplest and most reliable mix of my findings.

The simplest and cleanest way to get the monitor in and out of standby is by using the commands below.

$ vcgencmd display_power 0
$ vcgencmd display_power 1

xscreensaver has a watch option for checking when it blanks, locks, or unblanks the screen.

#!/usr/bin/perl

my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while () {
    if (m/^(BLANK|LOCK)/) {
        if (!$blanked) {
            system "vcgencmd display_power 0";
            $blanked = 1;
        }
    } elsif (m/^UNBLANK/) {
        system "vcgencmd display_power 1";
        $blanked = 0;
    }
}

Now I'm sure there is a way to get this working at startup, but I'm not that skilled, and as this was just to tryout and temporarily play with that's as far as bothered with.

Enjoy!

No comments:

Post a Comment