MPX

Starting with Ubuntu 10.04 LTS, Ubuntu includes support for Multi-Pointer X. This allows the user to use multiple input devices simultaneously.

Setting up two pointers

First, run

xinput list

You will see something like this:

  $ xinput list
  ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
  ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
  ⎜   ↳ Mouse0                                    id=6    [slave  pointer  (2)]
  ⎜   ↳ Mouse1                                    id=7    [slave  pointer  (2)]
  ⎜   ↳ Mouse1                                    id=9    [slave  pointer  (2)]
  ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
      ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
      ↳ Keyboard0                                 id=8    [slave  keyboard (3)]
      ↳ Keyboard1                                 id=10   [slave  keyboard (3)]

Both of the mice and keyboards are connected to the Virtual core pointer and Virtual core keyboard. Let's create a new master (pointer and keyboard set), and put the "Mouse0" and "Keyboard0" there.

  $ xinput create-master Second

This should make another pointer appear on the screen. However, nothing is attached to it yet. Run xinput list and look at the output:

  $ xinput list
  ⎡ Virtual core pointer                          id=2    [master pointer  (3)]
  ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
  ⎜   ↳ Mouse0                                    id=6    [slave  pointer  (2)]
  ⎜   ↳ Mouse1                                    id=7    [slave  pointer  (2)]
  ⎜   ↳ Mouse1                                    id=9    [slave  pointer  (2)]
  ⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
      ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
      ↳ Keyboard0                                 id=8    [slave  keyboard (3)]
      ↳ Keyboard1                                 id=10   [slave  keyboard (3)]
  ⎡ Second pointer                                id=11   [master pointer  (12)]
  ⎜   ↳ New XTEST pointer                         id=13   [slave  pointer  (11)]
  ⎣ Second keyboard                               id=12   [master keyboard (11)]
      ↳ New XTEST keyboard                        id=14   [slave  keyboard (11)]

Now, you need to move the Mouse0 and Keyboard0 to the new master. As you see above, Mouse0's id is 6. You want it to be moved from Virtual core pointer to Second pointer, whose id is 11, and you want to move the Keyboard0 who's id is 8 to the Second Keyboard which is 12:

  $ sleep 1&&xinput reattach 6 11&&xinput reattach 8 12

Congratulations, now each of your mice have their own pointer and a keyboard paired with them. The sleep command is to let you quit pressing enter before the reattach commands run. Otherwise, the keyboard will be disconnected before you let up enter, so 'un-enter' will NOT get sent to the previously connected pointer, which will leave that pointer spewing enters.

Reverting back

As of the time of this writing, practically nothing works with MPX flawlessly, and you will probably encounter some annoying glitches especially if compositing is enabled. Once you're done playing with it, you probably want to revert back to "normal" without restarting X. Doing that is easy - you just have to reattach the device back to the Virtual core pointer and remove the master you created:

  $ sleep 1&&xinput reattach 6 2&&xinput reattach 8 3
  $ xinput remove-master 11

Thanks

To whoever wrote http://alec.mooo.com/mpx.php -- this tutorial is heavily based off of it.

X/MPX (last edited 2010-05-06 06:47:09 by erik-b-andersen)