4

The screen in question is HDMI. The power off/on action is initiated by clicking on the on-screen capacitive button.

I just need to know if there is a way to get events like "now the screen is on", "now the screen is off/unplugged", "now the screen is in standby mode".

If at all possible, I would like to avoid timer-based approaches and to rely to events (however, a timer-based approach is still better than having no clue).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
JohnW
  • 61
  • 1
  • 3

1 Answers1

4

Try xset q to get DPMS settings. Seems to say things like 'Monitor is On'

References:

Criveti Mihai
  • 1,116
  • 7
  • 10
  • That's unfortunately not working: I'm using Kodi through a framebuffer (RPi 2). I get `xset: unable to open display ""`. Sorry for not specifying that before. – JohnW Dec 02 '15 at 20:12
  • By the way, specifying `DISPLAY=0` or the like explicitly does not work either as Xorg is not even installed on the box. That said, Xorg gets its info from somewhere. If I knew what this "somewhere" was, that would work. – JohnW Dec 02 '15 at 20:17
  • Ah. ARM.I'd take a look at tvservice, vbetool and setterm as well. Or strace that xset and see what syscalls it does. Or look at the source. See: https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling#DPMS_interaction_in_a_Linux_console_with_setterm – Criveti Mihai Dec 02 '15 at 20:22
  • `tvservice`: that's how I can currently get the "screen turned on" event. `vbetool`: great hope, great disappointment (can just set DPMS, not read). `setterm`: same thing as `vbetool` but already disillusioned. :) – JohnW Dec 02 '15 at 20:58
  • BTW, I've already read all that has been cited (and much more). But except `xset -q` which works only with X, there is absolutely *nothing* about getting this kind of events. Only answers to the same tired (and unrelated) question: "doh, how can I turn off my screen from SW?". But this is not what I want. – JohnW Dec 02 '15 at 21:01
  • And before you recommend it, `/opt/vc/bin/vcgencmd display_power` does not work either. – JohnW Dec 02 '15 at 21:03