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

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



Author: branden
Date: 2004-09-28 00:57:01 -0500 (Tue, 28 Sep 2004)
New Revision: 1884

Modified:
   branches/debconf-overhaul/debian/CHANGESETS
   branches/debconf-overhaul/debian/xserver-xfree86.config.in
   branches/debconf-overhaul/debian/xserver-xfree86.templates
Log:
Add new function get_mouse_port_by_linux_version().  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.  Update configure_mouse() to filter the default and
autodetected mouse ports through this function.  Don't filter what the user
actually selects -- do exactly what we're told.

Expand the mouse port template description to document the following issues:
- non-x86 bus mice (ADB, Amiga, Atari, Sun)
- the GPM repeater
- the Hurd
Also add Linux kernel config help-style "if in doubt" advice for Linux and
Hurd users since this template description is getting really long.


Modified: branches/debconf-overhaul/debian/CHANGESETS
===================================================================
--- branches/debconf-overhaul/debian/CHANGESETS	2004-09-28 05:47:50 UTC (rev 1883)
+++ branches/debconf-overhaul/debian/CHANGESETS	2004-09-28 05:57:01 UTC (rev 1884)
@@ -107,6 +107,19 @@
   mice on NewWorld PowerMacs.
 + Update configure_mouse() to include defaults appropriate to the Hurd (thanks,
   Michael Banck).  (Closes: #259080)
++ Add new function get_mouse_port_by_linux_version().  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.  Update configure_mouse() to filter the default and
+  autodetected mouse ports through this function.  Don't filter what the user
+  actually selects -- do exactly what we're told.
++ Expand the mouse port template description to document the following issues:
+  - non-x86 bus mice (ADB, Amiga, Atari, Sun)
+  - the GPM repeater
+  - the Hurd
+  Also add Linux kernel config help-style "if in doubt" advice for Linux and
+  Hurd users since this template description is getting really long.
 + Update logic in configure_monitor() to actually use information collected
   from read-edid utilities, add comments, and trace the function's operation.
   Thanks to Jay Berkenbilt for his analysis.  (Closes: #229850)

Modified: branches/debconf-overhaul/debian/xserver-xfree86.config.in
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-28 05:47:50 UTC (rev 1883)
+++ branches/debconf-overhaul/debian/xserver-xfree86.config.in	2004-09-28 05:57:01 UTC (rev 1884)
@@ -1068,6 +1068,76 @@
     xserver-xfree86/config/inputdevice/keyboard/options
 }
 
+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.
+
+  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.
+    trace "$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
+
+  trace "$func(): mapping \"$input\" to \"$output\""
+
+  echo "$output"
+}
+
 configure_mouse () {
   # syntax: configure_mouse
   #
@@ -1268,6 +1338,15 @@
     trace "$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")
+  autodetected_port=$(get_mouse_port_by_linux_version "$autodetected_port")
+
+  trace "$func(): mouse port choices are \"$mouse_port_choices\""
+  trace "$func(): default port is \"$default_port\""
+  trace "$func(): autodetected port is \"$autodetected_port\""
+
   db_subst xserver-xfree86/config/inputdevice/mouse/port choices \
     "$mouse_port_choices"
   auto_answer db_input "$PRIORITY" \

Modified: branches/debconf-overhaul/debian/xserver-xfree86.templates
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.templates	2004-09-28 05:47:50 UTC (rev 1883)
+++ branches/debconf-overhaul/debian/xserver-xfree86.templates	2004-09-28 05:57:01 UTC (rev 1884)
@@ -347,10 +347,24 @@
  DB-25); the mouse connector is female (has holes) and the computer connector
  is male (has pins).  PS/2 ports are small round connectors (DIN) with 6 pins;
  the mouse connector is male and the computer side female.  You may
- alternatively have a USB mouse, a bus/inport (very old) mouse, or be using
- the gpm program as a repeater.  If you need to attach or remove PS/2 or
- bus/inport devices from your computer, please do so with the computer's power
- off.
+ alternatively have a USB mouse, a bus/inport (ADB, Amiga, Atari, Sun, or very
+ old PC) mouse, or be using the gpm program as a repeater.  If you need to
+ attach or remove PS/2 or bus/inport devices from your computer, please do so
+ with the computer's power off.
+ .
+ You can also use the General Purpose Mouse (gpm) program to set up a
+ "repeater" at /dev/gpmdata, and instruct the X Window System to use that.
+ Note that if you choose /dev/gpmdata but have not installed the gpm package
+ and explicitly configured it to act as a repeater, the X Window System server
+ will be unable to start, and no graphical user interface will be available.
+ .
+ On the GNU Hurd, the only supported mouse devices are the OS mouse interface
+ (/dev/mouse) and the GPM repeater.
+ .
+ As of Linux 2.4, USB and bus/inport mice use the input subsystem
+ (/dev/input/mice).  As of Linux 2.6, PS/2 mice use the input subsystem as
+ well.  Therefore, if in doubt, Linux users should choose /dev/input/mouse,
+ and Hurd users should choose /dev/mouse.
 
 Template: xserver-xfree86/config/inputdevice/mouse/protocol
 Type: select



Reply to: