Scroll Wheel

From SlackWiki
Jump to: navigation, search

Many people wonder how to enable scrolling on their Mouse, This tutorial is going to describe how to enable it on X-Windows. First you must figure out what Slackware version you are running. This is needed to tell if you edit the XF86Config or the xorg.conf file. The first step is to su into root:

su

Then you must edit the X config, On slackware 9.1 it is:

vi /etc/X11/XF86Config

And on Slackware 10.0 you must edit xorg.conf:

vi /etc/X11/xorg.conf

3 and 5 button mice

I used "vi" to edit my files because that's my editor of choice, But if you want to use pico, or anything else feel free to do so. Now you must search for the following items in the config:

Section "InputDevice"
Identifier "Mouse0"

Now below that you must add the following items:

Option "Buttons" "5"
Option "ZAxisMapping" "4 5"

And I had to change the mouse protocol, so if it doesn't work you should change it to IMPS/2:

Option "Protocol" "IMPS/2"

Summing it up, below is the entire section:

Section "InputDevice"
       Identifier            "Mouse0"
       Driver "mouse"
       Option "Device"       "/dev/input/mice"
       Option "Protocol"     "IMPS/2"
       Option "Buttons"      "5"
       Option "ZAxisMapping" "4 5"
EndSection

The last step is saving the file and restarting X, you now should have a scrolling mouse:)

7 button mice

You can use the command `X -version` to find your version of X.
Here is a section of xorg.conf for 7 button mouse (MX-700) will most likely work for others..

Section "InputDevice"
       Identifier            "Mouse0"
       Driver "mouse"
       Option "Device"       "/dev/input/mice"
       Option "Protocol"     "ExplorerPS/2"
       Option "Buttons"      "7"
       Option "ZAxisMapping" "6 7"
EndSection

You then need to use Xmodmap to remap the scroll wheel, this can be ~/.Xmodmap or /etc/X11/xinit/.Xmodmap or even just `xmodmap -e` in whatever X startup script you're using. The extra 2 buttons (usually forward/back) will be mapped in most web browsers like galeon and firefox. If you need to map them for other applications, look at imwheel http://imwheel.sourceforge.net/

pointer = 1 2 3 6 7 4 5


Xorg 6.9 (Slackware-current as of May 30th, 2006) has a known issue with correctly exposing the number of mouse buttons present. The presence of this problem may be verified by running xmodmap -pp and noting the presence of 11 buttons instead of 7. (xev was handy in determining what number each button was being read as.)

This may be corrected by using the following Xmodmap:

pointer = 1 2 3 8 9 4 5 6 7 10 11

Multi-Button Mice

Recent versions of the XOrg server include a ButtonMapping option that allows you to remap mouse buttons in a specific order. This is particularly useful for users of multi-button mice such as the Razer DeathAdder and MS Intellimouse Explorer. The following section of an xorg.conf file (modified from this blog post) allows you to use the additional "thumb buttons" under X as you would on MS Windows provided applications support that functionality (the expected behavior is the default for Firefox, the additional buttons seem to do nothing in Konqueror by default).

Section "InputDevice"
   Identifier     "Mouse1"
   Driver         "mouse"
   Option         "Name" "Razer Deathadder"
   Option         "Device" "/dev/mouse"
   Option         "Vendor" "Razer"
   Option         "CorePointer"
   Option         "Protocol" "ExplorerPS/2"
   Option         "Buttons"  "7"
   Option         "ZAxisMapping" "4 5"  
   Option         "ButtonMapping" "1 2 3 6 7"
EndSection

Each mouse is different, so you should use xev to verify that the additional buttons are working in the manner that they ought.

MX1000

Here is my Logitech MX1000 configuration, it allows ALL buttons on this mouse to work with X11 (X.org 6.8.2 + evdev patches).

xorg.conf

Section "InputDevice"
       Identifier                "MX1000"
       Driver  "mouse"
       Option  "CorePointer"
       Option  "Protocol"        "evdev"
       Option  "Dev Name"        "Logitech USB Receiver"
       Option  "Buttons"         "12"
       Option  "ZAxisMapping"    "11 12 10 9"
       Option  "Resolution"      "800"
       Option  "Emulate3Buttons" "false"
EndSection

Xmodmap

! MX1000
pointer = 1 2 3 8 9 10 11 12 6 7 4 5

xbindkeysrc xbindkeys xvkbd

# Backward and Forward buttons
"xvkbd -text "\[Alt_L]\[Left]""
  m:0x10 + b:8
"xvkbd -text "\[Alt_L]\[Right]""
  m:0x10 + b:9
# "Cruise Control"
"xvkbd -text "\[Page_Up]""
  m:0x10 + b:11
"xvkbd -text "\[Page_Down]""
  m:0x10 + b:12

EvDev

This info will help you get your MX1000 or other evdev device working with X.org 6.9/7.0. This version of X.org has the evdev driver and does not need to be patched.

First, edit (or create) your /etc/udev/rules.d/10-local.rules file and add the following line:

KERNEL=="event*", SYSFS{../manufacturer}=="Logitech",  SYSFS{../product}=="USB Receiver", NAME="input/mx1000", MODE="664", GROUP="plugdev"

This gives you a /dev/input/mx1000 node after running udevstart or rebooting. If your mouse is different, dig through sysfs and use lsusb and udevinfo to find your manufacturer and product. They need to match.

Next edit your /etc/X11/xorg.conf, add/change your mouse section to this:

Section "InputDevice"
       Identifier      "Logitech MX1000"
       Driver          "evdev"
       Option          "Device" "/dev/input/mx1000"
EndSection

NOTE that you no-longer specify "ZAxisMapping" or "Buttons", the evdev driver takes care of this for you.

Your ServerLayout section should be adjusted if you changed the Identifier line above:

InputDevice "Logitech MX1000" "CorePointer"

You no-longer need Xmodmap to remap the scroll wheel buttons. Remove any system-wide and user Xmodmap/.Xmodmap files (or sections you have in those files pertaining to your mouse).

You still need xbindkeys and xvkbd as listed above to bind forward/back and pageup/down buttons.

(This info was gathered from a much better and thorough guide, you should check it out. http://floam.sh.nu/index.xhtml?page=guides&section=mx1000)

X.org 7.1

You do not need to use the udev tricks above, this just makes things more difficult. Instead, now X will read your evdev device in a much more sane way. Here is my config for an MX1000 and X.org 7.2. This will work for nearly all USB mice, and is the preferred Driver since it eliminates the need to specify Buttons, ZAxisMapping, Xmodmap, etc. All of your buttons will work and be mapped correctly.

Section "InputDevice"
        Identifier      "MX1000"
        Driver          "evdev"
        Option          "Name"          "Logitech USB Receiver"
        Option          "CorePointer"
EndSection

You may have to use "Dev Name" if "Name" does not work. You can find the "Name" by doing cat /proc/bus/input/devices

I: Bus=0003 Vendor=046d Product=c50e Version=2500
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.3-1/input0
S: Sysfs=/class/input/input2
H: Handlers=mouse0 event2 
B: EV=7
B: KEY=ffff0000 0 0 0 0 0 0 0 0
B: REL=143