Thread: Detecting monitor is on or off

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    5

    Detecting monitor is on or off

    Hello everyone,
    I m writing a c program to detect whether monitor is on or off, but have no clue where to start from. In linux there is utility ddcprobe which detects the hardware status , but it works only when we completely disconnect the monitor or power cable of monitor.
    So if anyone has any ideas please help.
    Thanks.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So are you needing this for Linux or something else?

    I'm afraid that the solution is very dependant on the OS, as there is absolutely no standardized support for this (unless there is some ACPI interface that does this - I'm not that sure about ACPI functionality).

    The low-level parts of the graphics driver can probaby tell you if the monitor is in power-save mode or not, but whether it is switched on at the power-switch or not would require trying to talk to the monitor via EDID/DDC or some such. Whether the power-switch on the monitor stops EDID/DDC or not is something that probably depends on each monitor manufacturer.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    5
    yes, i need it for linux.
    For time being even the completely disconnected monitor will also do . You are right it is very difficult to know it from power-switch,even the ddcprobe can't do it.
    So is it possible if i remove the monitor completely?

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    5
    matsp you are absolutely right. Thanks a lot it helped a lot. I need to read EDID structure. Though it wont work for LCD. But it's still fine. Now I m trying to figure out how to read EDID information using c program. If u have any more suggestions please post.
    Thanks a lot.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by sameer.nalwade View Post
    I need to read EDID structure. Though it wont work for LCD.
    Why not? EDID is available on all monitors as far as I know - certainly when I was working with graphics drivers it worked on all the monitors except for a few really old ones. Sometimes the EDID would be WRONG.

    However, I'm pretty sure that the EDID doesn't tell you if the monitor is on or not.

    The ddcprobe application is reading the EDID (DDC is the name of the transfer protocol, EDID is the data format of the data transferred with DDC - just like HTTP transfers [usually] HTML content).

    As to how you do that in your own application, I suppose you could look at how ddcprobe itself does that.

    Edit: You still haven't described what you are ACTUALLY trying to achieve - e.g. why you want to know if the monitor is on/connected or not.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accurately detecting function calls
    By Mole42 in forum C Programming
    Replies: 5
    Last Post: 05-17-2009, 04:01 AM
  2. Detecting the OS
    By John.H in forum C++ Programming
    Replies: 3
    Last Post: 02-21-2003, 09:50 AM
  3. Unix - memory leaks detecting.
    By SOUND in forum C++ Programming
    Replies: 3
    Last Post: 12-14-2002, 07:24 PM
  4. Detecting CD drive letters in the Win32 API...
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 10-07-2002, 02:20 AM
  5. Detecting two consecutive spaces in string
    By bob2509 in forum C++ Programming
    Replies: 20
    Last Post: 04-22-2002, 01:48 PM