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

X Strike Force XFree86 SVN commit: r2248 - in trunk/debian: . local



Author: branden
Date: 2005-05-10 01:03:35 -0500 (Tue, 10 May 2005)
New Revision: 2248

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/TODO
   trunk/debian/changelog
   trunk/debian/local/dexconf
   trunk/debian/xserver-xfree86.config.in
Log:
Update dexconf to use a new function, has_multiplexed_mouse(), to check
the Linux kernel version and only write a "Generic Mouse" InputDevice
stanza (and reference to it in the ServerLayout section) if the
"Configured Mouse" is not a device type multiplexed through
/dev/input/mice.  In Linux 2.4, only /dev/input/mouse* devices were
treated this way, but now PS/2 and serial mouse devices are as well.  This
resolves problems with button remapping and doubled mouse events which
caused "warp speed" mouse motion.  (Closes: #269407)

Replace mouse configuration code in xserver-xfree86.config.in with a
function, configure_mouse(), which performs the same functions but adds
knowledge of many more mouse types and attempts to guess a reasonable
default mouse device (dependent on architecture and even sub-architecture
in some cases) in the event detection does not work.  Add copious amounts
of debugging statements (suppressed by default).  Among other things, this
adds support for the /dev/adbmouse device node used on Apple Desktop
Bus-equipped Macintoshes.  (Closes: #293527)


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS	2005-05-06 14:54:25 UTC (rev 2247)
+++ trunk/debian/CHANGESETS	2005-05-10 06:03:35 UTC (rev 2248)
@@ -113,4 +113,23 @@
 IA64.  Resync patch #071.  (Closes: #303461)
     2244, 2246
 
+Update dexconf to use a new function, has_multiplexed_mouse(), to check
+the Linux kernel version and only write a "Generic Mouse" InputDevice
+stanza (and reference to it in the ServerLayout section) if the
+"Configured Mouse" is not a device type multiplexed through
+/dev/input/mice.  In Linux 2.4, only /dev/input/mouse* devices were
+treated this way, but now PS/2 and serial mouse devices are as well.  This
+resolves problems with button remapping and doubled mouse events which
+caused "warp speed" mouse motion.  (Closes: #269407)
+
+Replace mouse configuration code in xserver-xfree86.config.in with a
+function, configure_mouse(), which performs the same functions but adds
+knowledge of many more mouse types and attempts to guess a reasonable
+default mouse device (dependent on architecture and even sub-architecture
+in some cases) in the event detection does not work.  Add copious amounts
+of debugging statements (suppressed by default).  Among other things, this
+adds support for the /dev/adbmouse device node used on Apple Desktop
+Bus-equipped Macintoshes.  (Closes: #293527)
+    2248
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/TODO
===================================================================
--- trunk/debian/TODO	2005-05-06 14:54:25 UTC (rev 2247)
+++ trunk/debian/TODO	2005-05-10 06:03:35 UTC (rev 2248)
@@ -16,12 +16,6 @@
 
 4.3.0.dfsg.1-13
 ---------------
-* Grab small-scale, non-disruptive fixes to the xserver-xfree86 debconfage from
-  branches/debconf-overhaul.
-  + New mouse stanza handling:
-    #284561: awareness of /dev/input/mouse handling of PS/2 mice in Linux 2.6
-  + Use /proc/hardware on m68k architecture to set a reasonable default mouse
-    port.  See <URL: http://lists.debian.org/debian-68k/2004/08/msg00392.html>.
 
 Post 4.3.0-1
 ------------

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-05-06 14:54:25 UTC (rev 2247)
+++ trunk/debian/changelog	2005-05-10 06:03:35 UTC (rev 2248)
@@ -92,8 +92,26 @@
     make the XFree86 X server's ELF object loader ensure cache coherency on
     IA64.  Resync patch #071.  (Closes: #303461)
 
- -- Branden Robinson <branden@debian.org>  Fri,  6 May 2005 00:53:51 -0500
+  * Update dexconf to use a new function, has_multiplexed_mouse(), to check
+    the Linux kernel version and only write a "Generic Mouse" InputDevice
+    stanza (and reference to it in the ServerLayout section) if the
+    "Configured Mouse" is not a device type multiplexed through
+    /dev/input/mice.  In Linux 2.4, only /dev/input/mouse* devices were
+    treated this way, but now PS/2 and serial mouse devices are as well.  This
+    resolves problems with button remapping and doubled mouse events which
+    caused "warp speed" mouse motion.  (Closes: #269407)
 
+  * Replace mouse configuration code in xserver-xfree86.config.in with a
+    function, configure_mouse(), which performs the same functions but adds
+    knowledge of many more mouse types and attempts to guess a reasonable
+    default mouse device (dependent on architecture and even sub-architecture
+    in some cases) in the event detection does not work.  Add copious amounts
+    of debugging statements (suppressed by default).  Among other things, this
+    adds support for the /dev/adbmouse device node used on Apple Desktop
+    Bus-equipped Macintoshes.  (Closes: #293527)
+
+ -- Branden Robinson <branden@debian.org>  Tue, 10 May 2005 00:48:59 -0500
+
 xfree86 (4.3.0.dfsg.1-12) unstable; urgency=medium
 
   * Urgency set to medium due to fix for release-critical bug #295175

Modified: trunk/debian/local/dexconf
===================================================================
--- trunk/debian/local/dexconf	2005-05-06 14:54:25 UTC (rev 2247)
+++ trunk/debian/local/dexconf	2005-05-10 06:03:35 UTC (rev 2248)
@@ -9,7 +9,7 @@
 #
 # Author: Branden Robinson
 
-# Copyright 2000-2004 Progeny Linux Systems, Inc.
+# Copyright 2000-2005 Progeny Linux Systems, Inc.
 #
 # This is free software; you may redistribute it and/or modify
 # it under the terms of the GNU General Public License as
@@ -70,6 +70,46 @@
   echo $(IFS=", "; set -- $RET; while [ $# -gt 0 ]; do echo \"$1\"; shift; done)
 }
 
+# Find out if our mouse device is multiplexed; this depends on both the mouse
+# port and the kernel version.
+# TODO: Change this to simply fetch a value from /var/lib/xserver-common/config,
+# once we have written an init script that creates that file.
+has_multiplexed_mouse () {
+  # Initially assume the mouse is not multiplexed.
+  _RET=1
+  case $(uname -s) in
+    Linux)
+      case $(uname -r) in
+        2.4*)
+          case "$MOUSE_PORT" in
+            /dev/input/mice|/dev/gpmdata)
+              _RET=0
+              ;;
+            *)
+              ;;
+          esac
+          ;;
+        2.6*)
+          case "$MOUSE_PORT" in
+            /dev/input/mice|/dev/gpmdata|/dev/psaux|/dev/misc/psaux|/dev/ttyS*|/dev/tts/*)
+              _RET=0
+              ;;
+            *)
+              ;;
+          esac
+          ;;
+        *)
+          # We don't recognize any kernel versions other than 2.4 and 2.6.
+          ;;
+        esac
+      ;;
+    *)
+      # We don't recognize any kernel names other than Linux.
+      ;;
+  esac
+  return $_RET
+}
+
 PROGNAME=${0##*/}
 SHOWHELP=
 EARLYEXIT=
@@ -315,8 +355,7 @@
 # we probably also need an init script to rewrite XF86Config-4 on system boot
 # for people who switch back and forth between these kernels, or some people
 # will get "doubled" mouse events.  Sigh.
-if [ "$MOUSE_PORT" != "/dev/input/mice" ] \
-  && [ "$MOUSE_PORT" != "/dev/gpmdata" ]; then
+if has_multiplexed_mouse; then
   cat >&4 <<SECTION
 Section "InputDevice"
 	Identifier	"Generic Mouse"
@@ -419,8 +458,7 @@
 	InputDevice	"Generic Keyboard"
 	InputDevice	"Configured Mouse"
 SECTION
-if [ "$MOUSE_PORT" != "/dev/input/mice" ] \
-  && [ "$MOUSE_PORT" != "/dev/gpmdata" ]; then
+if has_multiplexed_mouse; then
   printf "\tInputDevice\t\"Generic Mouse\"\n" >&4
 fi
 printf "EndSection\n" >&4

Modified: trunk/debian/xserver-xfree86.config.in
===================================================================
--- trunk/debian/xserver-xfree86.config.in	2005-05-06 14:54:25 UTC (rev 2247)
+++ trunk/debian/xserver-xfree86.config.in	2005-05-10 06:03:35 UTC (rev 2248)
@@ -423,6 +423,360 @@
   esac
 }
 
+get_mouse_port_by_linux_version () {
+  # syntax: get_mouse_port_by_linux_version device
+  #
+  # Given a device string (such as /dev/psaux or /dev/adbmouse), return it
+  # unchanged or mapped to /dev/input/mice based upon the Linux kernel version
+  # in use, depending on whether the installed version of Linux supports the
+  # given legacy mouse type via the input subsystem.
+
+  # Sadly, the "local" keyword is not POSIX.  Leave the next line commented in
+  # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
+  # anyway.
+  #local func input kernel output version
+
+  _func="get_mouse_port_by_linux_version"
+
+  # Validate function arguments.
+  if [ $# -ne 1 ]; then
+    internal_error "$_func(): called with wrong number of arguments; expected" \
+                   "1, got $@"
+  fi
+
+  _kernel=$(uname -s)
+  _version=$(uname -r)
+  _input="$1"
+
+  if [ "$_kernel" != "Linux" ]; then
+    # Do nothing for non-Linux systems; return the device string unchanged.
+    debug_echo "$_func(): doing nothing; OS kernel \"$_kernel\" is not Linux"
+    echo "$_input"
+    return
+  fi
+
+  case "$_input" in
+    *psaux)
+      # PS/2 devices are supported by the input layer as of 2.6.
+      if dpkg --compare-versions "$_version" gt "2.6"; then
+        _output="/dev/input/mice"
+      else
+        _output="$_input"
+      fi
+      ;;
+    *ttyS*|*tts/*)
+      # Serial mice are not supported by the input layer.
+      _output="$_input"
+      ;;
+    *input/mice)
+      # Obviously we don't want to transform this one.
+      _output="$_input"
+      ;;
+    *adbmouse|*amigamouse|*atarimouse|*atibm|*atixl|*sunmouse)
+      # Bus mice are supported by the input layer as of 2.4.
+      if dpkg --compare-versions "$_version" gt "2.4"; then
+        _output="/dev/input/mice"
+      else
+        _output="$_input"
+      fi
+      ;;
+    *gpmdata)
+      # The GPM repeater explicitly bypasses the input layer.
+      _output="$_input"
+      ;;
+    */mouse)
+      internal_error "$_func(): called with argument \"$_input\"; this should" \
+                     "not have happened!  kernel: \"$_kernel\" version:" \
+                     "\"$_version\""
+      ;;
+  esac
+
+  debug_echo "$_func(): mapping \"$_input\" to \"$_output\""
+
+  echo "$_output"
+}
+
+configure_mouse () {
+  # syntax: configure_mouse
+  #
+  # Ask debconf questions that determine the contents of the "InputDevice"
+  # section (using the "mouse" driver) of the XF86Config-4 file.
+
+  # Sadly, the "local" keyword is not POSIX.  Leave the next line commented in
+  # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
+  # anyway.
+  #local default_port default_protocol detected_port detected_protocol \
+  #  func mdetect_output mouse_port_choices mouse_protocol_choices subarch \
+  #  using_devfs
+
+  _func="configure_mouse"
+
+  # Validate function arguments.
+  if [ -n "$*" ]; then
+    warn "$_func(): called with bogus arguments $@"
+  fi
+
+  # Set priority of xserver-xfree86/config/inputdevice/mouse/{port,protocol}.
+  PRIORITY=high
+
+  # determine if we're using devfs
+  if [ -c /dev/.devfsd ]; then
+    _using_devfs=true
+  else
+    _using_devfs=
+  fi
+
+  if [ -n "$_using_devfs" ]; then
+    debug_echo "$_func(): devfs appears to be in use; using devfs names for" \
+               "mouse port choices"
+    _mouse_port_choices="/dev/misc/psaux, /dev/tts/0, /dev/tts/1, /dev/tts/2, /dev/tts/3, /dev/input/mice, /dev/adbmouse, /dev/amigamouse, /dev/atarimouse, /dev/misc/atixl, /dev/sunmouse, /dev/gpmdata"
+  else
+    debug_echo "$_func(): devfs does not appear to be in use"
+    _mouse_port_choices="/dev/psaux, /dev/ttyS0, /dev/ttyS1, /dev/ttyS2, /dev/ttyS3, /dev/input/mice, /dev/adbmouse, /dev/amigamouse, /dev/atarimouse, /dev/atibm, /dev/sunmouse, /dev/gpmdata"
+  fi
+
+  # Attempt to set a reasonable default for the mouse port in the event
+  # autodetection doesn't work.
+  case "$ARCH" in
+    alpha)
+      # Assume Alpha machines use PS/2 mice.
+      if [ -n "$_using_devfs" ]; then
+        _default_port="/dev/misc/psaux"
+      else
+        _default_port="/dev/psaux"
+      fi
+      ;;
+    amd64)
+      # Assume AMD64 machines use USB mice.
+      _default_port="/dev/input/mice"
+      ;;
+    arm)
+      debug_echo "$_func(): no good defaults known for ARM mouse configuration"
+      ;;
+    hppa)
+      debug_echo "$_func(): no good defaults known for PA-RISC mouse" \
+                 "configuration"
+      ;;
+    hurd-i386)
+      # Override the available choices on the Hurd.
+      _mouse_port_choices="/dev/mouse, /dev/gpmdata"
+      _default_port="/dev/mouse"
+      ;;
+    i386)
+      # Assume Linux x86 machines use USB mice.
+      # TODO: We could attempt some parsing of /proc/cpuinfo to default to PS/2
+      # for older x86 machines.
+      _default_port="/dev/input/mice"
+      ;;
+    ia64)
+      # Assume IA-64 machines use USB mice.
+      _default_port="/dev/input/mice"
+      ;;
+    m68k)
+      # A good default for m68k depends on which subarchitecure this is.
+      if [ -r /proc/hardware ]; then
+        _subarch=$(grep -w "Model:" | sed 's/Model:[[:space:]]+//')
+        case "$_subarch" in
+          Amiga*)
+            _default_port="/dev/amigamouse"
+            ;;
+          Atari*)
+            _default_port="/dev/atarimouse"
+            ;;
+          Macintosh*)
+            _default_port="/dev/adbmouse"
+            ;;
+          Motorola*) # BVME/MVME
+            debug_echo "$_func(): no good defaults known for VME mouse"
+                  "configuration"
+            ;;
+          Q40*) # Q40/Q60
+            _default_port="/dev/ttyS0"
+            ;;
+          *)
+            debug_echo "$_func(): unrecognized m68k subarchitecture" \
+                       "\"$_subarch\""
+            ;;
+        esac
+      else
+        debug_echo "$_func(): cannot autodetect m68k subarchitecture;" \
+                   "/proc/hardware does not exist or is not readable"
+      fi
+      ;;
+    mips|mipsel)
+      debug_echo "$_func(): no good defaults known for MIPS mouse configuration"
+      ;;
+    powerpc)
+      # A good default for PowerPC depends on which subarchitecure this is.
+      if [ -r /proc/cpuinfo ]; then
+        _subarch=$(grep "^machine" | sed 's/machine[[:space:]]+:[[:space:]]+//')
+        case "$_subarch" in
+          PowerMac*)
+            # Old World Macs use ADB mice, and New World Macs use USB mice.
+            if grep -q 'pmac-generation.*OldWorld' /proc/cpuinfo; then
+              _default_port="/dev/adbmouse"
+            elif grep -q 'pmac-generation.*NewWorld' /proc/cpuinfo; then
+              _default_port="/dev/input/mice"
+            else
+              debug_echo "$_func(): cannot autodetect whether Power Macintosh" \
+                         "is OldWorld or NewWorld; something amiss with" \
+                         "/proc/cpuinfo?"
+            fi
+            ;;
+          *)
+            debug_echo "$_func(): unrecognized powerpc subarchitecture" \
+                       "\"$_subarch\""
+            ;;
+        esac
+      else
+        debug_echo "$_func(): cannot autodetect PowerPC subarchitecture;" \
+                   "/proc/cpuinfo does not exist or is not readable"
+      fi
+      ;;
+    sparc)
+      # Assume SPARC machines use Sun (bus) mice.
+      # TODO: It would be good to be able to detect Ultra AXe motherboards,
+      # which use PS/2 peripherals, but I don't know if that is possible.
+      _default_port="/dev/sunmouse"
+      ;;
+  esac
+
+  # If we configuring for the first time, ask if the user wants to detect the
+  # mouse hardware.
+  if [ -z "$RECONFIGURE" ]; then
+    while :; do
+      # Bail out if autodetection tool not available.
+      if ! which mdetect >/dev/null 2>&1; then
+        debug_echo "$_func(): not autodetecting mouse port and protocol;" \
+                   "mdetect command not available"
+        break
+      fi
+
+      auto_answer db_input "$PRIORITY" \
+        xserver-xfree86/autodetect_mouse "false"
+      db_get xserver-xfree86/autodetect_mouse
+      if [ "$RET" = "true" ]; then
+        _mdetect_output=$(run mdetect -x)
+        if [ -n "$_mdetect_output" ]; then
+          if [ $(echo "$_mdetect_output" | wc -l) -ne 2 ]; then
+            debug_echo "$_func(): bug in mdetect; did not return two lines of" \
+                       "output"
+            break
+          fi
+          _detected_port=$(echo "$_mdetect_output" | head -n 1)
+          _detected_protocol=$(echo "$_mdetect_output" | tail -n 1)
+          debug_echo "$_func(): mdetect returned port" \
+                     "\"$_detected_port\"; protocol" \
+                     "\"$_detected_protocol\""
+          if [ -n "$_detected_port" ]; then
+            # /dev/input/mouse* means we autodetected a USB pointer; we will
+            # store /dev/input/mice instead.
+            if expr "$_detected_port" : "/dev/input/mouse.*" >/dev/null \
+              2>&1; then
+              _detected_port="/dev/input/mice"
+            fi
+          else
+            debug_echo "$_func(): bug in mdetect: returned nothing for mouse" \
+                       "port"
+            break
+          fi
+          if [ -z "$_detected_protocol" ]; then
+            debug_echo "$_func(): bug in mdetect: returned nothing for mouse" \
+                       "protocol"
+            break
+          fi
+        else
+          debug_echo "$_func(): mdetect returned no output; unable to" \
+                     "autodetect mouse"
+          # Permit the user to retry, but set the answer to false in the case
+          # question doesn't get asked (for noninteractive configuration).
+          db_set xserver-xfree86/autodetect_mouse "false"
+        fi
+        if [ -n "$_detected_port" ] \
+           && [ -n "$_detected_protocol" ]; then
+          PRIORITY="medium"
+          break # port and protocol determined
+        fi
+      else
+        debug_echo "$_func(): user declined mouse autodetection"
+        break # bail out; autodetection not desired
+      fi
+    done
+  else
+    debug_echo "$_func(): not prompting for mouse autodetection; reconfiguring"
+  fi
+
+  # Map legacy device ports to the input subsystem depending on the kernel
+  # version.
+  _default_port=$(get_mouse_port_by_linux_version "$_default_port")
+  _detected_port=$(get_mouse_port_by_linux_version "$_detected_port")
+
+  debug_echo "$_func(): mouse port choices are \"$_mouse_port_choices\""
+  debug_echo "$_func(): default port is \"$_default_port\""
+  debug_echo "$_func(): autodetected port is \"$_detected_port\""
+
+  db_subst xserver-xfree86/config/inputdevice/mouse/port choices \
+    "$_mouse_port_choices"
+  auto_answer db_input "$PRIORITY" \
+    xserver-xfree86/config/inputdevice/mouse/port \
+    "${_detected_port:-$_default_port}"
+
+  db_get xserver-xfree86/config/inputdevice/mouse/port
+  case "$RET" in
+    *psaux)
+      _mouse_protocol_choices="PS/2, ImPS/2, GlidePointPS/2, NetMousePS/2, NetScrollPS/2, ThinkingMousePS/2, MouseManPlusPS/2, ExplorerPS/2"
+      _default_protocol="PS/2"
+      ;;
+    *ttyS*|*tts/*)
+      _mouse_protocol_choices="Auto, Microsoft, MouseSystems, GlidePoint, ThinkingMouse, ValuMouseScroll, MouseMan, Logitech, IntelliMouse, MMSeries, MMHitTab"
+      _default_protocol="Auto"
+      ;;
+    *input/mice)
+      _mouse_protocol_choices="ImPS/2"
+      _default_protocol="ImPS/2"
+      ;;
+    *adbmouse|*amigamouse|*atarimouse|*atibm|*atixl|*sunmouse)
+      _mouse_protocol_choices="BusMouse"
+      _default_protocol="BusMouse"
+      ;;
+    *gpmdata)
+      _mouse_protocol_choices="IntelliMouse"
+      _default_protocol="IntelliMouse"
+      ;;
+    */mouse)
+      _mouse_protocol_choices="OSMouse"
+      _default_protocol="OSMouse"
+      ;;
+  esac
+  db_subst xserver-xfree86/config/inputdevice/mouse/protocol choices \
+    "$_mouse_protocol_choices"
+  if ! expr "$_mouse_protocol_choices" : ".*,.*" >/dev/null 2>&1; then
+    debug_echo "$_func(): \$_mouse_protocol_choices has only one value;" \
+               "setting xserver-xfree86/config/inputdevice/mouse/protocol to" \
+               "\"$_default_protocol\""
+    db_set xserver-xfree86/config/inputdevice/mouse/protocol \
+      "$_default_protocol"
+  else
+    auto_answer db_input "$PRIORITY" \
+      xserver-xfree86/config/inputdevice/mouse/protocol \
+      "${_detected_protocol:-$_default_protocol}"
+  fi
+
+  # The Hurd's mouse device doesn't support button emulation or a Z axis, per
+  # Michael Banck (see Debian Bug #259080).
+  if [ "$ARCH" = "hurd-i386" ]; then
+    db_set xserver-xfree86/config/inputdevice/mouse/emulate3buttons "false"
+    db_set xserver-xfree86/config/inputdevice/mouse/zaxismapping "false"
+  fi
+
+  PRIORITY="low"
+  run db_input "$PRIORITY" \
+    xserver-xfree86/config/inputdevice/mouse/emulate3buttons
+  run db_input "$PRIORITY" \
+    xserver-xfree86/config/inputdevice/mouse/zaxismapping
+  db_go
+}
+
 # analyze arguments; used by auto_answer()
 if [ "$1" = "reconfigure" ] || [ -n "$2" ]; then
   # if we are reconfiguring, or already have installed the package at least
@@ -895,127 +1249,8 @@
 MAY_BE_NULL=yes validate_string_db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/config/inputdevice/keyboard/options
 
 # mouse device detection
+configure_mouse
 
-# priority of xserver-xfree86/config/inputdevice/mouse/{port,protocol}
-PRIORITY=high
-AUTODETECTED_PORT=
-AUTODETECTED_PROTOCOL=
-
-# determine if we're using devfs
-if [ -c /dev/.devfsd ]; then
-  USING_DEVFS=true
-else
-  USING_DEVFS=
-fi
-
-if [ -n "$USING_DEVFS" ]; then
-  MOUSE_PORT_CHOICES="/dev/misc/psaux, /dev/tts/0, /dev/tts/1, /dev/tts/2, /dev/tts/3, /dev/input/mice, /dev/misc/atixl, /dev/gpmdata"
-  DEFAULT_PORT="/dev/misc/psaux"
-else
-  MOUSE_PORT_CHOICES="/dev/psaux, /dev/ttyS0, /dev/ttyS1, /dev/ttyS2, /dev/ttyS3, /dev/input/mice, /dev/atibm, /dev/sunmouse, /dev/gpmdata"
-  DEFAULT_PORT="/dev/psaux"
-fi
-
-# if configuring for the first time, ask if user wants to autodetect
-if [ -z "$RECONFIGURE" ]; then
-  while :; do
-    # bail out if autodetection tool not available
-    which mdetect > /dev/null 2>&1 || \
-    {
-      # Set the question's answer to false (and mark it as seen) so that in the
-      # event mdetect is installed later and this package is configured again,
-      # the autodetection question is not asked, and then nothing done about it
-      # because the subsequent questions have already been answered.  Checking
-      # the value of $RECONFIGURE is not as reliable as I'd hoped.
-      db_set xserver-xfree86/autodetect_mouse "false"
-      db_fset xserver-xfree86/autodetect_mouse seen "true"
-      break
-    }
-    auto_answer db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/autodetect_mouse "false"
-    db_get xserver-xfree86/autodetect_mouse
-    if [ "$RET" = "true" ]; then
-      set +e
-      MDETECT_OUTPUT=$(mdetect -x)
-      set -e
-      if [ -n "$MDETECT_OUTPUT" ]; then
-        if [ $(echo "$MDETECT_OUTPUT" | wc -l) -ne 2 ]; then
-          debug_echo "bug in mdetect; did not return two lines of output"
-          break
-        fi
-        AUTODETECTED_PORT=$(echo "$MDETECT_OUTPUT" | head -n 1)
-        AUTODETECTED_PROTOCOL=$(echo "$MDETECT_OUTPUT" | tail -n 1)
-        debug_echo "mdetect returned port \"$AUTODETECTED_PORT\"; protocol \"$AUTODETECTED_PROTOCOL\""
-        if [ -n "$AUTODETECTED_PORT" ]; then
-          # /dev/input/mouse* means we autodetected a USB pointer; we will
-          # store /dev/input/mice instead.
-          if expr "$AUTODETECTED_PORT" : "/dev/input/mouse.*" > /dev/null 2>&1; then
-            AUTODETECTED_PORT="/dev/input/mice"
-          fi
-        else
-          debug_echo "bug in mdetect: returned nothing for mouse port"
-          break
-        fi
-        if [ -z "$AUTODETECTED_PROTOCOL" ]; then
-          debug_echo "bug in mdetect: returned nothing for mouse protocol"
-          break
-        fi
-      else
-        debug_echo "mdetect returned no output; unable to autodetect mouse"
-        # permit user to retry, but set to false in the case question doesn't
-        # get asked (for noninteractive configuration)
-        db_set xserver-xfree86/autodetect_mouse "false"
-      fi
-      if [ -n "$AUTODETECTED_PORT" ] && [ -n "$AUTODETECTED_PROTOCOL" ]; then
-        PRIORITY=medium
-        break # port and protocol determined
-      fi
-    else
-      debug_echo "user declined mouse autodetection"
-      break # bail out; autodetection not desired
-    fi
-  done
-else
-  debug_echo "not prompting for mouse autodetection; reconfiguring"
-fi
-
-db_subst xserver-xfree86/config/inputdevice/mouse/port choices $MOUSE_PORT_CHOICES
-auto_answer db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/config/inputdevice/mouse/port "${AUTODETECTED_PORT:-$DEFAULT_PORT}"
-
-db_get xserver-xfree86/config/inputdevice/mouse/port
-case "$RET" in
-  *psaux)
-    MOUSE_PROTOCOL_CHOICES="PS/2, ImPS/2, GlidePointPS/2, NetMousePS/2, NetScrollPS/2, ThinkingMousePS/2, MouseManPlusPS/2, ExplorerPS/2"
-    DEFAULT_PROTOCOL="PS/2"
-    ;;
-  *ttyS*|*tts/*)
-    MOUSE_PROTOCOL_CHOICES="Auto, Microsoft, MouseSystems, GlidePoint, ThinkingMouse, ValuMouseScroll, MouseMan, Logitech, IntelliMouse, MMSeries, MMHitTab"
-    DEFAULT_PROTOCOL="Auto"
-    ;;
-  *input/mice)
-    MOUSE_PROTOCOL_CHOICES="ImPS/2"
-    DEFAULT_PROTOCOL="ImPS/2"
-    ;;
-  *atibm|*atixl|*sunmouse)
-    MOUSE_PROTOCOL_CHOICES="BusMouse"
-    DEFAULT_PROTOCOL="BusMouse"
-    ;;
-  *gpmdata)
-    MOUSE_PROTOCOL_CHOICES="IntelliMouse"
-    DEFAULT_PROTOCOL="IntelliMouse"
-    ;;
-esac
-db_subst xserver-xfree86/config/inputdevice/mouse/protocol choices $MOUSE_PROTOCOL_CHOICES
-if ! expr "$MOUSE_PROTOCOL_CHOICES" : ".*,.*" > /dev/null 2>&1; then
-  debug_echo "\$MOUSE_PROTOCOL_CHOICES has only one value; setting xserver-xfree86/config/inputdevice/mouse/protocol to \"$DEFAULT_PROTOCOL\""
-  db_set xserver-xfree86/config/inputdevice/mouse/protocol "$DEFAULT_PROTOCOL"
-else
-  auto_answer db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/config/inputdevice/mouse/protocol "${AUTODETECTED_PROTOCOL:-$DEFAULT_PROTOCOL}"
-fi
-
-db_input "$(priority_ceil low)" xserver-xfree86/config/inputdevice/mouse/emulate3buttons || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/inputdevice/mouse/emulate3buttons" "$?"
-db_input "$(priority_ceil low)" xserver-xfree86/config/inputdevice/mouse/zaxismapping || debug_report_status "db_input $(priority_ceil low) xserver-xfree86/config/inputdevice/mouse/zaxismapping" "$?"
-db_go
-
 # monitor setup
 PRIORITY=high
 DEFAULT_HORIZ_SYNC="28-50"



Reply to: