HACKER Q&A
📣 juanse

Is there a reliable way in Linux to know if a monitor is on/off?


I am developing a kiosk-ish application with raspberry to be managed remotely. So far I have managed to get to know if a monitor is connected to the HDMI, but in no way I can now if it has been switched off or has lost power. Also I have no way to know if someone has just pressed the off button. It is just that xset and xrandr (the option talked in numerous SO posts) doesn't get that information.

Is there any way?


  👤 thebeardisred Accepted Answer ✓
As @kadoban mentioned, DDC/`ddcutil` is the tool you're looking for. They have explicit documentation for the Raspberry Pi (http://www.ddcutil.com/raspberry/) though you'll want to make sure you're running at least a 5.10 kernel if it's an RPi4.

👤 kadoban
I'd look into DDC (ddcutil looks like the tool I've used myself). I've largely used it to switch inputs on monitor(s) and such, I would be somewhat surprised if it can't do what you need.