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

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



Author: branden
Date: 2004-09-22 03:50:51 -0500 (Wed, 22 Sep 2004)
New Revision: 1849

Modified:
   branches/debconf-overhaul/debian/xserver-xfree86.config.in
Log:
Add support for ADB, Amiga, and Atari mice.

Set more reasonable hardware-specific mouse port default even in the
absence of mdetect.


Modified: branches/debconf-overhaul/debian/xserver-xfree86.config.in
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-22 07:36:32 UTC (rev 1848)
+++ branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-22 08:50:51 UTC (rev 1849)
@@ -1075,7 +1075,8 @@
   # section (using the "mouse" driver) of the XF86Config-4 file.
 
   local autodetected_port autodetected_protocol default_port default_protocol \
-    func mdetect_output mouse_port_choices mouse_protocol_choices using_devfs
+    func mdetect_output mouse_port_choices mouse_protocol_choices subarch \
+    using_devfs
 
   func="configure_mouse"
 
@@ -1099,14 +1100,110 @@
   if [ -n "$using_devfs" ]; then
     trace "$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/misc/atixl, /dev/gpmdata"
-    default_port="/dev/misc/psaux"
+    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
     trace "$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/atibm, /dev/sunmouse, /dev/gpmdata"
-    default_port="/dev/psaux"
+    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)
+      trace "$func(): no good defaults known for ARM mouse configuration"
+      ;;
+    hppa)
+      trace "$func(): no good defaults known for PA-RISC mouse configuration"
+      ;;
+    hurd-i386)
+      ;;
+    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 sub-architecure 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
+            trace "$func(): no good defaults known for VME mouse"
+                  "configuration"
+            ;;
+          Q40*) # Q40/Q60
+            trace "$func(): no good defaults known for Q40/Q60 mouse"
+                  "configuration"
+            ;;
+        esac
+      else
+        trace "$func(): cannot autodetect m68k sub-architecture;" \
+              "/proc/hardware does not exist or is not readable"
+      fi
+      ;;
+    mips|mipsel)
+      trace "$func(): no good defaults known for MIPS mouse configuration"
+      ;;
+    powerpc)
+      # A good default for PowerPC depends on which sub-architecure 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'; then
+              default_port="/dev/adbmouse"
+            elif grep -q 'pmac-generation.*NewWorld'; then
+              default_port="/dev/input/mice"
+            else
+              trace "$func(): cannot autodetect whether Power Macintosh is" \
+                    "OldWorld or NewWorld; something amiss with /proc/cpuinfo?"
+            fi
+            ;;
+          *)
+            trace "$func(): no good defaults known for non-PowerMac PowerPC" \
+                  "mouse configuration"
+            ;;
+        esac
+      else
+        trace "$func(): cannot autodetect PowerPC sub-architecture;" \
+              "/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 configuring for the first time, ask if user wants to autodetect
   if [ -z "$RECONFIGURE" ]; then
     while :; do
@@ -1166,6 +1263,14 @@
     trace "$func(): not prompting for mouse autodetection; reconfiguring"
   fi
 
+  # XXX: commented out until BR knows for sure that this is correct
+  # If using Linux kernel 2.6, force /dev/input/mice to be the default.
+  # if dpkg --compare-versions "$(uname -r)" gt "2.6"; then
+  # trace "$func(): Linux 2.6 or later detected; forcing default mouse port" \
+  #       "to /dev/input/mice"
+  # default_port="/dev/input/mice"
+  # fi
+
   db_subst xserver-xfree86/config/inputdevice/mouse/port choices \
     "$mouse_port_choices"
   auto_answer db_input "$PRIORITY" \



Reply to: