From: Simon Strandgaard Date: 2004-03-25T23:14:29+09:00 Subject: Re: Detecting hardware with Ruby On Thu, 25 Mar 2004 22:57:06 +0900, Jamis Buck wrote: > Here's a rather off-the-wall question: how would I go about detecting > the presence of external hardware in Ruby? Specifically, sometimes my > laptop is attached to an external monitor, and sometimes it isn't. Just > before X starts, I'd like to have a Ruby script that runs and checks to > see if the monitor is present, and if it isn't, chooses a different > server layout from the XF86Config file. > This should be possible with the DDC protocol http://www.vesa.org/summary/sumvbeddc11.htm It requires that the driver supports DDC, which I think most drivers in XFree86 does. I don't believe XFree86 will allow you to use DDC without switching to graphics mode first. Then you can detect if a display is present, and then you can switch back to good old 80x50 text mode. I have only tried tweaking XFree86 a little bit, and have absolutely no idea where go from here. -- Simon Strandgaard