Multiple Mice with Linux

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.
Multiple Mice with LinuxMalla04/09/2009 - 18:00

Hi everyone,

World of Goo is a great game and it's running perfectly on Linux for me, even the unsupported multiplayer mode.

The only thing that bothers me is that I always have to make all mice readable after plugging them in (by using "chmod a+r /dev/input/eventN").

Is there any way I can tell Linux to do this automatically?

I'm using Ubuntu 8.04. Maybe someone can help me out.

best regards
Malla

Re: Multiple Mice with LinuxTheHermit04/09/2009 - 18:09

Create a script that does that instruction then starts WoG.
Run script to start game in future.

Re: Multiple Mice with LinuxSoultaker04/09/2009 - 19:03

I think Ubuntu uses udev, so alternatively, you should be able to write a rule that causes udev to set the right permissions for new input devices when the device nodes are created. I'm not an expert on udev so I don't know how exactly, unfortunately. (If you manage to figure it out, please do post back here; this could be useful information for others with a similar question.)

Re: Multiple Mice with LinuxMalla04/10/2009 - 06:29

[quote author=TheHermit link=topic=1752.msg11547#msg11547 date=1239318583]
Create a script that does that instruction then starts WoG.
Run script to start game in future.


I had this idea, too. But you need to be root to change the permission of the devices. So it means you have to enter root password every time you start WoG and that's not what I want.

I will try the udev rules.

Thanks so far!

regards
Malla

Re: Multiple Mice with LinuxMalla04/19/2009 - 15:01

I've finally managed to get the udev rules working so that I can play the multiplayer mode of WoG without changing any permissions again.

You may compromise user privacy on multi-user systems, if the mouse device is readable by everyone. So change it on your own risk!

What I did:

Some detailed information about the mouse device is needed:
udevinfo -a -p $(udevinfo -q path -n /dev/input/mouse1)

(on Arch Linux I had to use "udevadm info" instead of "udevinfo")

It gives me a lot of information, here is the most important part of it:


  looking at parent device '/devices/pci0000:00/0000:00:02.0/usb2/2-6':                                                                                                                                        <br />    KERNELS=="2-6"                                                                                                                                                                                            <br />    SUBSYSTEMS=="usb"                                                                                                                                                                                          <br />    DRIVERS=="usb"                                                                                                                                                                                            <br />    ATTRS{configuration}==""                                                                                                                                                                                  <br />    ATTRS{bNumInterfaces}==" 1"                                                                                                                                                                                <br />    ATTRS{bConfigurationValue}=="1"                                                                                                                                                                            <br />    ATTRS{bmAttributes}=="a0"                                                                                                                                                                                  <br />    ATTRS{bMaxPower}=="100mA"                                                                                                                                                                                  <br />    ATTRS{urbnum}=="12"                                                                                                                                                                                        <br />    ATTRS{idVendor}=="046d"                                                                                                                                                                                    <br />    ATTRS{idProduct}=="c018"                                                                                                                                                                                  <br />    ATTRS{bcdDevice}=="4301"                                                                                                                                                                                  <br />    ATTRS{bDeviceClass}=="00"                                                                                                                                                                                  <br />    ATTRS{bDeviceSubClass}=="00"                                                                                                                                                                              <br />    ATTRS{bDeviceProtocol}=="00"                                                                                                                                                                              <br />    ATTRS{bNumConfigurations}=="1"                                                                                                                                                                            <br />    ATTRS{bMaxPacketSize0}=="8"                                                                                                                                                                                <br />    ATTRS{speed}=="1.5"                                                                                                                                                                                        <br />    ATTRS{busnum}=="2"                                                                                                                                                                                        <br />    ATTRS{devnum}=="27"                                                                                                                                                                                        <br />    ATTRS{version}==" 2.00"                                                                                                                                                                                    <br />    ATTRS{maxchild}=="0"                                                                                                                                                                                      <br />    ATTRS{quirks}=="0x0"                                                                                                                                                                                      <br />    ATTRS{authorized}=="1"                                                                                                                                                                                    <br />    ATTRS{manufacturer}=="Logitech"                                                                                                                                                                            <br />    ATTRS{product}=="USB Optical Mouse"
(I used the "KERNELS" and "ATTRS{product}" lines only)

Then I created /etc/udev/rules.d/91-local.rules which probably isn't very neat. There may be more elegant ways to do it.

Anyway, I put my rule in this file:

KERNELS=="2-6", ATTRS{product}=="USB Optical Mouse", MODE="0664"

The "KERNELS" and "ATTRS{product}" attributes are used to identify the device. The "MODE" attribute sets the Unix permissions to 664, which means the device is readable by everyone. I did this for all my mouse devices, unplugged them and plugged them in again.
Now I can play the multiplayer mode and I don't have any problems with permissions again.

Maybe this helps.

best regards
Malla