Getting Apple Remote, Macbook and LIRC work together

The Macbook ships an infrared remote control, the Apple Remote - the thingy you control Front Row with. Using my beloved Gentoo Linux on the Macbook I looked for a way to control my apps with it.

Up to kernel 2.6.21, you could use some patch to make the remote appear as an additional keyboard (of course with only a few keys) in your system. For stability reasons I need to stay with very current kernel versions, so the patch was no option, unfortunately.

It was said that one could use LIRC in conjunction with your remote, but apparently there was no real HowTo that told me what to do. Here are the steps I needed to follow:

  1. Activate CONFIG_USB_HIDDEV in your kernel config
  2. (Perhaps you'll also need CONFIG_INPUT_EVDEV)
  3. Make LIRC use /dev/usb/hiddev0 (or /dev/hiddev0) by editing /etc/conf.d/lircd
  4. Use irrecord (available when installing lirc) to create a config file matching your remote's signals
  5. Start lircd and use irw to check if it works

The Apple Remote behaves a bit strange when keeping buttons pressed: Instead of repeatedly sending the same key event, it sends a special repeat code. When calibrating your remote with irrecord, you are asked to keep a button pressed at the beginning of the procedure. This also makes LIRC think that the repeat signal is the same like a normal button - which leads to the annoying behavior that, when e.g. keeping the Up key pressed, only one Up signal is sent and a bunch of Menu signals follow. This can be fixed by manually adding a Repeat button and changing the toggle bit mask to match it.

Here is my /etc/lircd.conf:

Some more technical details: The remote is available as an USB device with name "IR Receiver", manufacturer "Apple Computer, Inc". Its device code is 05ACx8240 (Vendor and device id).

I'm looking for a new job. If you can recommend a company in Leipzig/Germany that's looking for a PHP developer, please drop me a mail.

Written by Christian Weiske.

Comments? Please send an e-mail.