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

X Strike Force XFree86 SVN commit: r1787 - branches/debconf-overhaul/debian



Author: branden
Date: 2004-09-01 12:13:51 -0500 (Wed, 01 Sep 2004)
New Revision: 1787

Modified:
   branches/debconf-overhaul/debian/CHANGESETS
   branches/debconf-overhaul/debian/changelog
   branches/debconf-overhaul/debian/xserver-xfree86.config.in
Log:
Update configure_video_card() to use lspci's -X option if it is
available, so we don't have to munge the Bus ID of (what we suppose is)
the primary head's video card into XF86Config-4's format.  Also
recognize the fact that recent versions of lspci do not issue the string
"Class " when the -n option is used.  Ah, the joys of using
human-readable standard output as an interface.  Thanks to Bill
Allombert for pointing out the new -X option.


Modified: branches/debconf-overhaul/debian/CHANGESETS
===================================================================
--- branches/debconf-overhaul/debian/CHANGESETS	2004-09-01 16:08:05 UTC (rev 1786)
+++ branches/debconf-overhaul/debian/CHANGESETS	2004-09-01 17:13:51 UTC (rev 1787)
@@ -583,6 +583,13 @@
   extension as such instead of "Xv".  Migrate upgraders from previous
   package versions by automatically adding v4l to module list.
   (Closes: #135768)
++ Update configure_video_card() to use lspci's -X option if it is
+  available, so we don't have to munge the Bus ID of (what we suppose is)
+  the primary head's video card into XF86Config-4's format.  Also
+  recognize the fact that recent versions of lspci do not issue the string
+  "Class " when the -n option is used.  Ah, the joys of using
+  human-readable standard output as an interface.  Thanks to Bill
+  Allombert for pointing out the new -X option.
     [XXX: REPLACE WITH REVISION NUMBER WHEN MERGED TO TRUNK]
 
 vim:set ai et sts=4 sw=4 tw=80:

Modified: branches/debconf-overhaul/debian/changelog
===================================================================
--- branches/debconf-overhaul/debian/changelog	2004-09-01 16:08:05 UTC (rev 1786)
+++ branches/debconf-overhaul/debian/changelog	2004-09-01 17:13:51 UTC (rev 1787)
@@ -419,6 +419,13 @@
       extension as such instead of "Xv".  Migrate upgraders from previous
       package versions by automatically adding v4l to module list.
       (Closes: #135768)
+    + Update configure_video_card() to use lspci's -X option if it is
+      available, so we don't have to munge the Bus ID of (what we suppose is)
+      the primary head's video card into XF86Config-4's format.  Also
+      recognize the fact that recent versions of lspci do not issue the string
+      "Class " when the -n option is used.  Ah, the joys of using
+      human-readable standard output as an interface.  Thanks to Bill
+      Allombert for pointing out the new -X option.
 
   Changes by Fabio M. Di Nitto and Branden Robinson:
 
@@ -530,7 +537,7 @@
       missing to enable this feature.  No keymaps currently use this feature,
       but users may find it useful with broken keymaps.
 
- -- Branden Robinson <branden@debian.org>  Tue, 31 Aug 2004 19:02:00 -0500
+ -- Branden Robinson <branden@debian.org>  Wed,  1 Sep 2004 12:10:42 -0500
 
 xfree86 (4.3.0.dfsg.1-6) unstable; urgency=low
 

Modified: branches/debconf-overhaul/debian/xserver-xfree86.config.in
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-01 16:08:05 UTC (rev 1786)
+++ branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-01 17:13:51 UTC (rev 1787)
@@ -753,33 +753,51 @@
       set_db_priority "high"
     fi
     if which lspci >/dev/null 2>&1; then
-      # Try to guess the correct BusID.
-      VIDEO_CARD=$(LC_ALL=C lspci -n | grep "Class 0300:" | sort -n \
-        | head -n 1 | cut -d\  -f1)
-      if [ -n "$VIDEO_CARD" ]; then
-        # Recent versions of lspci report a four-digit domain as the first
-        # field.
-        if expr "$VIDEO_CARD" : ".*:.*:.*\..*" >/dev/null 2>&1; then
-          # We have an entry in "hex:hex:hex.hex" format; we need
-          # "PCI:decimal:decimal:decimal" (we don't use the domain).
-          DOMAIN=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f1) )
-          BUS=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f2) )
-          DEVICE=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d: -f3 \
-            | cut -d. -f1) )
-          FUNCTION=$(printf "%d" 0x$(echo $VIDEO_CARD | cut -d. -f2) )
-          DEFAULT="PCI:$BUS:$DEVICE:$FUNCTION"
-        elif expr "$VIDEO_CARD" : ".*:.*\..*" >/dev/null 2>&1; then
-          # We have an entry in "hex:hex.hex" format; we 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"
+      # Use the output of lspci to try to guess the Bus ID of the primary head.
+      # Very recent versions of lspci support a -X option that feeds us exactly
+      # what we want to eat; otherwise, we'll have to munge its output into
+      # proper BusID form per XF86Config-4(5x).  Recent versions of lspci don't
+      # say "Class " before the PCI class identifier when the -n option is used.
+      if lspci -X >/dev/null 2>&1; then
+        trace "$(lspci -Xn | grep -E "(Class )?0300:")"
+        DEFAULT=$(LC_ALL=C lspci -Xn | grep -E "(Class )?0300:" \
+          | sort -n | head -n 1 | cut -d\  -f1)
+        if [ -z "$DEFAULT" ]; then
+          trace "lspci -Xn reported no video cards on system"
+        fi
+      else
+        trace "$(lspci -n | grep -E "(Class )?0300:")"
+        LSPCI_ID=$(LC_ALL=C lspci -n | grep -E "(Class )?0300:" | sort -n \
+          | head -n 1 | cut -d\  -f1)
+        if [ -n "$LSPCI_ID" ]; then
+          # Recent versions of lspci report a four-digit domain as the first
+          # field.
+          if expr "$LSPCI_ID" : ".*:.*:.*\..*" >/dev/null 2>&1; then
+            # We have an entry in "hex:hex:hex.hex" format; we need
+            # "PCI:decimal:decimal:decimal" (we don't use the domain).
+            DOMAIN=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d: -f1) )
+            BUS=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d: -f2) )
+            DEVICE=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d: -f3 \
+              | cut -d. -f1) )
+            FUNCTION=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d. -f2) )
+            DEFAULT="PCI:$BUS:$DEVICE:$FUNCTION"
+          elif expr "$LSPCI_ID" : ".*:.*\..*" >/dev/null 2>&1; then
+            # We have an entry in "hex:hex.hex" format; we need
+            # "PCI:decimal:decimal:decimal".
+            BUS=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d: -f1) )
+            DEVICE=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d: -f2 \
+              | cut -d. -f1) )
+            FUNCTION=$(printf "%d" 0x$(echo $LSPCI_ID | cut -d. -f2) )
+            DEFAULT="PCI:$BUS:$DEVICE:$FUNCTION"
+          else
+            warn "unrecognized output from lspci: \"$LSPCI_ID\""
+          fi
         else
-          warn "unrecognized output from lspci: \"$VIDEO_CARD\""
+          trace "lspci -n reported no video cards on system"
         fi
       fi
+    else
+      trace "cannot autodetect BusID; lspci command not available"
     fi
   fi
 



Reply to: