Wiki Table of Contents

Add mouse functionality


On this page:


Computer mouses with multiple buttons, including side-to-side, sometimes do not work in Linux. This page assembles methods that try to correct such a situation.

Edit the xorg.conf file: Method 1

On Jessie (MX-15 and possibility for antiX-15), a simple configuration works OOTB at least for some mice. It is possible that this will work with MX-14, though that is untested.

IMPORTANT: Before making any changes, back up your /etc/X11/xorg.conf file. You want to edit /etc/X11/xorg.conf as root so that you can add a section for your new mouse. Find the mouse section, and change it as follows:

Section "InputDevice"
   Identifier  "Mouse0"
   Driver      "mouse"
   Option       "Protocol" "auto"
   Option       "Device" "/dev/input/mice"
   Option       "ZAxisMapping" "4 5 6 7"
EndSection

(For other options and their values, check the Xorg mouse support link below.)

At the top of your xorg.conf, you’ll find Section “ServerLayout”. Look for the line InputDevice associated with the mouse, and change it to read (assuming you used “Mouse0” for the name, otherwise change it as needed):

InputDevice "Mouse0" "CorePointer"

If you have more than one mouse, then you will multiple mouse sections with different names (Identifier values). This is known to work with the following devices:

  • Logitech M305

Edit the xorg.conf file: Method 2

The older method discussed here may work for some situations.

Gather information

Let’s assume for the moment that we are dealing with a standard modern logitech design – 2 standard buttons, mouse wheel clickable (3rd button substitute), scroll up/down, scroll left/right, 2 thumb buttons. If this not correct you can modify xorg later.

First up – above mouse layout = 9 ‘buttons’ (3 primary, 4 directional scroll, 2 side).

Now (with mouse plugged in), we need to get exact info on it, so open a terminal and run:

cat /proc/bus/input/devices

Output will look something like this:

I: Bus=0003 Vendor=046d Product=c049 Version=0111
N: Name="Logitech USB Gaming Mouse"
P: Phys=usb-0000:00:1d.0-1/input0
S: Sysfs=/class/input/input3
U: Uniq=
H: Handlers=mouse1 event3
B: EV=17
B: KEY=ffff0000 0 0 0 0
B: REL=143
B: MSC=10

The main information–case sensitive, and needs to be exact–is the first highlighted bit. Also note the H: ‘Handlers=mouse1 event3’ line. We also need that info.

Now we need to find out how it’s handled by /dev/input. I did this manually by going to directory /dev/input/by-id. I found 3 links – the one linked to event 3 corresponds with the mouse entry I need – so now I know the path and exact link file on my machine is:

/dev/input/by-id/usb-Logitech_USB_Gaming_Mouse-event-mouse

Edit the file

 It’s easiest to use an example, so here is what the new section looks like for the Logitech USB Gaming Mouse whose information is posted above:

Section "InputDevice"
Identifier "G5"
Driver "evdev"
Option "CorePointer"
Option "Device" "/dev/input/by-id/usb-Logitech_USB_Gaming_Mouse-event-mouse"
Option "Name" "Logitech USB Gaming Mouse"
Option "ZAxisMapping" "4 5 7 6"    << order changed for this particular mouse
Option "Buttons" "9"
Option "ButtonMapping" "1 2 3 8 9"
Option "Emulate3Buttons" "false"
EndSection

Line-by-line explanations

  • The identifier can be whatever you want to call it – easiest is to use your model number.
  • The driver is evdev – as that’s what we need to get functionality
  • The device line is what we got from /dev/input earlier.
  • The name must exactly match what you got from cat /proc/bus/input/devices earlier.
  • The ZaxisMapping is mapping to your scroll wheel (4/5 = N/S, 7/6 = E/W).
  • Buttons 9 as explained earlier. If you have only one thumb button it would be 8.
  • ButtonMapping is the buttons without the scroll wheel in order they appear – primary, secondary. middle, big thumb, little thumb.

Once you’ve done this, it’s time to make it the primary pointer. At the top of your xorg.conf, you’ll find Section “ServerLayout”. Look for the line:

InputDevice “USB Mouse” “CorePointer”

Add a # to the front to comment it out, and add a new line below it corresponding to the name you used as the identifier for your mouse. In the example we have been following, you would see this when you were done:

# InputDevice "USB Mouse" "CorePointer"
InputDevice "G5" "CorePointer"

Save the file, exit back to your desktop.

Create a separate device file

An alternative (mentioned in the Xorg mouse support document below, but untested here) method would be to place your new mouse section as a “code snippet” in /etc/X11/xorg.conf.d/. Create as root a new document, named however you want as long as it matches what is at the top of the xorg.conf file, paste in your new mouse section, and save the file.

If this does not work, consult “Additional options” under Links below.

Last steps

Finally, close any open programs, and log out. When you return to the normal login, you know you’ve been successful. (If not, then reboot and use the LiveMedium to restore the backup xorg.conf so you can log in.) For further checking–open a terminal once you have logged in, and run xev (the x event tester). Place mousepointer in the square test box, and test each of your buttons and also the directional scroll. Each should show data in the terminal.

Links


v. 20150917

1 thought on “Add mouse functionality”

  1. The functionality of the mouse is so much important for the personal computer. if you properly know how to use the mouse efficiently then I assured you-you are the new kingpin. Overall the content is so helpful and doesn’t need to go for others for mouse functionality.

Leave a Comment

Do NOT follow this link or you will be banned from the site!