Joystick input driver and multimedia key events

Zarko Zivanov zzarko at gmail.com
Thu May 21 10:33:35 PDT 2009


After putting (and restarting X)

	Option "MapButton1"        "key=0x1008ff13"
	Option "MapButton3"        "key=0x1008ff11"

this is what I get from xev for buttons 1 and 3:

KeyPress event, serial 49, synthetic NO, window 0x3c00001,
    root 0x8c, subw 0x0, time 48271360, (529,604), root:(627,752),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XmbLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

KeyRelease event, serial 51, synthetic NO, window 0x3c00001,
    root 0x8c, subw 0x0, time 48271552, (529,604), root:(627,752),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

KeyPress event, serial 51, synthetic NO, window 0x3c00001,
    root 0x8c, subw 0x0, time 48277632, (529,604), root:(627,752),
    state 0x10, keycode 11 (keysym 0x32, 2), same_screen YES,
    XLookupString gives 1 bytes: (32) "2"
    XmbLookupString gives 1 bytes: (32) "2"
    XFilterEvent returns: False

KeyRelease event, serial 51, synthetic NO, window 0x3c00001,
    root 0x8c, subw 0x0, time 48277792, (529,604), root:(627,752),
    state 0x10, keycode 11 (keysym 0x32, 2), same_screen YES,
    XLookupString gives 1 bytes: (32) "2"
    XFilterEvent returns: False

Maybe is something Ubuntu-specific? Everything else is working except
those MM keycodes...

Žarko

On Thu, May 21, 2009 at 2:37 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> 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