xbmc has a few remote apis. The nicest is the JSON one, it's so easy to work with I wrote a simple remote for my n900.