darkapec
Posts: 4
Joined: Tue Aug 07, 2012 5:30 am

Any way to temporarily cut HDMI signal

Tue Aug 07, 2012 5:37 am

Hi,

I am searching for a way to shut my monitor off after X amount of time. Because the raspberry pi does not have standby functionality I was wondering if anyone is familiar with a way to use the existing shutdown script to actually initiate a stop on the video signal over HDMI. Thus allowing my monitor to go into "no signal" mode and then going into standby.

I do believe I would be able to figure out the above, my biggest issue would be how in the world would I be able to wake the machine back up via XBMC remote or a USB peripheral?

Thanks and any help would be greatly appreciated

User avatar
RaTTuS
Posts: 10777
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Any way to temporarily cut HDMI signal

Tue Aug 07, 2012 7:48 am

setterm --help
man setterm
to look at

setterm -blank
setterm -powersave
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

darkapec
Posts: 4
Joined: Tue Aug 07, 2012 5:30 am

Re: Any way to temporarily cut HDMI signal

Tue Aug 07, 2012 10:26 pm

I attempted the following

Code: Select all

pi@raspbmc:~$ setterm -powersave hsync
setterm: cannot (un)set powersave mode: Invalid argument
Not sure where to go from here

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Sun Aug 12, 2012 1:22 pm

Maybe this helps:

Power off:
/opt/vc/bin/tvservice -o

Power on:
/opt/vc/bin/tvservice -p && fbset "1920x1080"

darkapec
Posts: 4
Joined: Tue Aug 07, 2012 5:30 am

Re: Any way to temporarily cut HDMI signal

Sun Aug 12, 2012 11:07 pm

Hello terwarf,

It appears I do not have a /opt/vc/bin directory. This must have something to do with using RASPBMC as the OS. Maybe I shall attempt to make a post asking a similar question on there forum.

There is apparently many ways to do this, perhaps RASPBMC just has not included the means to do so.

Thank you to all for the info
Jake

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Mon Aug 13, 2012 4:27 am

The tvservice binary is part of the official firmware.

You can get it here: https://github.com/raspberrypi/firmware
Direct download link: https://github.com/raspberrypi/firmware/zipball/master
Copying the opt folder from the zip file to /opt should do the trick, imho

Note:
For the fbset command to work i had to do

Code: Select all

sudo su
fbset -s >> /etc/fb.modes
Hope this helps

Jago
Posts: 4
Joined: Wed Aug 08, 2012 8:16 pm

Re: Any way to temporarily cut HDMI signal

Thu Aug 16, 2012 8:36 am

Hello all,
I've got the same problem / question as darkapec but on wheezy

I tried terwarf's suggestion:
Power off:
/opt/vc/bin/tvservice -o
-> works for my config: HDMI->HDMI-DVI cable -> FSC Display, goes in power saving mode.

Power on:
/opt/vc/bin/tvservice -p && fbset "1920x1080"
-> Monitor comes up again, but without a screen redraw / re-init so the screen remains blank / black. fbset output: Unknown video mode '1920x1080' , fbset only output: mode "1184x928" ...
I tried several fbset arguments. The best result I got is:

Code: Select all

fbset -xres 1184 -yres928 -depth 16
, where the resolution settings are from the fbset output, refreshing only the current terminal window.

Are there any more ideas to power save the monitor and awake it with proper desktop as leaved by script / programatically?

Thank you!

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Fri Aug 17, 2012 8:29 am

Are there any more ideas to power save the monitor and awake it with proper desktop as leaved by script / programatically?
Sorry, i haven't tested this with x11...
I'm using raspian, so I'm not sure this also works for you, but you may give it a try...

Code: Select all


sudo apt-get install x11-xserver-utils


/opt/vc/bin/tvservice -o

/opt/vc/bin/tvservice -p && fbset "1184x928" && xrefresh

if running the script from x - otherwise $DISPLAY isn't set, so from ssh I had to use

Code: Select all

xrefresh -d :0.0
to make it work. Hope this helps...

olberger
Posts: 3
Joined: Wed Aug 22, 2012 6:02 pm

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 6:10 pm

Hello,

I tried the above, however the display does not redraw and stays black (but with backlight on).

Essentially,

Code: Select all

tvservice -o
turns off the screen as expected, but

Code: Select all

tvservice -p && fbset -xres 1280 -yres 1024 -depth 16 && xrefresh -d :0.0
only turns on the screen, but it stays black.

DMPS and screen savers are turned off.

Does anybody out here have an idea? I would need a solution to turn off and on the screen completely when using X11, maybe after a certain time has passed by.

At first I thought about using DPMS, but that does not turn off the screen (i.e. backlight) completely.

Regards,

Oliver

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5745
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 6:43 pm

olberger wrote:

Code: Select all

tvservice -p && fbset -xres 1280 -yres 1024 -depth 16 && xrefresh -d :0.0
only turns on the screen, but it stays black.
I believe fbset ignores you if nothing has changed since the last call. So I think you want to deliberately change something then change back. E.g.

Code: Select all

tvservice -p && fbset -depth 8 && fbset -depth 16 && xrefresh -d :0.0

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 6:47 pm

Strange, this works for me...

Do you see at least the CPU-Meter in the lower right when the screen comes back?
This is the case on my box - firing xrefesh then forces x11 to draw the whole screen again to the framebuffer.

When you can't see the CPU-Meter I would mention there is a screensaver active (xrefresh then will just force repainting a black screen), or the display number you gave xrefresh is wrong. You can get the right number from x-terminal with

Code: Select all

echo $DISPLAY
I would suggest you try the commands single one after each other (not connected with the &&) from a ssh session and post the output here, if any.

Jago
Posts: 4
Joined: Wed Aug 08, 2012 8:16 pm

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 8:10 pm

Thank you dom,
this hint is also good for me!

Here is my summary:
This turns my (HDMI) screen of

Code: Select all

/opt/vc/bin/tvservice -o
and this turns the screen on and displays the desktop again

Code: Select all

/opt/vc/bin/tvservice -p
fbset -xres 1184 -yres 928 -depth 16
fbset -depth 8
fbset -depth 16
xrefresh
The whole stuff is now fired by a Python script and the screen will be displayed if the GPIO is attached to HIGH:

Code: Select all

import subprocess
import time
import os
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN)

subprocess.Popen('/opt/vc/bin/tvservice -o', shell=True)


while True:
    mybutton= GPIO.input(16)
    if mybutton== True:
        subprocess.Popen('/opt/vc/bin/tvservice -p', shell=True)
        subprocess.Popen('fbset -xres 1184 -yres 928 -depth 16', shell=True)
        subprocess.Popen('fbset -depth 8', shell=True)
        subprocess.Popen('fbset -depth 16', shell=True)
        subprocess.Popen('xrefresh', shell=True)
        print ("I'm awake!")
        time.sleep(30)
        print ("Now I go to sleep!")
        time.sleep(3)
        subprocess.Popen('/opt/vc/bin/tvservice -o', shell=True)

    time.sleep(1)

olberger
Posts: 3
Joined: Wed Aug 22, 2012 6:02 pm

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 8:45 pm

Hi,

I tried the following:

From an X Terminal

Code: Select all

echo $ DISPLAY
:0
Logged in via ssh:

Code: Select all

pi@pi ~ $ tvservice -o
Powering off HDMI
Screen goes blank and eventually turns off

Code: Select all

pi@pi ~ $ tvservice -p
Powering on HDMI with preferred settings

Backlight turns on, screen stays black

Code: Select all

pi@pi ~ $ fbset -xres 1280 -yres 1024 -depth 16 -v 
Linux Frame Buffer Device Configuration Version 2.1 (23/06/1999)
(C) Copyright 1995-1999 by Geert Uytterhoeven

Opening frame buffer device `/dev/fb0'
Using current video mode from `/dev/fb0'
Setting video mode to `/dev/fb0'
screen shows CPU load indicator and clock, rest stays black

Code: Select all

pi@pi ~ $ xrefresh -d :0
Display is updated correctly and everything is fine

Now I put it into a script:

Code: Select all

#!/bin/sh
tvservice -p 
fbset -xres 1280 -yres 1024 -depth 16 -v 
xrefresh -d :0 
That sometimes works fine for the first time if the time , however trying this more than once usually does not work reliably.

In all those cases it does not work, the image stays black after issuing the fbset command

Screensavers and DPMS have been deactivated - if I do not issue tvservice -o, the screen stays on for hours. There is no reaction on Mouse or keyboard.

Typing startx gets the screen up again, everything stays fine if I kill the new X process with Ctrl-C afterwards, but that sounds not like an solution for a script.

I am using a fairly old Eizo Monitor via a HDMI - DVI cable

Any ideas?

Thanks in advance

oliver

olberger
Posts: 3
Joined: Wed Aug 22, 2012 6:02 pm

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 8:57 pm

Hi all,

thanks,

the workaround with calling fbset two more times seems to work fine with me. I will try the GPIO solution later on - good idea!

Best regards

Oliver

darkapec
Posts: 4
Joined: Tue Aug 07, 2012 5:30 am

Re: Any way to temporarily cut HDMI signal

Wed Aug 22, 2012 8:58 pm

Hey Jago

Anyway to modify the python script to make it wake on USB or via network interaction?

I am still unsure if this situation will work for me as I do not think some of the components you are calling in your python script are available to RASPBMC users.

I have just been hoping the next release of raspbmc will have some kind of standby built in. Most people are not having issues because they are using TV's and just use a sleep timer on their TV. I on the other hand prefer to use my 27" monitor as a TV and there is not a sleep timer option.

So I either need to find a way to cut the power to the monitor after X amount of time or figure out how to get raspbmc to cut the signal to hdmi.

The python script is a great start, but needing to invoke it via ssh is kinda irritating. Any way to swap the raspbmc shutdown script with the custom python script? Then I would just need a way to wake it up via usb.

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Thu Aug 23, 2012 5:04 am

-deleted as problem already solved, sorry
Last edited by terwarf on Thu Aug 23, 2012 5:22 am, edited 1 time in total.

terwarf
Posts: 12
Joined: Sun Aug 12, 2012 1:19 pm

Re: Any way to temporarily cut HDMI signal

Thu Aug 23, 2012 5:15 am

darkapec wrote: I am still unsure if this situation will work for me as I do not think some of the components you are calling in your python script are available to RASPBMC users.
As I've written above these are parts of the firmware, which you can get at https://github.com/raspberrypi/firmware
darkapec wrote:So I either need to find a way to cut the power to the monitor after X amount of time or figure out how to get raspbmc to cut the signal to hdmi.
As my tv uses ~20 Watts of power in standby mode, I've attached an relais to one of the GPIO pins (via transistor to drive the 5volts the relais needs) and can drive it with my x10 usb remote now, cutting the main power of the tv - maybe that's the way to go for you too?

Return to “Beginners”