# Mouse gets assigned to js0 as well as mouse0

## Jhedron

The hardware I'm having trouble with is the Microsoft Wireless Optical Mouse 2.0 included with the Microsoft Wireless Desktop - Comfort Edition I own. The single receiver is plugged into one of my USB ports. My kernel version is 2.6.12-gentoo-r6, though I've had this problem since I first installed Gentoo a few months ago (kernel version 2.6.10).

I first noticed this problem when I attempted to play Tux Racer. The game started up fine, but wouldn't respond to input from my gamepad (Thrustmaster Dual Analog 2). Left to himself, Tux also showed an affinity for turning left. Apparently, Tux Racer uses whatever game device is assigned to js0, which didn't bother me as my gamepad is the only game device I have plugged in. I was surprised to discover that my gamepad was assigned to js1, and that 'od /dev/input/js0' only produced output in response to events from the three buttons on my mouse. That's right, just the buttons, nothing else.

Anyone know why my mouse buttons are assigned to js0? I've done quite a bit of searching and haven't found anyone else with this same issue. I'd try a different keyboard/mouse combo, but I don't have any extras. I'm not even sure where to start looking.

I don't know if this will help, but here's the output from 'cat /proc/bus/input/devices':

```
I: Bus=0010 Vendor=001f Product=0001 Version=0100

N: Name="PC Speaker"

P: Phys=isa0061/input0

H: Handlers=kbd event0 

B: EV=40001 

B: SND=6 

I: Bus=0003 Vendor=045e Product=009d Version=1111

N: Name="Microsoft Microsoft Wireless Optical Desktop® 2.10"

P: Phys=usb-0000:00:10.0-2/input0

H: Handlers=kbd event1 

B: EV=120003 

B: KEY=10000 7 ff800000 7ff febeffdf f3cfffff ffffffff fffffffe 

B: LED=7 

I: Bus=0003 Vendor=045e Product=009d Version=1111

N: Name="Microsoft Microsoft Wireless Optical Desktop® 2.10"

P: Phys=usb-0000:00:10.0-2/input1

H: Handlers=kbd mouse0 event2 js0 

B: EV=10000f 

B: KEY=c000000 1f0001 10000 38007 ff8739fa d941d7ff febeffdf ffefffff ffffffff fffffffe 

B: REL=fc3 

B: ABS=ffffff01 701ff
```

----------

## LoDown

It's going to be your udev rules.  When you plug in your mouse, udev takes over, and creates the proper device files in /dev.  Right now, its doing too much. Go to the /etc/udev/rules.d directory.  Grep the files that are there for js0 to see what is going on.  Change as needed.  Here is a nice udev howto to get you on your way: http://www.reactivated.net/writing_udev_rules.html

----------

## Jhedron

 *LoDown wrote:*   

> It's going to be your udev rules.  When you plug in your mouse, udev takes over, and creates the proper device files in /dev.  Right now, its doing too much. Go to the /etc/udev/rules.d directory.  Grep the files that are there for js0 to see what is going on.  Change as needed.  Here is a nice udev howto to get you on your way: http://www.reactivated.net/writing_udev_rules.html

 

Thanks for your response. I did what you suggested and also read the howto you posted. After playing around a bit, I think I might have a better idea of what's going on.

Grepping the only file in /etc/udev/rules.d/ for 'js' yields the following line from 50-udev.rules:

```
KERNEL="js*",      NAME="input/%k", MODE="664"
```

If I understood the howto correctly, this means that udev will place a node in /dev/input/ using the kernel name of any device whose kernel name begins with the letters 'js'. I added a rule in a new file (named 10-local.rules) to stop the mouse from being given js0. The rule I used was:

```
SYSFS{idProduct}="009d", SYSFS{idVendor}="045e", NAME="input/ms_mouse"
```

While there is no longer a js0 in the /dev/input directory, whenever I plug in the gamepad, it is associated with js1 and no js0 is ever created. It would seem that maybe something in the kernel is giving the mouse buttons their own device, js0, so that when the gamepad is plugged in it is given the next available kernel device name, js1. This would then match the catch all rule in 50-udev.rules and a node named js1 is created in /dev/input. This is a first for me, so I could be way off, but that is how it appears.

As a temporary fix, if I unplug the mouse/keyboard wireless receiver, then plug in the gamepad, then plug the receiver back in, the gamepad will be js0 and I can use Tux Racer and ZSNES properly. This is hardly convenient, but I'm not sure what my next step should be to fix this problem. Perhaps a different udev rule? Something in the way I compiled the kernel or its modules? Hot/cold-plug settings?

----------

