Main Question: Can my raspberry pi (powered on it's own) determine if power is being supplied to the monitor (powered by a wall plug)?
I'm trying to determine the power state of the display that is connected to my Raspberry Pi 4.
The following was tried with force_hdmi_hotplug=1 inside /boot/config.txt
By default, I've had this option on inside /boot/config.txt
because a while ago I was testing this and without force_hdmi_hotplug=1
, reconnecting the hdmi cable would not actually turn on the display (the raspberry pi would stay in VGA mode or something).
I have tried using tvservice
, but it has not led to any good results. Using tvservice -M
(monitor), I found the following results:
- Disconnecting the display via the HDMI cable from the raspberry pi will yield no events being detected
- Reconnecting the display via the HDMI cable from the raspberry pi will yield no events being detected
Using tvservice -s
(status), I found the following results:
state 0xa [HDMI]
when connectedstate 0xa [HDMI]
when disconnected
The following was tried with force_hdmi_hotplug=1 NOT INSIDE (disabled) /boot/config.txt
tvservice -M
- Disconnected the display via the HDMI cable from the raspberry pi will yeild
HDMI cable is unplugged.
- Reconnecting the display via the HDMI cable from the raspberry pi will yield
HDMI is attached
tvservice -s
- Disconnected the display via the HDMI cable from the raspberry pi will yeild
state 0x9
- Disconnected the display via the HDMI cable from the raspberry pi will yeild
state 0xa
However, disconnecting the monitor power cable with the HDMI still plugged in will yield the following two events simultaneously:
HDMI is unplugged
HDMI is attached
tvservice -s
will still yield state 0xa
and even using xrandr
will say that a display is connected. xrandr -display :0 --listmonitors
will still list a monitor.
Is what I'm looking for even possible?