This thing eats apples

Matthew Flaschen matthew.flaschen at gatech.edu
Wed Mar 7 18:46:34 UTC 2007


Gabriel Dragffy wrote:
> Matthew Flaschen wrote:
>> 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
>>
> 
> That sounds like good news then!
> Would you know if it's possible to get these buttons to control the 
> behavious of something like Totem?

I think so. :)  For each button that doesn't work now:

1. Try it in xev .
2. Mark down the keycode number, whether you see NoSymbol, and if not,
what's there instead, and what the button's supposed to do (i.e. skip
track, pause, etc.).
3. Reply back with that.

I'll help you make an xmodmap.  Then, we need to figure out how to load
the xmodmap and configure Totem.  It shouldn't be that hard.

Matt Flaschen




More information about the ubuntu-users mailing list