is there a way to get power state of display monitor ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
xqterry
Posts: 5
Joined: Sat May 10, 2008 12:18 pm

is there a way to get power state of display monitor ?

Post by xqterry »

Hi

I want to detect the power on/off state of display device ( such as LCD monitor ). It seemed there is only VBE function int 10h 0x4f15 DDC can "talk" with monitor, but read edid command returns same information no matter monitor is swith on/off.

I believe it is possible, but I can't find the way, any suggestion will be appreciated.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

Isn't this part of ACPI?
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

APM, a much simpler (but technically obsolete) interface, also has a way to get/set the power state of the display. Last time I looked, Miscorsoft still keeps the APM manuals on their website. Try searching there.

Look especially at sections 4 and 4.5 for reference to the real mode interface for getting/setting power states on different devices.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post by Brendan »

Hi,

There's a hardware interface between the video card and the monitor. This hardware interface inclues video timing signals and DDC and not much else.

AFAIK DDC is there to tell the video card what range of signals the monitor supports, and is static data passed from monitor to video card (there is no communication between video card and monitor over DDC, and the EDID/DDC data never changes).

For power management, EDID/DDC will tell you what DPMS modes the monitor supports, and the video card controls the monitor's state by enabling/disabling H-sync and V-sync signals. For some very generic information see the Wikipedia page on DPMS.

AFAIK there is nothing else (at the hardware level), and it'd be impossible for APM to do something that the hardware itself isn't capable of.

However, if the monitor is actually off then it shouldn't return any DDC/EDID information. I'd assume that (like lots of modern electronic equipment) your monitor uses "pretend off" and isn't actually off (ie. it's in a low power "waiting for someone to press the ON button" state).

This "pretend off" arrangement does have some technical merit - the video card can figure out what range of signals to allow even if the monitor isn't actually on and doesn't need to refuse to set a video mode when the monitor is off, and doesn't need to constantly poll DDC while waiting for the monitor to be turned on.

Anyway, try an old monitor with a real power button (ie. a power button that disconnects "mains" power from everything), or put the monitor into "manual off" mode (by unplugging it's power cable from the wall). ;)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
xqterry
Posts: 5
Joined: Sat May 10, 2008 12:18 pm

Post by xqterry »

Hi Stevo14, I tried APM by real mode int 15h, get display device power state. unfortunately, it always returns power on (cx = 0h).

Hi Brendan, thanks for such a detail info.
I am sorry maybe I should clarify first, the monitor I tested is HDTV, which is connected to pc via dvi2vga line. What I want is detecting whether monitor is switched off by remote control or unpluging AC power cable, any of them, as your definition, "pretend off" or "actually off".

It is strange even I unplugged power cable of HDTV, DDC/EDID could also be read unless I disconnect vga cable.

Is it impossible to detect? :( so discouraged.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

xqterry wrote:Hi Stevo14, I tried APM by real mode int 15h, get display device power state. unfortunately, it always returns power on (cx = 0h).

Hi Brendan, thanks for such a detail info.
I am sorry maybe I should clarify first, the monitor I tested is HDTV, which is connected to pc via dvi2vga line. What I want is detecting whether monitor is switched off by remote control or unpluging AC power cable, any of them, as your definition, "pretend off" or "actually off".

It is strange even I unplugged power cable of HDTV, DDC/EDID could also be read unless I disconnect vga cable.

Is it impossible to detect? :( so discouraged.
I suspect you're doing the right thing, but you're "stuck" with a very good monitor that always tries to satisfy the systems requests even if it has barely any power. I have one that has a hard power button. If I turn it off and then start X (in a 2-monitor setup) it can't detect it at all and assumes its 640x480 only, so it sets the other to that too (so that's how I know). If you're nearby you're welcome to pick it up, it's an old 17" CRT. I doubt you're nearby though - maybe an idea to find somebody with an old monitor to borrow?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post by Brendan »

Hi,
xqterry wrote:It is strange even I unplugged power cable of HDTV, DDC/EDID could also be read unless I disconnect vga cable.
Doh - that's surprising. The VGA connector does have GND and +5V lines though - maybe that's enough to power the monitor's DDC/EDID electronics. Alternatively, maybe the video card (or video card's ROM) caches DDC information until it detects the VGA cable is unplugged so it doesn't need to get it from the monitor each time (which I'd assume is slow).
xqterry wrote:Is it impossible to detect?
I doubt that it's possible to detect if the monitor is on or off in all cases, as the hardware is simply not designed for it. I still think it might work for older (CRT) monitors though.

You'd need to try several different video cards with several different monitors (both with and without your own native video/DDC driver so you know the DDC information *isn't* being cached) to figure out if/when you can work around the hardware's limitations.
xqterry wrote::( so discouraged.
It would be nice if DDC returned the monitor's ON/Standby/OFF status (although it'd probably complicate the monitors electronics a little). It'd also be nice if an OS could put the video card into a power saving state when it finds out that the monitor isn't even turned on (instead of wasting time, energy, etc trying generate video data and then sending it at the video card's equivalent of "/dev/null").


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
xqterry
Posts: 5
Joined: Sat May 10, 2008 12:18 pm

Post by xqterry »

Candy wrote: I suspect you're doing the right thing, but you're "stuck" with a very good monitor that always tries to satisfy the systems requests even if it has barely any power. I have one that has a hard power button. If I turn it off and then start X (in a 2-monitor setup) it can't detect it at all and assumes its 640x480 only, so it sets the other to that too (so that's how I know). If you're nearby you're welcome to pick it up, it's an old 17" CRT. I doubt you're nearby though - maybe an idea to find somebody with an old monitor to borrow?
:) yep, your CRT is so far away from me. I will try, looking for something in X source. thanks.
xqterry
Posts: 5
Joined: Sat May 10, 2008 12:18 pm

Post by xqterry »

Hi Brendan
Brendan wrote: You'd need to try several different video cards with several different monitors (both with and without your own native video/DDC driver so you know the DDC information *isn't* being cached) to figure out if/when you can work around the hardware's limitations.
I can only borrow another LCD monitor at this moment, and as same as HDTV, DDC/EDIT info can be read as long as VGA cable is plugged. I will try CRT later.
It would be nice if DDC returned the monitor's ON/Standby/OFF status (although it'd probably complicate the monitors electronics a little). It'd also be nice if an OS could put the video card into a power saving state when it finds out that the monitor isn't even turned on (instead of wasting time, energy, etc trying generate video data and then sending it at the video card's equivalent of "/dev/null").
//nod, anyway, thank you for help.
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Post by Stevo14 »

xqterry wrote:Hi Stevo14, I tried APM by real mode int 15h, get display device power state. unfortunately, it always returns power on (cx = 0h).
Make sure you are checking the carry flag for any errors. Also make sure that you are properly connecting the real mode interface.

It is also possible that APM returns the power state of the graphics adapter instead of the monitor. In which case it is pretty much useless for your purposes... :(
Post Reply