Author: branden
Date: 2004-06-03 23:49:35 -0500 (Thu, 03 Jun 2004)
New Revision: 1514

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/TODO
   trunk/debian/changelog
   trunk/debian/xserver-xfree86.config.in
Log:
Enhance xserver-xfree86's config script to be able to handle the new
output format of lspci, which reports the PCI domain information as well.
Retain support for the older lspci format, and if the output format isn't
recognized at all, issue a warning and do not set a default answer for the
BusID debconf question.  (Closes: #251568)


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS     2004-06-04 04:22:29 UTC (rev 1513)
+++ trunk/debian/CHANGESETS     2004-06-04 04:49:35 UTC (rev 1514)
@@ -99,4 +99,11 @@
 they should not be on UltraSPARC Linux.
     1512
 
+Enhance xserver-xfree86's config script to be able to handle the new
+output format of lspci, which reports the PCI domain information as well.
+Retain support for the older lspci format, and if the output format isn't
+recognized at all, issue a warning and do not set a default answer for the
+BusID debconf question.  (Closes: #251568)
+    1514
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/TODO
===================================================================
--- trunk/debian/TODO   2004-06-04 04:22:29 UTC (rev 1513)
+++ trunk/debian/TODO   2004-06-04 04:49:35 UTC (rev 1514)
@@ -21,8 +21,6 @@
   XAA and Render support for the sunffb driver.  Mmmm, burning manflesh...
   (Ben Collins pinged for status on 2004-06-03.)
 * Debconf fixes:
-  + #251568: Cope with the ever-changing format of lspci -n output.  Need to
-    handle both "bus:device.function" and "domain:bus:device.function".
   + Add [EMAIL PROTECTED] as selectable mode when configuring monitor by 
resolution
     and refresh rate.
   + #251808: wrongly rejects SBUS BusID strings (should accept simple integers,

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2004-06-04 04:22:29 UTC (rev 1513)
+++ trunk/debian/changelog      2004-06-04 04:49:35 UTC (rev 1514)
@@ -101,8 +101,14 @@
   * Expand patch #104 to prevent 64-bit addressing modes from being used when
     they should not be on UltraSPARC Linux.
 
- -- Branden Robinson <[EMAIL PROTECTED]>  Thu,  3 Jun 2004 22:55:22 -0500
+  * Enhance xserver-xfree86's config script to be able to handle the new
+    output format of lspci, which reports the PCI domain information as well.
+    Retain support for the older lspci format, and if the output format isn't
+    recognized at all, issue a warning and do not set a default answer for the
+    BusID debconf question.  (Closes: #251568)
 
+ -- Branden Robinson <[EMAIL PROTECTED]>  Thu,  3 Jun 2004 23:43:37 -0500
+
 xfree86 (4.3.0.dfsg.1-4) unstable; urgency=medium
 
   * The "thanks for the 'testing'" release.

Modified: trunk/debian/xserver-xfree86.config.in
===================================================================
--- trunk/debian/xserver-xfree86.config.in      2004-06-04 04:22:29 UTC (rev 
1513)
+++ trunk/debian/xserver-xfree86.config.in      2004-06-04 04:49:35 UTC (rev 
1514)
@@ -705,14 +705,29 @@
     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:" | head -n 1 | cut -d\  
-f1)
+    # 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
-      # 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
+      # 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"
+      else
+        warn "unrecognized output from lspci: \"$VIDEO_CARD\""
+      fi
     fi
   fi
 fi

Reply via email to