Skip to content

Logitech MX-518 with Gnome in Ubuntu 8.10

Not having my back/forward keys working in anything in Ubuntu was driving me nuts – in Windows I was absolutely dependent on being able to lazily click the side buttons (even though I use mouse gestures). The first thing I stumbled across seemed simple enough.

hyperq just replaced his InputDevice section with the code below, when I checked my own xorg though I didn’t even have an InputDevice area at all – so I just pasted the following into the end of my xorg.conf and restarted X (ctrl+alt+backspace).

Section "InputDevice"
       Identifier      "Configured Mouse"
       Driver          "evdev"
       Option          "CorePointer"
       Option          "Buttons"       "7"
       Option          "ZAxisMapping"  "4 5"
       Option          "ButtonMapping" "1 2 3 6 7"
       Option          "Name"  "Logitech USB-PS/2 Optical Mouse"
EndSection

Once X loaded up I was able to use the buttons in Firefox, but that was about it. Still didn’t work in Nautilus, which is really where the functionality should be.

After a bit of hunting around I found this excellent UbuntuForum post by detyabozhye.

First step was to make sure that xserver-xorg-input-evdev was installed:

  • locate evdev

Returned this for me:

screenshot-terminal1

xserver-xorg-input-evdev is already installed, no need to snag that particular package. Next was checking my installed USB devices to see exactly what Ubuntu thinks my Logitech MX-518 actually is.

  • cat /proc/bus/input/devices

The device list is quite extensive, and I just pulled out the Logitech related bit

I: Bus=0003 Vendor=046d Product=c01e Version=0110
N: Name="Logitech USB-PS/2 Optical Mouse"
P: Phys=usb-0000:00:0b.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:0b.0/usb1/1-4/1-4:1.0/input/input4
U: Uniq=
H: Handlers=mouse1 event1
B: EV=17
B: KEY=ff0000 0 0 0 0
B: REL=103
B: MSC=10

Perfect, this is the same thing I added into my xorg from earlier, so it definitely has the right mouse, and the Firefox back/forward buttons show this – but time to get it working with Nautilus. Unfortunately there isn’t a native way to do this, the buttons actually have to be bound to certain keys.

To do this there are two necessary packages, xvkbd and xbindkeys.

  • sudo apt-get install xvkbd xbindkeys

Then xbindkeys needs to be configured to map the keys to Nautilus shortcuts.

  • gedit ~/.xbindkeysrc

Paste in the following:

"/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[Left]""
  m:0x0 + b:6
"/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[Right]""
  m:0x0 + b:7

Hit CTRL+S to save, then ALT+F4 to close.

Started up xbindkeys and tested it in Nautilus – and nothing happened. Made sure the key commands themselves worked by hitting ALT+LEFT and ALT+RIGHT – moved back and forward just like it should, but my side buttons didn’t do it. The only thing different from what detabozhye did and myself is I defined the buttons, so I removed that part and matched deta’s suggestion, then restarted X. Firefox still worked, Nautilus didn’t.

This time I loaded xev to try and see what button was /actually/ being pressed since it obviously wasn’t 6 or 7 at this point.

  • xev

(That was easy, eh?) Unfortunately xev is a pain in the arse to actually use. What I had to do was click, and hold the button to stop xev output from spamming my terminal and make very sure to not move the mouse (or more mouse movement spam would scroll by).

When I held down my large side button and scanned the output I saw this:

ButtonPress event, serial 34, synthetic NO, window 0x4000001,
root 0x13b, subw 0x4000002, time 13076697, (36,18), root:(1014,814),
state 0x10, button 8, same_screen YES

Finally, it’s not 6, it’s 8. Great. The little upper one was 9. Changed my .xbindkeysrc to update with the new buttons and then restarted xbindkeys

  • killall xbindkeys
  • xbindkeys

Finally works.

Of course, after doing all of this I had a flash of insight… I could’ve simply had xev output to a file instead of trying to watch the terminal window and then searched for it later, which I did as a test with a left click, then a right click, then a middle click.

  • xev > xevoutput.txt
  • left click, right click, then middle click (in the xev window)
  • cat xevoutput.txt | grep button

Returns:

state 0x10, button 1, same_screen YES
state 0x110, button 1, same_screen YES
state 0x10, button 3, same_screen YES
state 0x410, button 3, same_screen YES
state 0x10, button 2, same_screen YES
state 0x210, button 2, same_screen YES

There ya go… left click = 1, right click = 3, middle mouse click = 2. If I did that earlier (and made life easier on myself) it would’ve returned 8 and 9 respectively.

Now this needs to be added to your startup list so it isn’t necessary to start it each time manually. The easy way to do this in Gnome is by clicking System -> Preferences -> Session. Click “Add”, then type xbindkeys for the name, and xbindkeys for the command, and a description if you’d like.

I don’t like doing things through the GUI if I don’t have to, so I hunted around for a way to configure it manually (mainly because I spent half my time SSH’d into the box from work and would rather have the way to work with or without a mouse). After all of the above though I decided I’m done screwing around with this nonsense for the day and will make that into another post later tonight.

Like? Distro it!
  • Print this article!
  • Twitter
  • E-mail this story to a friend!
  • Reddit
  • del.icio.us
  • Facebook
  • Digg
  • Google Bookmarks
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Slashdot

2 Comments

  1. Steven

    Thanks a lot, worked great for me

    Posted on 12-Apr-09 at 5:05 pm | Permalink
  2. Thanks so much! This worked great in 9.04 as well!

    Posted on 02-Jun-09 at 1:20 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*