Pilt
Posts: 1
Joined: Wed Apr 24, 2013 3:24 pm

Determine if connected TV is on during boot

Wed Apr 24, 2013 3:31 pm

Hi,

I am currently turning on a TV during boot using an IR Led connected to the GPIO. Currently I send the IR tv power code everytime I boot up and shutdown.

However if the Raspberry Pi is hard reset whilst the tv is on, then on the next boot the PI will turn off the tv when it boots up and turn it on when it shuts down (on/off ir code is the same), so i need a way of determining if the TV is ON or OFF.

The HDMI output does not work when the TV is off (I have had to set hdmi_drive=2). What i am wondering is there any command that will allow me to read the HDMI hotplug status? (Hotplug is low when TV is off)

Hope that makes sense!

Thanks,

Dan

User avatar
rpdom
Posts: 14985
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Determine if connected TV is on during boot

Wed Apr 24, 2013 5:02 pm

/opt/vc/bin/tvservice -s will show the current state of the video output.

Unless you have overridden it with force/ignore hotplug in config.txt, it will mention HDMI when the TV is connected and powered on, and PAL or NTSC if it is off (when defaulting to composite output)

Return to “General programming discussion”