Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am using my laptop in several monitor configurations that do require xorg.conf (say, I am driving a T221 from my laptop) and it's very inconvenient to manually switch them. Is there something in /sys which tells me if something is plugged into a DVI connector? Or a utility or ...?

share|improve this question
    
How do you start the X server? (Using gdm/kdm/slim etc. or startx? If you use *dm method, what type of session do you use? What desktop env.?) –  rozcietrzewiacz Sep 21 '11 at 9:23
    
I am using kdm not sure about session -- just default? –  chx Sep 22 '11 at 20:29

2 Answers 2

I would start by looking at hwinfo:

$ hwinfo --monitor
51: None 00.0: 10000 Monitor                                    
  [Created at fb.71]
  Unique ID: rdCR.EY_qmtb9YY0
  Hardware Class: monitor
  Model: "Generic Monitor"
  Vendor: "Generic"
  Device: "Monitor"
  Resolution: 1920x1200@77Hz
  Driver Info #0:
    Max. Resolution: 1920x1200
    Vert. Sync Range: 50-90 Hz
    Hor. Sync Range: 31-96 kHz
  Config Status: cfg=new, avail=yes, need=no, active=unknown

You might also look into using xrandr to control which displays are in use.

share|improve this answer
    
Unbelievable. Just unbelievable. Exactly what I needed. –  chx Oct 2 '11 at 7:22
    
Could you specify which package contains hwinfo in your distribution? –  manatwork Oct 2 '11 at 11:01
    
It is just called hwinfo on Ubuntu. –  polynomial Oct 2 '11 at 15:55
    
Unfortunately it doesn't work on all hardware and/or configurations. For some reasons some systems with monitors attached display nothing for me. But still a good suggestion. –  chrishiestand Apr 21 '12 at 0:59
up vote 0 down vote accepted

Note that this broke with the latest Arch Linux upgrade, however the directory /sys/class/drm/ contains all the video outputs. I use head -1 /sys/class/drm/card0-HDMI-A-3/modes to detect the existence of the 3840x2400 mode but one could just check /sys/class/drm/card0-HDMI-A-3/status for connected vs disconnected if the mode was not important which is the exact and fastest answer to my question :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.