Multi mouse in Ubuntu 8.10

You are viewing a static copy of the old 2DBoy forum, which closed in 2010. It is preserved here for historical interest, but it is not possible to reply to topics. For more recent discussion about World of Goo, visit our new forum.
Multi mouse in Ubuntu 8.10bdean4202/28/2009 - 18:41

I was wondering if anyone has been able to get multi mouse mode to work in Ubuntu 8.10. If I have one mouse plugged in or if I have both plugged in without making the various /dev/input/event? readable it works just fine. Looking at the log it's using the SDL mouse stuff there because it can't find any evdev mice. When I make the evdev stuff readable, the log shows that the game found two mice, but no cursor appears. I think the reason has to do with Ubuntu 8.10 maybe not using the evdev stuff and those various /dev/input/event? not getting any mouse events posted to them.

A look at the xorg.conf file shows that something odd is definitely going on as there are no InputDevice sections for the mice or the keyboard. Well... actually they are there but are commented out as such:

# commented out by update-manager, HAL is now used<br />#Section "InputDevice"<br />#    Identifier    "Configured Mouse"<br />#    Driver        "mouse"<br />#    Option        "CorePointer"<br />#    Option        "Device" "/dev/input/mice"<br />#    Option        "Protocol" "ExplorerPS/2"<br />#    Option        "ZAxisMapping" "4 5"<br />#    Option        "Emulate3Buttons" "false"<br />#EndSection<br />

With Ubuntu being as popular as it is, surely someone else has run into this. Supposedly Xorg is trying to deprecate the xorg.conf stuff in favor of automagically setting things up. I don't really even know where to look with this. Sorry if this is a bit too technical a question for an "unsupported" feature and maybe this should be on the Ubuntu forums but I was hoping that someone has figured this out already. Thanks!!

Re: Multi mouse in Ubuntu 8.10Soultaker03/01/2009 - 14:11

I think you're right, and the HAL stuff makes the evdev inaccessible for some reason. I've pasted the relevant parts of my (non-HAL) xorg.conf below. Note that the AutoAddDevices line prevents the HAL from being used, but this does require you to declare the core keyboard and pointer manually or you won't have any input in X.
<br />Section "ServerLayout"<br />        .. other stuff ..<br />        InputDevice    "Keyboard0"      "CoreKeyboard"<br />        InputDevice    "Mouse0"          "CorePointer"<br />        Option        "AutoAddDevices"  "false"<br />EndSection<br /><br />Section "InputDevice"<br />        Identifier  "Keyboard0"<br />        Driver      "kbd"<br />        Option      "XkbLayout" "us"<br />EndSection<br /><br />Section "InputDevice"<br />        Identifier  "Mouse0"<br />        Driver      "mouse"<br />        Option      "CorePointer"<br />        Option      "Protocol" "auto"<br />        Option      "Device" "/dev/input/mice"<br />        Option      "ZAxisMapping" "4 5"<br />EndSection<br />

Please note that this is all pretty low-level hacking, so don't mess with your X config file unless you know what you are doing (and know how you can fix it if you can't start X anymore, or you don't have any input devices)!


Last modified Mon, 03/02/2009 - 15:39 by Soultaker
Re: Multi mouse in Ubuntu 8.10dentaku03/02/2009 - 18:56

When I enable the feature in the WoG configs, no mouse is used at all! I have to kill X, disable the feature and restart again to get back my mouse pointer in WoG.  :'(  I wonder why we need a special kernel for this as my two mice work flawlessly on the desktop ...

Re: Multi mouse in Ubuntu 8.10Soultaker03/03/2009 - 04:25

You don't need to have a "special kernel" to use the feature, but X needs some configuration. The problem is that the X server only supports a single pointer (i.e. mouse cursor) at a time, so any game that uses the X pointer for mouse input (as the game does by default) only has access to a single pointer. That's why for multi-mouse mode, the game tries to go behind the X server's back and open the mouse devices directly and individually (this is what the ManyMouse library does).

So why doesn't it work? The catch is that on Ubuntu (and maybe some other distributions) the X server no longer use the old and stable mouse and keyboard driver, but a new "evdev" based driver that works nicely together with the hardware abstraction layer (HAL) to add new mice as they are plugged in. This driver opens mouse devices directly too, and although that isn't a problem in general, it also takes exclusive control over all the input events (using an EVIOCGRAB ioctl if you're interested) so that none of these events get delivered to the game anymore (even though the devices can still be openeded).

If there was an easy way to tell evdev X driver not to grab exclusive control, then we wouldn't have this problem. Although there is a NoGrab option, you can't specify it by default (as far as I know) so that's of no use in the default configuration. That's why you will need to manually configure mouses to get it to work correctly.

Quote:
my two mice work flawlessly on the desktop ...

I seriously doubt this. Do you get two separate pointers? Or do you get a single pointer that is controlled with the same mouse? In the latter case, that works in the game too, but then you have just a single cursor. The whole point of the multi-mouse mode is to allow for multiple independently controlled cursors.

Quote:
I have to kill X, disable the feature and restart again to get back my mouse pointer in WoG.

Can't you just quit the game with Alt-F4?

Re: Multi mouse in Ubuntu 8.10dentaku03/03/2009 - 15:56

[quote author=Soultaker link=topic=1560.msg10432#msg10432 date=1236072316]

Quote:
my two mice work flawlessly on the desktop ...

I seriously doubt this. Do you get two separate pointers? Or do you get a single pointer that is controlled with the same mouse? In the latter case, that works in the game too, but then you have just a single cursor. The whole point of the multi-mouse mode is to allow for multiple independently controlled cursors.

EHm, yes I mean that I can control the one single mouse pointer with both mice.

[quote author=Soultaker link=topic=1560.msg10432#msg10432 date=1236072316]
Quote:
I have to kill X, disable the feature and restart again to get back my mouse pointer in WoG.

Can't you just quit the game with Alt-F4?

Alt-F4? Never heard of this shortcut other than Windows ...

Well, this sounds all very strange. I thought that mouse events are just catchable by any application? But I guess, most APIs just support mouse events ... and not mouse event from mouse 1, 2, ...

Re: Multi mouse in Ubuntu 8.10Yonibear03/12/2009 - 13:01

X11 supports accessing different input devices independently over the XInput API. You should take a look at SDL 1.3 from the current SVN trunk, it has multimouse support based on XInput.