Apple IR remote in Ubuntu Hardy24 Aug 2008
This weekend I decided to try and get my Apple remote to work on my Mac mini which I just upgraded to Hardy the other day.
Configuring the package lirc you are able to select the apple remote from a list but I couldn’t get it to work that way. So I found a way to create my own configuration file for the Apple remote:
sudo irrecord -H macmini -d /dev/usb/hiddev0 macmini.conf
-H tels irrecord which driver to use -d is the device irrecord listens for input on macmini.conf is the file where irrecord saves the configuration when done
First you need to hold a button. I had to wait almost 25 sec before it was satisfied and went on with the configuration. Now just follow the on screen instructions and in the end you should have you own configuration file. I recommend to compare the following file with the one you just created to check out the differences:
I made sure to call my buttons the same as in
After that I altered these two files to point to my newly created configuration file and removed pointers to
I then restarted lircd with:
sudo /etc/init.d/lirc restart
now you should be able to check that it is working with the command irw:
Just Ctrl+c when you are satisfied with the result.
To use the remote in Totem you first have to enable the IR plugin (Edit -> Plugins…). Then you have to configure what to buttons are supposed to do which is done in a configuration file in you home folder:
Content could look something like this (read more about syntax on LIRC’s website):
begin prog = Totem remote = Apple_A1156 button = vol+ config = volume_up end
Since the Apple remote have a combined Play/Pause button I wanted to find out if that was possible. I had a bit of trouble figuring out what was going in the
config = line and looked through all documentation I could find on LIRC’s website. Suddenly it hit me that the values in config a specific for the application. Not much about this on the Totem website so I downloaded the source code for Totem. Don’t worry this isn’t going to be hardcore. I unpacked the source code and searched for files with the name lirc:
$ cd totem-2.22.1 $ find . -name \*lirc\* ./data/lirc_example ./src/plugins/lirc ./src/plugins/lirc/totem-lirc.c ./src/plugins/lirc/lirc.totem-plugin.in
I opened the file
totem-lirc.c and found about 25 definitions for IR commands something like the following:
#define TOTEM_IR_COMMAND_PLAY "play" #define TOTEM_IR_COMMAND_PAUSE "pause" #define TOTEM_IR_COMMAND_NEXT "next" #define TOTEM_IR_COMMAND_PREVIOUS "previous" #define TOTEM_IR_COMMAND_SEEK_FORWARD "seek_forward" #define TOTEM_IR_COMMAND_SEEK_BACKWARD "seek_backward" #define TOTEM_IR_COMMAND_VOLUME_UP "volume_up" #define TOTEM_IR_COMMAND_VOLUME_DOWN "volume_down" #define TOTEM_IR_COMMAND_FULLSCREEN "fullscreen" #define TOTEM_IR_COMMAND_QUIT "quit" #define TOTEM_IR_COMMAND_UP "up" #define TOTEM_IR_COMMAND_DOWN "down" #define TOTEM_IR_COMMAND_LEFT "left" #define TOTEM_IR_COMMAND_RIGHT "right" #define TOTEM_IR_COMMAND_SELECT "select" #define TOTEM_IR_COMMAND_MENU "menu" #define TOTEM_IR_COMMAND_PLAYPAUSE "play_pause" #define TOTEM_IR_COMMAND_ZOOM_UP "zoom_up" #define TOTEM_IR_COMMAND_ZOOM_DOWN "zoom_down" #define TOTEM_IR_COMMAND_SHOW_PLAYING "show_playing" #define TOTEM_IR_COMMAND_SHOW_VOLUME "show_volume" #define TOTEM_IR_COMMAND_EJECT "eject" #define TOTEM_IR_COMMAND_PLAY_DVD "play_dvd" #define TOTEM_IR_COMMAND_MUTE "mute" #define TOTEM_IR_COMMAND_TOGGLE_ASPECT "toggle_aspect"
Other multimedia software might be better docuemented when it comes to IR but I guess you would be able to use something similar to figure out what possible config-options you have in the lircrc for the software.
Anyways Totem have a Play/Pause toggle and I ended up with:
begin prog = Totem remote = Apple_A1156 button = play config = play_pause end
Apple IR remote in Ubuntu Hardy by Jacob Emcken is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.