How to get HDMI status

Hi,
I am trying to implement something like this: hotpluggable dummy monitor. I copied it but it does not work as I do not have any card* inside /sys/class/drm/ (I only have a file called version), so I found this answer: check hdmi status but again it does not work as I don’t have a switch folder under virtual.

This is the output of xrandr before following the instauctions in the first link:

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   1920x1080     60.00*+  74.98    59.95    50.00  
   1680x1050     59.96  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.01  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   720x400       70.04  
   640x480       59.94    59.94  
DP-0 disconnected (normal left inverted right x axis y axis)

After trying to follow those instructions, I get:

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 240 x 320, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
   1920x1080     60.00*+  74.98    59.95    50.00  
   1680x1050     59.96  
   1600x900      60.00  
   1440x900      59.89  
   1280x1024     60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1024x768      60.01  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   720x400       70.04  
   640x480       59.94    59.94  

Is there an alternative way to check for the HDMI status?
Thank you

Sorry for the late response.
Is this still an issue to support? Any result can be shared?

Hi,
I solved by using /sys/class/extcon/extcon0/cable.*, then under each cable I look for name and state which can be either 0 or 1. If name contains HDMI and state is 1, I know an external monitor is connected. In my case, when I connect the HDMI cable it gets assigned to /sys/class/extcon/extcon0/cable.9/ and name is HDMI4

Thanks for your sharing.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.