LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   I need to remapp one o my mouse buttons (https://www.linuxquestions.org/questions/linux-hardware-18/i-need-to-remapp-one-o-my-mouse-buttons-756911/)

jorgemarmo 09-21-2009 11:23 PM

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.-

GrapefruiTgirl 09-21-2009 11:30 PM

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

jorgemarmo 09-21-2009 11:51 PM

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.-

GrapefruiTgirl 09-22-2009 12:18 AM

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

jorgemarmo 09-23-2009 11:52 AM

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!


All times are GMT -5. The time now is 11:13 PM.