HOWTO: Enabling multiple mouse pointers (MPX) and multiple keyboards to work simultaneously in Linux (Ubuntu/Fedora)


Soon I will be switching camps from Ubuntu to Fedora. I can’t say this will be permanent but it will be for around 5-6 months to give myself time to get over the few minor gripes I have with Fedora (mostly revolving around its package management) and try to embrace the things that are drawing me towards it. I’m going to be setting up a Fedora as my Dom0 with Xen Hypervisor and running other operating systems at the same time (no names being mentioned here).

But when I was downloading the Fedora ISO this morning I remembered a little project that I had religiously followed for a while and even compiled a highly unstable x server to try it out and that was Peter Hutterer’s MPX. This project was designed to allow multiple mouse pointers natively in the x server. I had forgotten about trying this out when I upgraded my system to Ubuntu 10.04 but this morning I went digging around for the info on how to do it and this is what I came up with after piecing things together.

To find out what crap you’ve got plugged into your computer that can be used type:

$ xinput list

and that should return something like:

Virtual core pointer                        id=2    [master pointer  (3)]
Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
Logitech USB Receiver                       id=9    [slave  pointer  (2)]
Logitech USB Receiver                       id=10   [slave  pointer  (2)]
Logitech USB Receiver                       id=13   [slave  pointer  (2)]
SynPS/2 Synaptics TouchPad                  id=15   [slave  pointer  (2)]
Virtual core keyboard                       id=3    [master keyboard (2)]
Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
Video Bus                                   id=6    [slave  keyboard (3)]
Power Button                                id=7    [slave  keyboard (3)]
Sleep Button                                id=8    [slave  keyboard (3)]
zc3xx                                       id=11   [slave  keyboard (3)]
Logitech USB Receiver                       id=12   [slave  keyboard (3)]
AT Translated Set 2 keyboard                id=14   [slave  keyboard (3)]

Ok, so for this howto I want to move my laptops built-in keyboard (id 14) and touchpad (id 15) to their own group. First I have to create the new group like so:

$ xinput create-master laptop
$ xinput list

The second list you bring back will have the new groups there:

...
laptop pointer                          id=16    [master pointer  (17)]
laptop XTEST pointer                    id=18    [slave  pointer  (16)]
laptop keyboard                         id=17    [master keyboard (16)]
laptop XTEST keyboard                   id=19    [slave  keyboard (17)]

Then it is a simple matter of reattaching the mouse (id 15) and keyboard (id 14) to the new groups (ids 16 and 17 respectively):

$ xinput reattach 15 16
$ xinput reattach 14 17

Then simply start using them. There are still things that need to be enabled on a program level for this to be a truly user friendly experience and I myself do not have a practical use for multiple input devices like this yet. I can see how if you could constrain the range of motion of the devices to a single monitor and hook up multiple monitors, keyboards and mice you would have a cost effective classroom set up for students or even use this on a large touch surface for design, video editing and so on.

, , , , , ,

  1. #1 by Tom Chiverton on June 7, 2010 - 5:01 am

    Another good use was brought up at the Scotch on the Rocks conference in London the other week; testing multi-touch applications (for smart phones or desktop).
    Apparently Windows and Mac can’t cope with more than one mouse. Oh well :-)

(will not be published)