Joystick input driver and multimedia key events

Peter Hutterer peter.hutterer at who-t.net
Thu May 21 05:37:28 PDT 2009


On Thu, May 21, 2009 at 11:59:38AM +0200, Sascha Hlusiak wrote:
> Hi,
> 
> > Is it possible to use joystick driver to generate multimedia key
> > events? I wanted to make i.e. buttons 1 and 3 to be volume up and
> > volume down like this:
> >
> >         Option "MapButton1"        "key=0x1008,0xff13"
> >         Option "MapButton3"        "key=0x1008,0xff11"
> >
> > I got codes 0x1008ff13 and 0x1008ff11 from xev (I didn't found
> > appropriate constants in /usr/include/X11/keysymdef.h). I tried to put

/usr/share/X11/XKeysymDB is the best collection of all keysyms.
the codes you're looking for come from XF86Keysym.h)

> > 32-bit numbers, but I got error about this, so i tried the above, but
> > got nothing. If my approach is wrong, how could I get multimedia key
> > actions to work with joystick driver?
> configuring key=0x1008ff13 worked for me and produced the desired key. xev 
> shows the name as well so it's easy to check.
> 
> While it is possible to generate those key events, there is a fundamental 
> problem with grabs on those keys. Basically, applications grab on scancodes of 
> a certain input device. Pressing a button on the joystick changes the primary 
> device and the key has to be regrabbed. But of course the first keystroke is 
> lost. For me the above configuration did raise the volume, but on the 2nd 
> button press only.
> This problem exists with other input devices and grabs as well and is not a 
> joystick driver specific problem. 

FWIW, XI2 has keysym grabs instead of keycode grabs, so that problem should
be gone.

Cheers,
  Peter



More information about the xorg mailing list