This thing eats apples

Matthew Flaschen matthew.flaschen at gatech.edu
Wed Mar 7 12:46:31 UTC 2007


Gabriel Dragffy wrote:
> Matthew Flaschen wrote:
>> Gabriel Dragffy wrote:
>>> I was wondering if anyone else had some input on Apple remote+Ubuntu, 
>>> can it work even better? Or is it still early days?
>> Go into the command prompt:
>>
>> Type:
>>
>> xev
>>
>> Then, push each button to see what comes up.  If you get "keycode xxx",
>> the keypress is detected and you can do something with it (though config
>> may be required).
>>
>> Matt Flaschen
>>
> 
> Thanks, that's interesting. I can't really understand the output of xev
> though. When I pressed some of the buttons on the remote that don't
> currently do anything I got something like:

>> KeyPress event, serial 26, synthetic NO, window 0x3800001,
>>     root 0x3f, subw 0x0, time 76001505, (72,205), root:(87,302),
>>     state 0x0, keycode 158 (keysym 0x0, NoSymbol), same_screen YES,
>>     XLookupString gives 0 bytes: 
>>     XmbLookupString gives 0 bytes: 
>>     XFilterEvent returns: False
>>
>> KeyRelease event, serial 26, synthetic NO, window 0x3800001,
>>     root 0x3f, subw 0x0, time 76001505, (72,205), root:(87,302),
>>     state 0x0, keycode 158 (keysym 0x0, NoSymbol), same_screen YES,
>>     XLookupString gives 0 b
> 
> 
> Does that mean that they can work or that they can't?

Yes. Those are both the same button (one is press down, the other
release. :) ).  See how it says "keycode 158 (keysym 0x0, NoSymbol)".
There's a valid keycode, but no keysym.  That means you need to assign a
keysym so it can be useful (many are already done by default; try your
working buttons and you should see some symbol show up).

You have to create what's called an xmodmap entry to assign a sensible
name to that key.  For example, I have a file ~/.xmodmap with:

keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 160 = XF86AudioMute
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 176 = XF86AudioRaiseVolume
keycode 174 = XF86AudioLowerVolume
keycode 237 = XF86VendorHome

That allows me to use the front media buttons on my Dell laptop (Kubuntu
Edgy has these built in but I'm using gnewsense-kde, which is based on
Kubuntu Dapper). The words on the right are keysyms.  I think you can
just invent your own, but it's better to look for sensible keysyms in
/etc/X11/xkb/symbols/inet .  That way programs are more likely to work
without more customization.  Once you have the ~/.xmodmap file setup,
you need to make sure it's loaded on startup with the command:

xmodmap ~/.xmodmap

I'm not really sure how that's best done with GNOME (I use KDE).

Matthew Flaschen




More information about the ubuntu-users mailing list