Enabling the Remote on a MacBook Pro Running Ubuntu 12.10

I’ve been using Ubuntu for the last few years. It was not my first choice, Debian was –because I like a balance between configuring things by hand (call it choice) and automation. The problem, Debian on my Yonah based MacBook Pro (that’s the last 32 bit Apple computer before the 64 bit platform was introduced), was more challenging than I expected. That is, Debian installed but would not boot, not without Super Grub live CD.

As far as Ubuntu, Natty ran well on this machine. It ran cool, as far as I noticed, and quiet (in contrast, 12.10 is more challenging for the poor thing). Getting on to my point and to my pleasant surprise, I got my remote working, which I hardly used when I had OS X installed.

And so, I wanted to write a HowTo detailing how to configure the infrared remote on these laptops, seeing as most LIRC articles I found –that’s the software that enables remotes on Gnu/Linux– are horrendous works which more akin to short-hand than respectable literature of any sort.

The problem is, I never wrote my own procedure down, and, recently, my configuration got overwritten after a recent upgrade. As a result, my remote ceased to function. This is a real drag when sitting at the dinner table. It’s like living in the pre-80s/90s, having to get up, walk on over to the computer, and manually turn the volume down/up, or start/stop another video.

Anyway, I thought there must be a faster way to get LIRC working, rather than messing with recreating the concerned files. Luckily, I had backed these files up, files pertaining to a pre-12.10 Ubuntu version. In truth, I had two set-ups. The earlier had stopped to work after an earlier upgrade, not due to the configuration files being over written, but, apparently, because LIRC had changed. Luckily, the last set of copies worked.

The set-up set consists of two files, /etc/lirc/hardware.conf, which identifies your hardware, and ~/.lircrc, which translates instructions to individual media players –as long as they have LIRC support, and my own file is probably more than sufficient for the most popular players (VLC, MPlayer, Totem, Audacious –and a few more, which I’ve never tested).

The following details how I got my remote working in a jiffy. Yes, I know there is or was at some point a LIRC app for Mac hardware (the name escapes me) which caters to the more spoiled user, but I didn’t want to spend time searching, installing, testing, trouble-shooting, and retrying, as I had dinner getting cold and wanted immediate satisfaction.

Procedure

This article is more a reminder to myself, but if anyone else can get something out of it, all the better. Obviously, you need to install LIRC before attempting to use the configuration files.

Create /etc/lirc/hardware.conf and put the following content in it. Delete any prior content, if the file existed prior. This is the file that is sometimes replaced by upgrades/updates. Suggestion: if an upgrade/update process asks to replace a LIRC file because if differs from the maintainer’s, don’t accept.

/etc/lirc/hardware.conf

Something such as the following should work on the MacBook Pro at hand. If I recall, this file is created via some terminal interface running a diagnostic-like interactive routine.

# Save as /etc/lirc/hardware.conf
# After modifying:
# sudo /etc/init.d/lirc restart

#Chosen Remote Control
REMOTE=”Apple Mac mini USB IR Receiver”
REMOTE_MODULES=”usbhid”
REMOTE_DRIVER=”macmini”
REMOTE_DEVICE=”/dev/usb/hiddev0″
REMOTE_SOCKET=””
REMOTE_LIRCD_CONF=””
REMOTE_LIRCD_ARGS=””
REMOTE_LIRCD_ARGS=””

#Chosen IR Transmitter
TRANSMITTER=”None”
TRANSMITTER_MODULES=””
TRANSMITTER_DRIVER=””
TRANSMITTER_DEVICE=””
TRANSMITTER_SOCKET=””
TRANSMITTER_LIRCD_CONF=””
TRANSMITTER_LIRCD_ARGS=””

#Enable lircd
START_LIRCD=true

#Don’t start lircmd even if there seems to be a good config file
#START_LIRCMD=”false”

#Try to load appropriate kernel modules
LOAD_MODULES=”true”

# Default configuration files for your hardware if any
LIRCMD_CONF=””

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn’t have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to “false”
FORCE_NONINTERACTIVE_RECONFIGURATION=”false”
START_LIRCMD=””

# Receiver settings required by gnome-lirc-properties
RECEIVER_MODEL=”Built-in\ IR\ Receiver\ \(0x8240\)”
RECEIVER_VENDOR=”Apple”

# Remote settings required by gnome-lirc-properties
REMOTE_MODEL=”A1156″
REMOTE_VENDOR=”Apple”
Save as /etc/lirc/hardware.conf

Assuming you place the above file in ~.

sudo cp ~/hardware.conf  /etc/lirc/hardware.conf

~/.lircrc

As mentioned, the other file (see below) is ~/.lircrc (save it to ~, obviously). It’s content follows. As for credit for this file, I’ve lost track; If I recall, it’s mostly a cut and paste job from various Internet sources, with some fine tunning on my part.

##################################################
#### Save as ~/.lircrc ###########################
#### After modifying: ############################
#### sudo /etc/init.d/lirc restart ###############
##################################################

#############
#### VLC ####
#############

begin
prog = vlc
button = KEY_PLAYPAUSE
config = key-play-pause
repeat = 0
end

begin
prog = vlc
button = KEY_MENU
config = key-stop
repeat = 0
end

begin
prog = vlc
button = KEY_REWIND
config = key-jump-short
repeat = 1
end

begin
prog = vlc
button = KEY_FORWARD
config = key-jump+short
repeat = 1
end

begin
prog = vlc
button = KEY_VOLUMEUP
config = key-vol-up
repeat = 1
end

begin
prog = vlc
button = KEY_VOLUMEDOWN
config = key-vol-down
repeat = 1
end

#################
#### MPlayer ####
#################

#begin mplayer
begin
prog = mplayer
button = KEY_PLAYPAUSE
config = pause
repeat = 15
end

begin
prog = mplayer
button = KEY_MENU
config = stop
repeat = 15
end

begin
prog = mplayer
button = KEY_REWIND
config = seek -10
repeat = 10
end

begin
prog = mplayer
button = KEY_FORWARD
config = seek +10
repeat = 10
end

begin
prog = mplayer
button = KEY_VOLUMEUP
config = volume 1
repeat = 1
end

begin
prog = mplayer
button = KEY_VOLUMEDOWN
config = volume -1
repeat = 1
end
#end mplayer

###############
#### Totem ####
###############

begin
prog = Totem
button = KEY_PLAYPAUSE
config = play_pause
end

begin
prog = Totem
button = KEY_MENU
config = fullscreen
end

begin
prog = Totem
button = KEY_FORWARD
config = seek_forward
end

begin
prog = Totem
button = KEY_REWIND
config = seek_backward
end

begin
prog = Totem
button = KEY_VOLUMEUP
config = volume_up
repeat = 1
end

begin
prog = Totem
button = KEY_VOLUMEDOWN
config = volume_down
repeat = 1
end

###################
#### Audacious ####
###################

begin
prog = audacious
button = KEY_PLAYPAUSE
config = PAUSE
repeat = 16
end

begin
prog = audacious
button = KEY_MENU
config = STOP
repeat = 0
end

begin
prog = audacious
button = KEY_FORWARD
config = NEXT
repeat = 16
end

begin
prog = audacious
button = KEY_REWIND
config = PREV
repeat = 16
end

################################################## ##############################
#### Turn up and down the volume (Working by default on Feisty) ####
################################################## ##############################

#begin
#prog = irexec
#button = KEY_VOLUMEUP
#config = amixer set PCM 9+ & #amixer set PCM 3%+ &
#repeat = 2
#end

#begin
#prog = irexec
#button = KEY_VOLUMEDOWN
#config = amixer set PCM 9- & #amixer set PCM 3%- &
#repeat = 2
#end

##############################################
#### Evince y OpenOffice (Presentations) ####
#### start with line command:
#### $ irxevent -d
#### and kill with:
#### $ killall irxevent
##############################################

begin
prog = irxevent
button = KEY_PLAYPAUSE
config = Key F11 CurrentWindow
config = Key F5 CurrentWindow
repeat = 0
end

begin
prog = irxevent
button = KEY_MENU
config = Key Escape CurrentWindow
repeat = 0
end

begin
prog = irxevent
button = KEY_REWIND
config = Key Prior CurrentWindow
repeat = 1
end

begin
prog = irxevent
button = KEY_FORWARD
config = Key Next CurrentWindow
repeat = 1
end

begin
prog = irxevent
button = KEY_VOLUMEUP
config = Key ctrl-plus CurrentWindow
repeat = 0
end

begin
prog = irxevent
button = KEY_VOLUMEDOWN
config = Key ctrl-minus CurrentWindow
repeat = 0
end

Lastly, run the following.

sudo /etc/init.d/lirc restart

Test your remote by hitting volume buttons. Make sure the other ones work too. With any luck, you’ll have full remote control!

Cheers!

Maurice Cepeda

All rights reserved on the article, defined as the text and any original material and medium –including photographs when specifically mentioned in at least one of the following corresponding elements: caption, alternate text, or title. Quoted texts, and other material not copyrighted by Maurice Cepeda, are used under the concept of fair use and are the properties of their respective owners –including photographs, audio recordings, videos, or any other products in any form or fashion– as are all brands mentioned. If copyrighted videos and/or audio recordings should make themselves into articles, note that they are not hosted herein; if you are the copyright holder of any such material (and have a problem with fair use), approach the appropriate hosting site. Any audio or visual material (or any combination thereof) incorporated under fair use, either hosted locally (if that should come to be) or otherwise, will most likely be of lesser quality, thus, “fair use”. By reading this article, the reader forgoes any accountability of the writer. The reading of this article implies acceptance of the above stipulations.

Advertisements

One thought on “Enabling the Remote on a MacBook Pro Running Ubuntu 12.10

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s