Autoconfiguration, take 2

Francois Tigeot ftigeot at wolfpond.org
Thu Sep 16 10:06:15 PDT 2004


Since I asked a month ago how to auto-detect the appropriate graphic
driver, I may as well provide the solution for reference.

I had a look at the C code, but it seemed to be designed in an
all-or-nothing way and I would have to rewrite most of the auto-detection
stuff just for stopping it from autodetecting everything.

What's more, I found two different configuration paths which provided
different results with Xorg 6.7.0.
My test machine was a standard PC with an ati rage128 video card.
The test X server was compiled statically with three drivers: via sis and
vesa.

  - Xorg launched without any configuration file determined the driver to be
  'ati' and crashed when it couldn't find it.

  - Xorg -configure generated a file with the 'vesa' driver which was
  perfectly usable as-is.

I have now written the following script shell to use the result of Xorg
-configure :


	# Let X generate a new configuration file
	tmp_conf=/xorg.conf.new
	/usr/X11R6/bin/Xorg -configure
	
	# Find the first line of the "Driver" section
	first_line=`grep -n '^Section *"Device"$' ${tmp_conf} | cut -f 1 -d ':'`

	# Find the first line containing the "Driver" keyword
	driver_line=`tail -n ${first_line} ${tmp_conf} | grep -m 1 'Driver'`

	# Extract the name of the driver in a shell variable
	VIDEO_DRIVER=`echo ${driver_line} | cut -f 2 -d '"'`


I then use the VIDEO_DRIVER variable to modify a template xorg.conf file.
It is working reasonably well for my purposes.

-- 
Francois Tigeot



More information about the xorg mailing list