Kind of an unusual Ubuntu 12.04 system. It was built up from a minimal install and doesn't have most of the usual Ubuntu graphical elements: no Unity, no Gnome shell, no LXDE, and so forth (I use the i3 window manager). So directives like "go to System > Utilities > . . ." won't apply to a system like this.

Furthermore, I've been using an old serial mouse on this system--a Kensington Expert mouse (trackball), which I really like from an ergonomic perspective. I've currently got it hooked to the system via a serial-to-ps2 adapter and it's been working acceptably for the most part--including the crucial copy/paste-via-middle-mouse-button functionality--though some odd quirks have cropped up lately. As a way of possibly addressing those quirks, I've decided to try getting the serial-to-ps2 adapter out of the picture and hooking it straight to the serial port.

So I found directives for getting a serial mouse functioning under Ubuntu (https://help.ubuntu.com/community/SerialMouseHowto) and, implementing those directives and hooking the mouse to the serial port does result in a mostly working mouse. The problem is that one of the functions I use most and absolutely must have is not working under this scheme: I can, holding down the left mouse button and dragging, copy text from graphical or terminal programs, but I cannot paste it by clicking the middle mouse button at the desired location. In short, there seems to be no middle mouse button functionality present under this schema. So I'm looking into ways of possibly restoring that middle button functionality.

I should mention that, of the possible inputattach options, none are a very close match for my mouse. I tried several and some result in a working mouse, while others do not. I tried initially --microsoft, but have also tried --mshack and --mouseman. With none of those do I get any sort of middle mouse button functionality.

xev show, by the way, when the mouse is hooked to the system via the serial-to-ps2 adapter, that I have (starting from lower left and moving clockwise around the mouse) buttons 1, 2, 9, and 3 on this mouse. I suppose button 9 would be a good one to assign as a middle button. Or perhaps a combination of 2 and 9. But when I remove the adapter and hook the mouse straight to the serial port, xev indicates only 2 buttons are present: both upper and lower left buttons report as button 1, while both upper and lower right buttons report as button 3.

So, do I need perhaps to do some mouse button mapping? There are 4 physical buttons on this device. Perhaps I will need to put some supplementary xorg stanza in some /usr/share/X11/xorg.conf.d/ .conf file? Suggestions will be appreciated.

  • Additional sleuthing indicates, when the mouse is hooked to the serial port using any of the inputattach modes that actually work--even though those modes might specify a 3-button mouse--that xev output indicates only 2 of the 3 buttons are registering: only buttons 1 or 3 are indicated when any of the 4 are pressed. When hooked to the computer using the serial-to-ps2 adapter, all 4 buttons register independently. So the device can only apparently be seen as a 2-button mouse when hooked to the serial port and detected by inputattach. Seems like the Emulate3Buttons true option could help, no? – MJiller Jul 16 '16 at 17:01
  • Your system has been End-Of-Life for more than 2 years. Unfortunately, your question is consequently off-topic. I would consider upgrading to a new Ubuntu release as soon as possible. – cat Jul 16 '16 at 23:15
  • I'd like to see some substantiation for your assertion. 12.04 is an LTS release and, according to Wikipedia, it is supported til 2017-04-26. According to everything I've seen, 12.04 is supported for another 8-9 months. If I'm right, the grounds on which you claim this question is off-topic are erroneous. – MJiller Jul 17 '16 at 1:30
  • You are absolutely correct, I misread 12.04 as 12.10 -- I can't revoke my flag, but the moderator who reviews it will mark it as "supported by no evidence". – cat Jul 17 '16 at 1:36
  • This is really resolving into a question of why, when the mouse is functioning as a serial mouse via agency of inputattach, Option Emulate3Buttons true does not seem to work. Having that operational would, based on past experience, provide the needed functionality. I actually resorted to directly editing xorg.conf and introducing a stanza that included that line. But highlighting text by dragging with button 1 depressed, placing the cursor elsewhere, then pressing a combination of buttons 1 and 3, does not result in a paste operation, even after having introduced the stanza and restarted X. – MJiller Jul 17 '16 at 13:19

I found a workable answer over at the stackexchange thread https://unix.stackexchange.com/questions/9973/configuring-mouse-for-rightleft-button-simulating-middle-click-for-copy-paste. It involves using the command xinput set-prop, specifically

xinput set-prop "$device_name_or_number" "Evdev Middle Button Emulation" 1

Once I'd done that, the middle mouse button emulation functionality I needed (paste on pressing buttons 1 and 3 in combination) was restored.

Afterthought: this seems related to evdev, and I have a /usr/share/X11/xorg.conf.d/10-evdev.conf on this system. Maybe my Option Emulate3Buttons true stanza should have gone there rather than in /etc/X11/xorg.conf?

SUMMARY: to make this solution work on my system, I edited /etc/rc.local (as directives at the link cited in the OP instruct) and added the line

inputattach --daemon --microsoft /dev/ttyS0

to make the serial mouse mostly functional. Then, I added the line

xinput set-prop "$device_name_or_number" "Evdev Middle Button Emulation" 1

to my .xinitrc file (I don't use any login manager). After rebooting and firing up X, I had a fully working (at least to my needs) Kensington Expert Mouse. complete with middle-button-paste functionality. Issue solved, apart from understanding better how evdev and Xorg play together.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.