HOWTO Mouse Scrollwheel

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc


  XOrg Index Configuration HIDevices
Fonts Video Cards Monitors  




Merge-arrows.gif It has been suggested that this article be Merged into one article with HOWTO_Advanced_Mouse    (Discuss)

Contents

[edit] Article Merge with Advanced Mouse

This article is deprecated in favor of HOWTO_Advanced_Mouse. Please update your links.

[edit] Introduction

Adding the following section related to your mouse to the X11 Config file should allow use of the scroll wheel.

There are usually two steps required to get the scroll wheel working. First you must put the correct settings into your X11 configuration file; and second, you need to modify your button mappings to tell X which buttons do what. USB users should pay attention to their THC driver.

[edit] USB HCD driver

This chapter is for users with a USB mouse only.

Before starting with the X configuration, make sure you are using the correct USB HCD driver. If you have a Via-chipset for example, you should use uhci_hcd instead of ohci_hcd. If you use the wrong HCD driver, your mouse will work, but your mouse wheel won't! (also, try ehci_hcd for USB 2.0)

(NOTE: this probably occurs because the kernel is getting info about the mouse from the BIOS as a basic mouse with 2 buttons, no scrollbutton. Without the HCD drivers, this is all the kernel has to go on)

Use lspci to findout your chipset.

[edit] evdev as a workaround

On a Compaq Armada 7400 (OHCI) with an attached USB Logitech trackball mouse, I found that no amount of tinkering with xorg.conf would get the scrollwheel working. I tried all other HCI drivers to be sure to no avail. xev would not show any inputs being received when the scrollwheel was rolled.

Then I tried using evdev and everything worked perfectly without even using xmodmap. So if all else fails give evdev a try.

[edit] X11 Config File Location

Your X11 Config file can usually be found as /etc/X11/xorg.conf.

[edit] X11 Config File Settings

[edit] Microsoft Optical Scroll Wheel Mouse (PS2)

File: /etc/X11/xorg.conf
Section "InputDevice"
    Identifier  "Mouse1" 
    Driver      "mouse"
    Option "Protocol"     "auto"     # In case of problems, use "IMPS/2", because the PS/2 protocol doesn't seem to support a scroll wheel
    Option "Device"       "/dev/input/mice"
    Option "ZAxisMapping" "4 5"        # adding this enables the scroll wheel
    Option "Buttons"      "5"          # you may need to force the number of buttons on the mouse
EndSection

The above changes also work for non-optical MS mice. I'm assuming that the above changes would also work for some non-Microsoft brand mice as well. It sure works for Compaq PS/2 mouse.

[edit] Logitech MX700 and MS IntelliMouse Explorer

File: /etc/X11/xorg.conf
Section "InputDevice"
   Identifier  "Mouse1"
   Driver      "mouse"
   Option "Protocol"     "ExplorerPS/2"
   Option "Device"       "/dev/input/mice"
   Option "Buttons"      "7"          # adding this enables the extra buttons on the MX700
   Option "ZAxisMapping" "6 7"        # adding this maps wheel scrolling events for mouse buttons 6 & 7
EndSection

Mouse Button Mappings (Command-line example. See Mouse Button Mapping Modifications for details.):

$ xmodmap -e "pointer = 1 2 3 6 7 4 5"

[edit] Logitech (Generic)

File: /etc/X11/xorg.conf
Section "InputDevice"
   Identifier  "Mouse1"
   Driver      "mouse"
   Option "Device"       "/dev/input/mice"
   Option         "Protocol" "Auto"
   Option "Buttons" "5"          # adding this enables the extra buttons on the MX510
   Option "ZAxisMapping" "4 5"        # adding this maps wheel scrolling events to mouse buttons 4 & 5
EndSection

[edit] Logitech MX500, MX510, MX518

File: /etc/X11/xorg.conf
Section "InputDevice"
   Identifier  "Mouse1"
   Driver      "mouse"
   Option "Device"       "/dev/input/mice"
   Option "Buttons"      "10"          # adding this enables the extra buttons on the MX510
   Option "ZAxisMapping" "9 10"        # adding this maps wheel scrolling events to mouse buttons 9 & 10
   Option "ZAxisMapping" "4 5"         # this mapping works for MX518 mice
EndSection

Mouse Button Mappings (Command-line example. See Mouse Button Mapping Modifications for details.):

$ xmodmap -e "pointer = 1 2 3 6 7 8 9 10 4 5"

You could also emerge logitech-applet which can be used to turn on smooth scrolling and up the resolution of your optical sensor to 800dpi.

Please note: with XOrg 7.0, you have to use evdev instead of mouse driver to get all the buttons working (see below and in HOWTO_Advanced_Mouse).

[edit] Logitech MX510, Modular Xorg and evdev

File: /etc/X11/xorg.conf
Section "InputDevice"
   Identifier  "Mouse1"
   Driver      "evdev"
   Option "Device"       "/dev/input/event1" # cat /proc/bus/input/devices - look up the handler
EndSection

And:

$ xmodmap -e "pointer = 1 3 2 4 5 8 9 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32"

[edit] Mouse Button Mapping Modifications

Depending on how you start your X11 session, there are several ways to modify your mouse button mappings.

[edit] Via the Command Line

You can always modify your button mappings from the command line using xmodmap. In fact, this is a good way to test things to ensure that you have the right mappings.

 $ xmodmap -e "pointer = <button numbers>"

for example, for the Logitech MX700 and MS IntelliMouse Explorer, you could try:

 $ xmodmap -e "pointer = 1 2 3 6 7 4 5"

For other mice, just replace the mapping numbers with those appropriate for your mouse, as listed above in X11 Config File Settings.

[edit] Server Wide Settings

Alternatively, you can modify the mappings using a server-wide configuration file that is loaded with each X session. The location of this file will vary depending on how you start your X sessions.

Again, the examples are for the Logitech MX700 and MS IntelliMouse Explorer. Replace the button mappings as appropriate for your mouse. (See above for mappings appropriate to your mouse.)

Gnome Display Manager (gdm)

 # echo "pointer = 1 2 3 6 7 4 5" >> /etc/X11/Xmodmap

Or alternatively for each user separately

 # echo "pointer = 1 2 3 6 7 4 5" >> ~/.Xmodmap

X Display Manager (xdm) or Manual Start (startx)

 # echo "pointer = 1 2 3 6 7 4 5" >> /usr/X11R6/lib/X11/xinit/.Xmodmap

Note that these files may not already exist on your system. The above commands will create them if they do not already exist, and append to the end of them if they do.

[edit] More Info - xmodmap

Independent of how or where you put your mapping settings, xmodmap will be used (either explicitly or implicity behind the scenes) to perform the change. To better understand what's going on, check out the xmodmap man page.

 $ man xmodmap

[edit] See also

Personal tools