Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detecting HDMI TV on/off status for RPI 2b Raspbian

181 views
Skip to first unread message

Russell Gadd

unread,
Oct 18, 2016, 11:15:37 AM10/18/16
to
I am using RPi 2b to display an unattended continuous slideshow on a TV.
If someone switches the TV off and on again later, if comes on with the
show is still playing. But if it reboots when the TV is off, switching
the TV on shows no HDMI signal being received. I want to reboot
regularly using cron but only if the TV is on.

It seems there is an application cec-client which can detect the TV
on/off status, but the only instructions I can find suggest you have to
download from github and compile the source. However this command
indicates libcec is in the repository
# apt-cache search libcec
libcec-dev - USB CEC Adaptor communication Library (development files)
libcec2 - USB CEC Adaptor communication Library (shared library)
libcec3 - USB CEC Adaptor communication Library (shared library)

I tried # apt-get install cec-client
but this gives:
E: Unable to locate package cec-client

So can anyone give me an outline of how I can use the packages in the
repository to install cec-client. Also which library 2 or 3? (I am using
minibian i.e. a minimal Raspbian 8 Jessie)

Mike Fleming

unread,
Oct 18, 2016, 4:08:06 PM10/18/16
to
In article <nu5ea4$6am$1...@dont-email.me>, Russell Gadd
<russ.ma...@gmail.com> writes:

> I am using RPi 2b to display an unattended continuous slideshow on a TV.
> If someone switches the TV off and on again later, if comes on with the
> show is still playing. But if it reboots when the TV is off, switching
> the TV on shows no HDMI signal being received. I want to reboot
> regularly using cron but only if the TV is on.

What about putting

hdmi_force_hotplug=1

into /boot/config.txt? That will ignore the state of the tellie when
booting.

--
Mike Fleming

rick christian

unread,
Oct 18, 2016, 6:25:38 PM10/18/16
to
On 10/18/2016 04:15 PM, Russell Gadd -> All wrote:

RG> # apt-cache search libcec
RG> libcec-dev - USB CEC Adaptor communication Library (development files)
RG> libcec2 - USB CEC Adaptor communication Library (shared library)
RG> libcec3 - USB CEC Adaptor communication Library (shared library)

These are the libaries used by various programs like cec-client

RG> I tried # apt-get install cec-client
RG> but this gives:
RG> E: Unable to locate package cec-client

sudo apt-cache search cec-client

No results (Raspbian Wheezy)

$ sudo apt-cache search cec-utils
cec-utils - USB CEC Adaptor communication Library (utility programs)

so

sudo apt-get install cec-utils

Should cover it....

RG> So can anyone give me an outline of how I can use the packages in the
RG> repository to install cec-client. Also which library 2 or 3? (I am using
RG> minibian i.e. a minimal Raspbian 8 Jessie)

For FYI...

https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=70923

Don't know about later versions...

BUT possibly

sudo apt-get install cec-utils

https://discourse.osmc.tv/t/cec-client/11459/10

druck

unread,
Oct 19, 2016, 3:33:26 AM10/19/16
to
On 18/10/2016 16:15, Russell Gadd wrote:
> I am using RPi 2b to display an unattended continuous slideshow on a TV.
> If someone switches the TV off and on again later, if comes on with the
> show is still playing. But if it reboots when the TV is off, switching
> the TV on shows no HDMI signal being received. I want to reboot
> regularly using cron but only if the TV is on.

I recommend making sure the Pi always comes up with the right settings,
whenever rebooted, rather than trying to restrict the reboots. Here are
the relevant bits from my Pi's /boot/config.txt which is connected to a
standard HD TV.

# Use 16M colours rather than 64K
framebuffer_depth=32
framebuffer_ignore_alpha=1

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
hdmi_force_edid_audio=1

# uncomment to force a specific HDMI mode (2,0x44=1920x1200 1,16=1080p60)
hdmi_group=1
hdmi_mode=16

# uncomment to force a HDMI mode rather than DVI. This can make audio
work in
# DMT (computer monitor) modes
hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference,
blanking, or
# no display
config_hdmi_boost=4

---druck

Russell Gadd

unread,
Oct 19, 2016, 7:34:28 AM10/19/16
to
On 18/10/16 16:15, Russell Gadd wrote:
>...

All good replies thanks folks. I was unaware of the config setting which
in my situation is clearly better than trying to detect the TV state. So
I'm going to use the "hdmi_force_hotplug=1" line in /boot/config.txt.

druck

unread,
Oct 19, 2016, 3:08:36 PM10/19/16
to
That will make it use HDMI, but you'll get a low resolution mode (VGA?)
if the TV isn't on when it reboots as it can't read the supported
resolutions. To make it always use full HD, you'll also need:-

hdmi_group=1
hdmi_mode=16

---druck

colone...@yahoo.com

unread,
Oct 19, 2016, 10:59:21 PM10/19/16
to
On Tue, 18 Oct 2016, Russell Gadd wrote:

> I am using RPi 2b to display an unattended continuous slideshow on a TV. If
> someone switches the TV off and on again later, if comes on with the show is
> still playing. But if it reboots when the TV is off, switching the TV on
> shows no HDMI signal being received. I want to reboot regularly using cron
> but only if the TV is on.
A quick sample of two TV says 100% have usb ports. What about powering off
the TV (booting read only) or sensing the 5V line on the TV's usb?

r^2

alister

unread,
Oct 20, 2016, 5:13:30 AM10/20/16
to
This is probably the only solution that will work for you anyway.
I suspect your TV does not support CEC as mine will switch on if the pi
boots whilst it is off



--
Well, enough clowning around. Perl is, in intent, a cleaned up and
summarized version of that wonderful semi-natural language known as
"Unix".
-- Larry Wall in <1994Apr6.1...@netlabs.com>

Russell Gadd

unread,
Oct 20, 2016, 6:07:16 PM10/20/16
to
Yes, I discovered this today and implemented exactly what you suggest.
All works fine now.
0 new messages