Configuring mice (Serial, PS/2, USB)

From LQWiki
Jump to: navigation, search

Basics

There are several different mice protocols and connectors.

Kernel 2.6

Since the 2.6 kernel these are handled by the kernel and all input is directed to /dev/input/mice.

Mouse device files

Where to look for each different mouse type:

  • /dev/input/mice - Kernel 2.6 and USB configuration
  • /dev/psaux - PS/2 mice
  • /dev/ttyS?? - Serial mice (COM 1 = ttyS0, COM 2 = ttyS1 etc)
  • /dev/sunmouse - serial mouse on sparc systems
  • /dev/mouse - usually a link to one of the above

XFree86 configuration

Here is a relevent section of XF86Config

   Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "<type>"
        Option      "Device" "/dev/mouse"
        Option      "ZAxisMapping" "4 5" #used with imps/2 protocol
   EndSection

Where <type> can be one of

  • auto -- try to detect the protocol automatically
  • PS/2 -- original PS/2
  • serial -- for mice connected to a serial port
  • usb -- for USB mice
  • IMPS/2 -- extended PS/2 (IM=IntelliMouse), supports scroll wheel
  • ExplorerPS/2 -- extended PS/2, supports scroll wheel and side buttons
  • Full list can be found in the mouse driver man page or in the Xserver documentation

Newer XFree86 can auto detect most things. a basic setup may be like:

   Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"
   EndSection

and this will be sufficient to get a mouse working on many newer linux distributions and/or combinations of XFree86 4.x.x and Kernel 2.4 and 2.6. This is also the default output of X -config when using X to auto create an XF86Config file.

Buttons

First of all the protocol selected needs to support it, then there are several options to configure the mouse buttons that can be put in an InputDevice section of the XF86Config. Set the number of buttons, replace X with an actual number (like "6").

Option "Button" "X"

Configure the scroll wheel/Z-Axis, replace X with the button numbers that act as the scroll wheel, usually "4 5". (note you can also use the actual letters 'X' and 'Y' to map the scroll wheel to those axis, meaning the pointer can be moved with the scroll wheel)

Option "ZAxisMapping" "X"

Which buttons maps to which number can be assigned with xmodmap, e.g. a three button mouse, to inverse the two outer buttons:

$ xmodmap -e "pointer = 3 2 1"

put xmodmap -e "pointer = 3 2 1" into a file called .Xmodmap. Chmod +x the file and place it in your home directory, and the command will be called when you start X.

Disabling "tap-on-click"

To disable tap-on-click on a touchpad, switch to root and edit section of /etc/X11/XF86Config like so:

Section "InputDevice"
    Identifier "SynapticsMouse1"
    Driver "synaptics"
    Option "SHMConfig" "on"
    Option "TouchpadOff" "2"
EndSection

Your identifier, driver and some other options may differ, but the important part here is Option "TouchpadOff" "2".