[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dexconf should default to PCI:1:0:0 ?



On Sat, May 29, 2004 at 03:56:03AM -0500, Branden Robinson wrote:
> On Thu, May 27, 2004 at 11:03:24AM +0200, Bill Allombert wrote:
> > Hello X Strike Force,
> > 
> > I have just made a sarge install and I found that
> > dexconf default to PCI:0:1:0. 
> 
> That's just about completely incorrect.
> 
> More accurately, it defaults to:
>   1) whatever lspci says the first VGA compatible device is, if lspci is
>      available, returns information, and (if you have more than one video
>      card or if you're on a PowerPC);

This is not the case here. dexconf default to PCI:0:1:0, but I have
0000:00:01.0 PCI bridge: Intel Corp. 82865G/PE/P PCI to AGP Controller (rev 02)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV250 If [Radeon 9000] (rev 01)

> Let's look at the code, shall we?
> 
>     VIDEO_CARD=$(LC_ALL=C lspci -n | grep "Class 0300:" | head -n 1 | cut -d\  -f1)
>     if [ -n "$VIDEO_CARD" ]; then
>       # we now have an entry in "hex:hex.hex" format, need "PCI:decimal:decimal:decimal"
>       BUS=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f1) )
>       DEVICE=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f2 | cut -d. -f1) )
>       FUNCTION=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d. -f2) )
>       DEFAULT=PCI:$BUS:$DEVICE:$FUNCTION
>     fi
>   fi
> fi

OK, that settle it: VIDEO_CARD is 0000:01:00.0, which is the correct device, 
but then DEFAULT is set incorrectly, apparently it expects a different lspci
format.

As a matter of fact:

$ VIDEO_CARD="0:1:2.3"
$ BUS=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f1) )
$ DEVICE=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f2 | cut -d. -f1) )
$ FUNCTION=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d. -f2)
$ DEFAULT=PCI:$BUS:$DEVICE:$FUNCTION
$ echo $DEFAULT
PCI:0:1:3

I have done a straight d-i sarge install:
ii  pciutils       2.1.11-8       Linux PCI Utilities (for 2.*.* kernels)

> > I expect most box to have a video adapter on the AGP port nowadays, so
> > PCI:1:0:0 seems a better default.
> 
> I think you're proceeding from an invalid assumption; namely that
> "PCI:0:1:0" is some sort of hard-coded default.

This is true, because "PCI:0:1:0" seemed like an hardcoded value. 

> > Also it is unfortunate XFree86 and lspci does not use the same exact
> > format for PCI ids, (lspci give 0000:01:00.0, but XFree86 want
> > PCI:1:0:0) so I ended up slighlty confused...
> 
> The debconf template explains the format, and cautions about the
> difference between decimal and hexadecimal.

The template explains the old lspci format, not the new one.
But anyway I did a similar mistake than your script by assuming
the old behaviour.

> I am unwilling to change the format of the BusID parameter that the
> XFree86 X server accepts.  To do would render people's XF86Config-4
> files incompatible between distributions.
> 
> If you have suggestions for how the following can be improved, please
> offer them.

Maybe a -X option to lspci that output XF86Config compatible ids would
be nice. Also this would allow lspci -n to change output without
breaking dexconf. Especially since lspci -n format is not documented.

Cheers,
-- 
Bill. <ballombe@debian.org>

Imagine a large red swirl here. 



Reply to: