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

Bug#226193: card driver default



On Tue, Jan 06, 2004 at 10:27:56PM -0500, Joey Hess wrote:
> Branden Robinson wrote:
> > On Tue, Jan 06, 2004 at 12:52:36AM +0100, Michel Dänzer wrote:
> > > On Sun, 2004-01-04 at 23:34, Joey Hess wrote: 
> > > > 
> > > > If read-edid fails to determine the card type, the question, in
> > > > debconf's default dialog frontend, defaults to the first item in the
> > > > list, "apm". This does not seem like a good fallback default. Perhaps
> > > > "vesa" or "vga" would be a reasonable thing to default to if the card
> > > > cannot be detected; something that will probably work, even if not that
> > > > well, if the user takes the default.
> > > 
> > > Beware that neither of these work on Macs, nor on most non-PC hardware I
> > > suspect. fbdev is another fallback for when /proc/fb exists (and is
> > > non-empty?).
> > 
> > Don't worry; in debian-installer land, all the world's an i386.  :)
> 
> Well, in my world at least, scripts are allowed to check the
> architecture of the host they are running on.

I'm preparing a commit to SVN that has the following:

  # video driver selection

  # priority of xserver-xfree86/config/device/driver
  set_db_priority "high"

  DRIVER_DIR=/usr/X11R6/lib/modules/drivers

  # Build list of available video drivers, omitting the atimisc, r128, and
  # radeon sub-modules (the ati driver knows when and how to load these).
  # v4l is not a display driver, and dummy is for advanced users.
  DRIVER_LIST="$(echo $(find "$DRIVER_DIR" -name '*_drv.o' 2>/dev/null \
                        | sed 's|^.*/\(.*\)_drv\.o|\1|' \
                        | egrep -v '(atimisc|dummy|r128|radeon|v4l)' | sort) \
                 | sed 's/ /, /g')"

  if [ -z "$DRIVER_LIST" ]; then
    observe "no video driver modules found in $DRIVER_DIR"
  fi

  # Set a hard-coded module list (if necessary) and default driver module on an
  # architecture-specific basis.
  case "$ARCH" in
    alpha)
      DRIVER_LIST=${DRIVER_LIST:=ati, cirrus, glint, mga, nv, rendition, s3, s3virge, savage, siliconmotion, tdfx, tga, vga}
      DEFAULT_DRIVER=vga
      ;;
    arm|hppa)
      DRIVER_LIST=${DRIVER_LIST:=ati, chips, fbdev, glint, mga, nv, s3, s3virge, savage, sis, tdfx, trident, vga}
      DEFAULT_DRIVER=fbdev
      ;;
    hurd-i386)
      DRIVER_LIST=${DRIVER_LIST:=apm, ark, ati, chips, cirrus, cyrix, fbdev, glint, i128, i740, i810, imstt, mga, neomagic, newport, nsc, nv, rendition, s3, s3virge, savage, siliconmotion, sis, tdfx, tga, trident, tseng, vesa, vga, vmware}
      DEFAULT_DRIVER=vesa
      ;;
    i386)
      DRIVER_LIST=${DRIVER_LIST:=apm, ark, ati, chips, cirrus, cyrix, fbdev, glide, glint, i128, i740, i810, imstt, mga, neomagic, newport, nsc, nv, rendition, s3, s3virge, savage, siliconmotion, sis, tdfx, tga, trident, tseng, vesa, vga, vmware}
      DEFAULT_DRIVER=vesa
      ;;
    ia64)
      DRIVER_LIST=${DRIVER_LIST:=apm, ark, ati, chips, cirrus, cyrix, fbdev, glint, i128, i740, i810, imstt, mga, neomagic, newport, nv, rendition, s3, s3virge, savage, siliconmotion, sis, tdfx, tga, trident, tseng, vesa, vga, vmware}
      DEFAULT_DRIVER=fbdev
      ;;
    m68k|powerpc)
      DRIVER_LIST=${DRIVER_LIST:=ati, chips, fbdev, glint, imstt, mga, nv, s3, s3virge, savage, sis, tdfx, trident, vga}
      DEFAULT_DRIVER=fbdev
      ;;
    mips|mipsel)
     DRIVER_LIST=${DRIVER_LIST:=ati, chips, fbdev, glint, mga, newport, nv, s3, s3virge, savage, sis, tdfx, trident}
     DEFAULT_DRIVER=fbdev
      ;;
    sparc)
      DRIVER_LIST=${DRIVER_LIST:=apm, ark, ati, chips, cirrus, fbdev, glint, i128, i740, imstt, mga, neomagic, nv, rendition, s3virge, savage, siliconmotion, sunbw2, suncg14, suncg3, suncg6, sunffb, sunleo, suntcx, tdfx, trident, vesa, vga}
      DEFAULT_DRIVER=fbdev
      ;;
    *)
      internal_error "no driver list known for architecture $ARCH"
      ;;
  esac

  observe "available video driver list set to \"$DRIVER_LIST\""

  # attempt to autodetect
  if which discover >/dev/null 2>&1; then
    if [ "$AUTODETECT_VIDEO_CARD" = "true" ]; then
      if [ $NDRIVERS -eq 0 ]; then
        observe "could not autodetect X server driver: no video card" \
                "detected, or no driver known for it"
      elif [ $NDRIVERS -eq 1 ]; then
        observe "autodetected X server driver: $DRIVERS"
        set_db_priority "low"
        DEFAULT_DRIVER="$DRIVERS"
      elif [ $NDRIVERS -gt 1 ]; then
        observe "could not autodetect X server driver: multiple drivers for" \
                "video cards"
        VIDEOCARD_DRIVER_REPORT=$(echo "$DISCOVERED_VIDEO" \
          | awk 'BEGIN { FS="\t"; printf " %-30s%30s\n .\n", "Detected Video Card", "Suggested driver module" } { printf " %-50s%10s\n", $1, $3 } END { printf " .\n" }')
        # can't do this until there is a way to embed newlines into debconf
        # command streams :(
        # db_subst shared/multiple_possible_x-drivers detected_cards \
        #   "$VIDEOCARD_DRIVER_REPORT"
        observe "$VIDEOCARD_DRIVER_REPORT"
        set_db_priority "high"
        run db_input "$PRIORITY" xserver-xfree86/multiple_possible_x-drivers
        db_go
      fi
    else
      observe "user declined video card autodetection (driver)"
    fi
  else
    observe "could not autodetect X server driver: discover not found"
  fi

  db_subst xserver-xfree86/config/device/driver choices "$DRIVER_LIST"
  auto_answer db_input "$PRIORITY" \
    xserver-xfree86/config/device/driver "$DEFAULT_DRIVER"

This looks to me like it will satisfy your request.

Comments?

-- 
G. Branden Robinson                |    I am sorry, but what you have
Debian GNU/Linux                   |    mistaken for malicious intent is
branden@debian.org                 |    nothing more than sheer
http://people.debian.org/~branden/ |    incompetence!     -- J. L. Rizzo II

Attachment: signature.asc
Description: Digital signature


Reply to: