Operating System Can windows/MP automatically shut down, if TV is off? (1 Viewer)

kiwijunglist

Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    If you track it down later I can try it, as I spent ages trying to get a script to detect my TV's power state in win7 but from all the resources I've read it is technically impossible.

    You can detect if power manager has turned off the display, but this is different to the TVs on off power state. (ie you can have your TV off with power manager showing the display is on, or vice versa you can have power manager power off the display, however the tv will still be on unless you physically press the off button)
     
    Last edited:

    Scythe42

    Retired Team Member
  • Premium Supporter
  • June 20, 2009
    2,065
    2,703
    50
    Berlin
    Home Country
    Germany Germany
    WM_DEVICECHANGE/GUID_MONITOR_POWER_ON should be the key. At least after a dozen beers plus some shots that's what I remember. I come back on this once I got some sleep.

    If the GPU get's it from Windows, so can we. It's a couple of some combinations, but for DVI/HDMI connections should be possible (VGA no chance, but that is sooo legacy, who cares?). Need t check my booksmarks. If it actually turns out to be impossible (even with leveraging WDM stuff) then we are out of luck of course and I was remembering stuff wrong. But I am pretty sure it's possible. As said, if the GPU drivers knows the state, we also can. Will check and come back to this...
     
    Last edited:

    doug

    MP Donator
  • Premium Supporter
  • September 22, 2010
    81
    12
    Calgary
    Home Country
    Canada Canada
    I know the OP mentioned HDMI, but a serial connection to the TV can do it easily. (if your TV supports it) I control my Pioneer Plasma with a serial connection. I control the active input by polling the TV to find the current input, and then selecting the next input in sequence to switch between MediaPortal, my Satellite receiver, and a Wii. A simple script in EventGhost is the only other thing needed. Poll the TV status periodically and shut down as required.
     

    Scythe42

    Retired Team Member
  • Premium Supporter
  • June 20, 2009
    2,065
    2,703
    50
    Berlin
    Home Country
    Germany Germany
    Sure, serial connection is always the professional installer way... It's especially awesome with EventGhost and the EventGhost Plus Plugin (plugin needs some work though).

    I'll do some test and let you know, if it turns out to be impossible....
     

    Nicoolai

    MP Donator
  • Premium Supporter
  • February 9, 2011
    84
    3
    41
    Denmark
    Home Country
    Denmark Denmark
    Wow, this is getting very interesting.
    Thank you all, for all the attention. I will try to do some tests myself aswell, at some point.
    I'm sure I read about this Windows API Code Pack, that might also be able to do something, if WM_DEVICECHANGE/GUID_MONITOR_POWER_ON doesn't work.
     

    msj33

    MP Donator
  • Premium Supporter
  • November 30, 2005
    471
    76
    Home Country
    England England
    Yes - Scythe42 - This do sound promising for a software based Power off functionality - (What about Power On?)

    As an secondary software based solution could the EDID-setting in registry be used for a similar solution? (if API does not offer a solution)

    Admin Spragleknas wrote this in the "Windows 7 & half full screen thread":
    Well, might not be the best terminology, but when no real display is connected (meaning no EDID is received by PC), windows uses a dummy-setting. In registry, I found typically three kinds of display configurations in GraphicDriver-> Configuration:
    - [AVR/TV] - "real" adapters
    - NOEDID_xxxx
    - SIMULATED_xxxxx
    Try looking at:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration

    I have always seen numerous configurations on all my HTPC's - Both directly connected to TV, or through AV.

    If powering off AV/TV or even disconneting the HDMI cable, Windows will switch to another \configuration\xxxxxxx

    Sometimes Windows 7 even genereates "simulated" configurations between AV and PC powering toogles.

    A simple solution could be: "Power off Mediaportal if EDID is switched" option in Mediaportal config with a selectable state(Power Off, S3 etc.)
    Function:
    Let Mepo detect active EDID when launched -> If EDID is switched(due to powering off TV/AV), then send Power toogle to windows.

    Possible issue:
    • If Mediaportal is started on a non-displayed EDID, then a display toogle, Power on or cable connect will trigger a shutdown :-S
      • User needs to ensure, that display is enabled before launching - in a resume scenario, this maycause issues, unless Active EDID is checked frequently or by delay.
    • Users hot-switching between inputs on AV/TV, will trigger a shutdown/Standby - But why have MePo running, when no display is show?(Think green)
    Don't know if Windows even can power-on by an EDID switch? But that could be awsome.
    Both the serial and the Pulse-eight solution is based on additional hardware - And are not that universal or configurable yet:-S

    /Morten
     

    megahorst

    Super User
  • Team MediaPortal
  • Super User
  • July 8, 2006
    879
    259
    Home Country
    Germany Germany
    Interaction between TV and htpc is already possible.
    There is a plugin that uses the pulse-eight HDMI-CEC to USb bridge.

    Pulse-Eight
    CECRemote - control MediaPortal using your TV's remote

    With this plugin it is possible to use the remote of the TV within MePo. It is also possible to resume the PC when the TV is switched to the HDMI-port where the htpc is connected.
    Switching of the TV when the htpc goes to sleep is also possible.
    Sending the htpc to sleep when the TV is turned of or the HDMI-port is switched will probably be a feature of the next release of the plugin.
     

    Scythe42

    Retired Team Member
  • Premium Supporter
  • June 20, 2009
    2,065
    2,703
    50
    Berlin
    Home Country
    Germany Germany
    The WDDM driver model needs to handle ACPI messages from the hardware. Quick test on NVidia and ATI showed that both pass them properly along the chain to the OS, which then passes them down to individual windows. At least on my two boxes.

    You don't find them under Windows Messages. You need to read the WDDM SDK include files. It's all nice in there :sneaky: Short view on dispmprt.h will open your eyes :p

    I can see hotplug, display changes and display power changes fine here.

    Of course we cannot send commands to HDMI devices without a CEC Module or hooking ourselves into the GPU driver. But we can see what the displays are doing.

    The initial question was: "Can MP Shutdown, when I turn the TV off?". Verified -> Possible.
     
    Last edited:

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    if you build just a little standalone exe test script that will record pwr on/off I can test it for you.
     

    Users who are viewing this thread

    Top Bottom