Monday, February 2, 2009

Mplayer Mouse Volume Issue

Before reinstalling my Gentoo, I had this strange issue with my mouse when watching movies in MPlayer. Everytime I clicked my left mouse button, MPlayer would increase volume.

I could easily remap the functionality of mouse in MPlayer not to mess with volume, but whichever value I remapped the functionality to, it always unpaused movies and displayed the annoying volume status over the movie.

I was looking for solution for quite some time, but the problem magically disappeared after re-installation, so I quickly forgot about it. Until yesterday of course :)

Since I have new versions of pretty much everything, I concluded, it will be issue with my configuration and not a bug.

I'm using Microsoft SideWinder mouse

Microsoft SideWinder Mouse

so I decided to dig in the logs to find out, what is going on. dmesg and /var/log weren't very helpful, so I decided to look what's going on in MPlayer.

I started MPlayer in strace

$ strace mplayer movie.ogg 2>&1 | grep input
...
open("/dev/input/js0", O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 3
...

MPlayer was opening some joystick for reading. But I didn't have any joystick plugged in, since I borrowed my gamepad to a friend two days ago.

Heuréka!

Looking in /sys/devices folder, I found out, that Microsoft SideWinder mouse registers itself as mouse device as well as joystick device. Before I unplugged my gamepad, MPlayer was attaching itself to my gamepad at /dev/input/js0 and since I don't have it connected anymore, mouse gets assigned to js0.

With this knowledge, the fix was extremely easy:

echo "input:js-dev=no" >> ~/.mplayer/config

And voilá. Everything works as expected.

0 comments: