LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-21-2009, 11:23 PM   #1
jorgemarmo
LQ Newbie
 
Registered: Sep 2009
Posts: 17

Rep: Reputation: 0
I need to remapp one o my mouse buttons


Hi, I have a Microsoft Comfort Optical Mouse 3000 conected via usb (on jaunty) and the left button, or thumb, or red button on firefox makes "forward" instead of backward... anyway I would like to set this button as the middle button... I have seen many forums about this very same mouse but they just modify the xorg.conf to make it works but my xorg.conf doesn't has any "input Device" sections, even so I try adding this sections several times, but it always did the same (forward)


Any ideas?

Thanks.-
 
Old 09-21-2009, 11:30 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
The xorg.conf method is the way I know of to do it. Here's the relevant portion:

Code:
Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Device" "/dev/psaux"
    Option         "Protocol" "ExplorerPS/2"
    Option         "Buttons" "7"
    Option         "ZAxisMapping" "4 5"
    Option         "ButtonMapping" "1 2 3 6 7"
EndSection
Note the bold sections. The ZAxisMapping determines which way the scroll wheel works (up/down or down/up) and the ButtonMapping entry determines which other buttons are interpreted as which action. You will need to experiment with the ButtonMapping line, to (A) add all your buttons, if you have more than this example; (B) determine which number corresponds to what button on your mouse; and (C) swap the button(s) you want to act differently than they do now.

PS - As far as I remember, you can also put the same number more than once, if you would like more than one button to perform the same action.

PPS - You can do the exact same thing using the `xmodmap` command. Read its man page for usage details, and/or Google "mouse button xmodmap" or something like this, for more info. That way, you don't need to do the xorg.conf thing.

Hope this works for you! If so, post what you ended up with.

Sasha

Last edited by GrapefruiTgirl; 09-21-2009 at 11:41 PM.
 
Old 09-21-2009, 11:51 PM   #3
jorgemarmo
LQ Newbie
 
Registered: Sep 2009
Posts: 17

Original Poster
Rep: Reputation: 0
thanks you GrapefruiTgirl... now a couple of questions:
1) how do I know where my mouse is mounted? cuz I've seen Option "Device" "/dev/psaux" "/dev/input/mice"
and a couple more....
2) Protocol is the stand for?? I've seen Option "Protocol" "ExplorerPS/2" "ImPS/2"
3) xev shows that the button I want to change is number "9" and what the other forums says, as well as you, is that I can repeat the number 2 (middle button) on the "ButtonMapping" however it doesn't works for me... I beleive that my X doesn't read the mice configuration in the xorg.conf...
this is mine
#####

Section "Monitor"
Identifier "Configured Monitor"
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
DefaultDepth 24
Option "AddARGBGLXVisuals" "True"
EndSection

Section "Module"
Load "glx"
EndSection

Section "Device"
Identifier "Configured Video Device"
Driver "nvidia"
Option "NoLogo" "True"
EndSection
###########


4) There is any way to remap it on firefox? I mean, firefox is recognizing the button, so can I assign another function to it?


thanks again.-
 
Old 09-22-2009, 12:18 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
mouse button swapping

First, read this: https://launchpad.net/ubuntu/+source/xorg/+bug/52288
Then, read this: http://ubuntuforums.org/showthread.php?t=252467

The second link appears to be a user having the exact same issue as you, with the button doing the wrong action in Firefox.
Below is a chunk fo their xorg.conf for the mouse. It's the same mouse, so evidently it uses the "ExplorerPS/2" protocol. The "Protocol" tells the X server something about what sort of mouse it is, and how to communicate with it. I don't really know the guts of it, but if ExplorerPS/2 works for you, then that's the important part

Notice the button mapping they put there; that is how they fixed the problem you are having; they switched a few buttons around.
Your current xorg.conf has no mouse section, and no keyboard section, which is fine until you need to do something like this so you will need to add the mouse section as described below:
Code:
Section "InputDevice"
	Identifier	"Configured Mouse"
	Driver		"mouse"
	Option		"CorePointer"
	Option		"Device"		"/dev/input/mice"
	Option		"Protocol"		"ExplorerPS/2"
	Option		"ZAxisMapping"		"4 5"
	Option		"Emulate3Buttons"	"true"
	Option		"Buttons"		"8"
	Option		"ButtonMapping"		"1 2 3 8 6 7"
EndSection
As far as I recall, /dev/mouse and /dev/psaux both point to the same place. However, these usually are used for PS/2 mouses, not USB mouses; USB mouses commonly (not always) use one of the /dev/input/mice sort of entries. If you only have the single mouse connected, then if it were me, I would try /dev/input/mice first. You could unplug the mouse, and run `udev-monitor` or `udevadm monitor --kernel` in a console, and with that running, plug in the mouse and note on the console which USB address the device is being connected to, but this is maybe more than you will need to do. Let's hope it's /dev/input/mice.

NOTE: before trying ANY of the above, why not try using `xmodmap` as it might end up being much simpler:

EDIT: I made a typo -- the corrected line is like this:
shell# xmodmap -e "pointer = 1 2 3 4 5 8 6 7"

and see if that fixes it right there on the spot.

If it does, you can just add that line to one of your boot scripts. If it works, but makes the buttons wrong in a different way, then again, you'll need to fiddle around with the ordering of the 6,7,8 buttons.

Oh, and BTW - I don't know of any way to make this change directly within Firefox, because Firefox receives its inputs via the X server, so one way or the other, you need to fix it with X, not Firefox.

Best of luck!

Sasha

Last edited by GrapefruiTgirl; 09-22-2009 at 12:27 AM. Reason: Sorry -- I just corrected the XMODMAP command
 
Old 09-23-2009, 11:52 AM   #5
jorgemarmo
LQ Newbie
 
Registered: Sep 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Sasha, thanks for the posts but I've already read those, and I try every single combination of the xorg files I saw there but nothing seems to work, even with "Emulate3Buttons" "true" also try with "false"
"Buttons" "8" also with "9"
and a lot more....

I did
xmodmap -e "pointer = 1 2 3 4 5 8 6 7"
and I get this Warning: Only changing the first 8 of 32 buttons.
any change....

then I add the device section u give me and nothing change...
btw, there is any other way to restart X ??? (on jaunty the block Ctrl+alt+backspce and due to security reasons I don't want to enable it)...

I did the udevadm monitor --kernel
and shows me this:
KERNEL[1253724108.504001] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1 (usb)
KERNEL[1253724108.524591] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0 (usb)
KERNEL[1253724108.524935] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0/0003:045E:00D1.0002 (hid)
KERNEL[1253724108.564015] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0/input/input6 (input)
KERNEL[1253724108.579409] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0/input/input6/mouse1 (input)
KERNEL[1253724108.596022] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0/input/input6/event4 (input)
KERNEL[1253724108.596121] add /devices/virtual/hidraw/hidraw0 (hidraw)
KERNEL[1253724108.596233] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/1-3.1:1.0/usb_endpoint/usbdev1.7_ep81 (usb_endpoint)
KERNEL[1253724108.596346] add /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3.1/usb_endpoint/usbdev1.7_ep00 (usb_endpoint)


it didn't looks like /dev/input/mice.... any suggest??
btw the mouse is coneccted to a usb hub, does it change something?

Thnaks again!
 
  


Reply

Tags
mouse, remapping



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mouse buttons Carpo Slackware 4 09-03-2008 11:26 AM
Remapping Mouse Buttons on a MS Comfort Optical Mouse 3000 Seph64 Linux - Hardware 1 08-10-2008 02:55 PM
Mouse back and forward buttons are interpreted as buttons 2 and 3 (MX610) jot-87 Linux - Hardware 1 08-06-2007 11:12 AM
Help binding mouse buttons to keyboard buttons Eckstona Linux - Hardware 6 09-24-2006 07:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration