7 button mouse now working [ was Re: [ale] SuSe and Scrollwheel]

Michael D. Hirsch mhirsch at nubridges.com
Tue Feb 17 14:12:33 EST 2004


Following up on Dow's comments below, and with some googling and trial and 
error I now hove a working 7 button mouse.  It is a standard USB Microsoft 
Intellimouse Explorer.  It has two normal buttons, a scroll wheel which 
counts as three buttons (middle, up and down) and two buttons along the side 
which, under windows, are used as the back and forward keys when web 
browsing.

Here are my instructions for making your 7 button mouse work.  My situation 
was complicated by having a second mouse attached which X thought was my 
primary mouse.  Without that complication, this would have been pretty easy.  
More on this below.  

First, to make X understand my mouse you need these lines in your mouse's 
InputDevice section of your /etc/X11/XF86Config file:
	Option      "Buttons" "7"
	Option	    "ZAxisMapping" "6 7"
This lets the X server know that you have 7 buttons.  Unfortunately, no 
application seems to ask the X server which buttons are the scroll buttons, 
they just assume that buttons 4 and 5 are the ones you use, and now you are 
using 6 and 7.  At this point let me point out that I had to put the Buttons 
7 line in both mouse descriptions.  It is probably only necessary in my 
primary mouse, but it works if it is in both even though my other mouse has 
only 2 buttons.

Now restart the X server.  If you use xdm/gdm/kdm, be sure to really restart 
the server, not just log out and log back in.  If you forget to do this you 
will get very annoyed that your config changes have had no affect.  Take it 
from me, this is easy to do.

So now you need to remap the buttons.  Use xmodmap for this.  The comand is 
	xmodmap -e "pointer = 1 2 3 6 7 4 5"
which remaps buttons 6 and 7 to buttons 4 and 5.  You can test this by running 
xev from a shell window.  xev will put up a little window.  Place your mouse 
in that window and click away.  You will get lots of information about the 
clicks in the shell window.  Check for the button numbers.

Now you should have a working 7 button mouse, but the two side buttons don't 
do anything useful.  Time for imwheel.  Find and install imwheel.  It doesn't 
seem to be supplied for RH, but I had no trouble grabbing a random RPM off of 
rpmfind.net and installing it.

Edit .imwheelrc in your home directory and put in the following lines:
".*"
 None, Up, Alt_L|Left
 None, Down, Alt_L|Right

Finally, run imwheel like this: imwheel -k -b "67"

The end result is that the two extra buttons now send Alt-Left arrow, 
Alt-Right-arrow which most browsers can interpret as back and forward.

Once this is all working for you you should make it happen automatically.  If 
you use KDE, you can put a script in .kde/Autostart and it will get run on 
start-up.  I'm not sure how GNOME startup works.  If you don't use these, you 
probably have either .xinitrc or .Xclients which runs early in your X 
startup.

If, like me, you have 2 mice you need to be careful.  AFAICT, xmodmap can only 
affect the first mouse.  Since my USB mouse was my second mouse, xmodmap was 
not able to remap the buttons.  I had to switch things around in my 
XF86Config file so that my usb mouse was my first mouse.  After that, I had 
no trouble.

Hope this helps someone.

--Michael

On Wednesday 11 February 2004 12:02 pm, Michael D. Hirsch wrote:
> Thanks, Dow.
>
> It looks like adding this line to my mouse config in XF86Config might be
> interesting:
>          Option          "Buttons"               "6"
> I'll try it and see what happens.  It'll be a little while cause I'm 209 in
> line for the Lindows download and it's dropping somewhat slowly.  :-)
>
> Michael
>
> On Wednesday 11 February 2004 10:52 am, Dow Hurst wrote:
> > The problem at this point with the 7 buttons is that the
> > XFree mouse driver doesn't handle that many buttons
> > correctly by default and is just assigning the signal to the
> > same event.  I worked on my wife's MS Optical Trackball
> > which has 5 buttons and a scroll wheel for 7 total buttons
> > in XFree's viewpoint.  I played with arranging the buttons
> > using xmodmap in a bunch of different ways and also tried
> > both mouse drivers that would see the trackball.  Only the
> > more advanced driver and one combination of buttons made the
> > trackball useful.  I have a left mouse button for selection
> > ops.  A middle button for pasting on the scroll wheel.  A
> > button for right click type events such as displaying a
> > menu.  Two further right buttons, one that acts like the
> > right button and one that is useless by not being assigned.
> >   The scroll wheel works as buttons 4 and 5 due to the
> > reassignment of buttons to events the driver understands.
> > Try rearranging and getting button event 6 and 7 mapped to
> > your physical buttons.  Start thinking of XFree button
> > events getting mapped to physical buttons on the mouse.  So,
> > you really need to know what the physical button numerical
> > order is for your mouse.  You discover that by playing with
> > xmodmap to map out which button is physically, or
> > "electronically" identified as 1, 2, or so on.  Right now
> > you have 1-1, 2-2, 3-3, and so on.  The best examples are on
> > the XFree site under mouse configuration examples for the
> > version of XFree that your using.  I'd go there and study
> > the examples to get button events 6 and 7 placed correctly.
> >
> > I had a GE 9 event optical mouse with dual scroll wheels.
> > Depending on how I reassigned the buttons, I could get
> > reasonable functionality such as left, right, middle, and
> > single scroll wheel functions.  The second scroll wheel
> > events just weren't supported under XFree correctly at the
> > time I was working on this, so that scroll wheel would
> > either duplicate the first one or act weird depending on the
> > mapping.  That would have been XFree 4.0 and the IMP/S 2
> > driver at least under SuSE 8.1. The Windows device specific
> > driver understands and provides more functionality for the
> > device than the XFree generic mouse drivers such as XY
> > scrolling.  This is an area that needs work.
> > Dow
> >
> > Michael D. Hirsch wrote:
> > > On Tuesday 10 February 2004 05:41 pm, Dow Hurst wrote:
> > >>You can remap the mouse keys via a small script when you log
> > >>in.  Here is an example to get a Microsoft 5 button
> > >>trackball to work and set my dpms setting at the same time
> > >>when I would log into KDE.
> > >>
> > >>#!/bin/sh
> > >>xset dpms 900 1000 1100
> > >>xmodmap -e "pointer = 1 6 7 3 2 4 5"
> > >>exit
> > >
> > > Cool.  I didn't know about the pointer command in xmodmap.  Can I use
> > > this on my 7 button mouse?  I just realized that my USB Microsoft
> > > Intellimouse has two buttons I never use.  It has the standard 5
> > > buttons (Left, Right, middle, scrull up, scroll down) but there are two
> > > more buttons under my thumb.  It there a way to map them?
> > >
> > > I've run xev to watch the X events, and I can't tell them apart:
> > > Real button 3:
> > > ButtonPress event, serial 27, synthetic NO, window 0x8600001,
> > >     root 0x3f, subw 0x0, time 1901077568, (54,174), root:(58,505),
> > >     state 0x10, button 3, same_screen YES
> > >
> > > ButtonRelease event, serial 27, synthetic NO, window 0x8600001,
> > >     root 0x3f, subw 0x0, time 1901077768, (54,174), root:(58,505),
> > >     state 0x410, button 3, same_screen YES
> > >
> > > Button 6:
> > > ButtonPress event, serial 27, synthetic NO, window 0x8600001,
> > >     root 0x3f, subw 0x0, time 1901083912, (54,174), root:(58,505),
> > >     state 0x10, button 3, same_screen YES
> > >
> > > ButtonRelease event, serial 27, synthetic NO, window 0x8600001,
> > >     root 0x3f, subw 0x0, time 1901084088, (54,174), root:(58,505),
> > >     state 0x410, button 3, same_screen YES
> > >
> > > It there a way to do anything with these buttons?
> > >
> > > Michael
> > >
> > > _______________________________________________
> > > Ale mailing list
> > > Ale at ale.org
> > > http://www.ale.org/mailman/listinfo/ale
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list