6

I would like to turn on/off the HDMI via SSH.
I use this command to turn off the HDMI:

sudo tvservice -o and it works fine, my monitor turns off.

But after that I would like to turn on the monitor with this command:

sudo tvservice -p and my monitor turns on (the led on the monitor shows, the monitor is on) but no picture on the monitor; only a blank black screen.

What I should do turn on my monitor properly?

Glorfindel
  • 620
  • 1
  • 8
  • 15
szuniverse
  • 495
  • 1
  • 8
  • 15

4 Answers4

5

I figured it out how to fix this problem. After the

sudo tvservice -p command, run this:

sudo chvt 9 && sudo chvt 7

That works for me!

szuniverse
  • 495
  • 1
  • 8
  • 15
  • 1
    Why are both required? or, are both required? One or the other makes sense to me, but not both. I'll try to remember to play with this later when I can watch the screen. – Tyson Aug 12 '14 at 11:45
  • Because you need to change something so you change 9->7. If you use only the 9, maybe the current state is 9 so you didnt change anything. But Its not sure.... – szuniverse Aug 12 '14 at 11:51
  • ahh that makes sense... – Tyson Aug 12 '14 at 12:27
4

For me this worked for turning on the screen:

#!/bin/sh
tvservice -p
fbset -depth 8; fbset -depth 16
xrefresh
DanT
  • 141
  • 2
3

It seems to me that your monitor is not active. It is just recnognized as an output but no images are being sent to it.

For this I'd recommend to use xrandr for managing outputs. --auto flag should be sufficient:

xrandr --auto

if not, try to play with that such as:

xrandr --output HDMI1 --primary

there are good docs here and here.

Ghanima
  • 15,855
  • 15
  • 61
  • 119
kotrfa
  • 316
  • 1
  • 4
  • via SSH a get this message: "Can't open display". I think It works but not via ssh – szuniverse Jul 13 '14 at 09:49
  • 2
    I guess you'll need to export DISPLAY so X will know what display you are talking about. More about it here – kotrfa Jul 13 '14 at 11:12
  • Yes maybe this solution work but I didnt try it because i find another way, please see my answer below. That worked fine for me without any complication – szuniverse Jul 13 '14 at 14:21
1

In current firmware you can to turn the monitor off and on with the folowing: OFF: sudo vcgencmd display_power 0 ON: sudo vcgencmd display_power 1

It does not risk changing resolution, and there is no need for fbset, chvt, xrefresh, or restarting your GLES and OMX overlays afterwards I've tested it on my Raspberry Pi 3

Mihai
  • 21
  • 1