Re-installing lirc and getting the MCE Remote working again

6 10 2014

About a year ago, I had installed lirc to get the Microsoft Media Center receiver and remote working with my Linux box. I haven’t touched these things again and upgraded the system in the meantime, but now I wanted to use these things again. First thing that I had to do, of course, was to emerge lirc

I still had my old config files in ~/.lirc that I had been auto-generating with the mythbuntu-lirc-generator, hoping that I’d be able to instantly use them out of the box. This proved not to be the case. So I checked if the module was loaded correctly and the USB interface working with lsmod | grep lirc
lsmod | grep mce
which they were and tested if I am receiving anything from the remote with
irw

It turned out that the remote was working, but what it was sending didn’t correspond with the keys in my config files anymore. The lirc people decided to rename all of the keys and hence my applications were unable to recognize the remote.

To fix this, I checked online sources for what had changed, then decided to do a search-and-replace job to update my config files to use the new key aliases. The following two commands are what it boiled down to, which I could copy+paste inside of my .lirc directory:
wget http://lirc.sourceforge.net/remotes/mceusb/lircd.conf.mceusb
grep "Was:" lircd.conf.mceusb | awk -F"# Was: " '{print $2 $1}' | sed -E "s/ +/ /g" | awk '{print "sed -i \"s/button = "$1"/button = "$2"/Ig\" *"}' | sort -r | uniq -i

(you should check archive.org for a version of this file which is closest to my posting date – the last one that I can find from 2013 doesn’t show the changes yet)

This spewed out the following replacements:
sed -i "s/button = Zero/button = KEY_0/Ig" *
sed -i "s/button = Yellow/button = KEY_YELLOW/Ig" *
sed -i "s/button = VolUp/button = KEY_VOLUMEUP/Ig" *
sed -i "s/button = VolDown/button = KEY_VOLUMEDOWN/Ig" *
sed -i "s/button = Videos/button = KEY_VIDEO/Ig" *
sed -i "s/button = Up/button = KEY_UP/Ig" *
sed -i "s/button = Two/button = KEY_2/Ig" *
sed -i "s/button = TV/button = KEY_TV/Ig" *
sed -i "s/button = Three/button = KEY_3/Ig" *
sed -i "s/button = Teletext/button = KEY_TEXT/Ig" *
sed -i "s/button = Stop/button = KEY_STOP/Ig" *
sed -i "s/button = Start/button = KEY_PLAY/Ig" *
sed -i "s/button = Star/button = KEY_NUMERIC_STAR/Ig" *
sed -i "s/button = Skipfwd/button = KEY_FASTFORWARD/Ig" *
sed -i "s/button = Skip/button = KEY_NEXT/Ig" *
sed -i "s/button = Skipback/button = KEY_REWIND/Ig" *
sed -i "s/button = Six/button = KEY_6/Ig" *
sed -i "s/button = Seven/button = KEY_7/Ig" *
sed -i "s/button = Right/button = KEY_RIGHT/Ig" *
sed -i "s/button = Rewind/button = KEY_REWIND/Ig" *
sed -i "s/button = Replay/button = KEY_AGAIN/Ig" *
sed -i "s/button = Red/button = KEY_RED/Ig" *
sed -i "s/button = RecTV/button = KEY_RECORD/Ig" *
sed -i "s/button = Record/button = KEY_RECORD/Ig" *
sed -i "s/button = Rec/button = KEY_RECORD/Ig" *
sed -i "s/button = Radio/button = KEY_RADIO/Ig" *
sed -i "s/button = Power/button = KEY_POWER/Ig" *
sed -i "s/button = PlayPause/button = KEY_PLAYPAUSE/Ig" *
sed -i "s/button = Play/button = KEY_PLAY/Ig" *
sed -i "s/button = Pictures/button = KEY_IMAGES/Ig" *
sed -i "s/button = Pause/button = KEY_PAUSE/Ig" *
sed -i "s/button = One/button = KEY_1/Ig" *
sed -i "s/button = OK/button = KEY_OK/Ig" *
sed -i "s/button = Nine/button = KEY_9/Ig" *
sed -i "s/button = Mute/button = KEY_MUTE/Ig" *
sed -i "s/button = Music/button = KEY_AUDIO/Ig" *
sed -i "s/button = LiveTV/button = KEY_TV/Ig" *
sed -i "s/button = Left/button = KEY_LEFT/Ig" *
sed -i "s/button = Home/button = KEY_HOME/Ig" *
sed -i "s/button = Hash/button = KEY_NUMERIC_POUND/Ig" *
sed -i "s/button = Guide/button = KEY_INFO/Ig" *
sed -i "s/button = Green/button = KEY_GREEN/Ig" *
sed -i "s/button = Fwd/button = KEY_FORWARD/Ig" *
sed -i "s/button = Four/button = KEY_4/Ig" *
sed -i "s/button = Forward/button = KEY_FORWARD/Ig" *
sed -i "s/button = Five/button = KEY_5/Ig" *
sed -i "s/button = Enter/button = KEY_ENTER/Ig" *
sed -i "s/button = Eject/button = KEY_EJECTCD/Ig" *
sed -i "s/button = Eight/button = KEY_8/Ig" *
sed -i "s/button = Dvdmenu/button = KEY_MENU/Ig" *
sed -i "s/button = DVD/button = KEY_DVD/Ig" *
sed -i "s/button = Down/button = KEY_DOWN/Ig" *
sed -i "s/button = Clear/button = KEY_CLEAR/Ig" *
sed -i "s/button = Chup/button = KEY_CHANNELUP/Ig" *
sed -i "s/button = Chdown/button = KEY_CHANNELDOWN/Ig" *
sed -i "s/button = ChanUp/button = KEY_CHANNELUP/Ig" *
sed -i "s/button = ChanDown/button = KEY_CHANNELDOWN/Ig" *
sed -i "s/button = \*/button = KEY_NUMERIC_STAR/Ig" *
sed -i "s/button = #/button = KEY_NUMERIC_POUND/Ig" *
sed -i "s/button = Blue/button = KEY_BLUE/Ig" *
sed -i "s/button = Back/button = KEY_BACK/Ig" *
sed -i "s/button = 9/button = KEY_9/Ig" *
sed -i "s/button = 8/button = KEY_8/Ig" *
sed -i "s/button = 7/button = KEY_7/Ig" *
sed -i "s/button = 6/button = KEY_6/Ig" *
sed -i "s/button = 5/button = KEY_5/Ig" *
sed -i "s/button = 4/button = KEY_4/Ig" *
sed -i "s/button = 3/button = KEY_3/Ig" *
sed -i "s/button = 2/button = KEY_2/Ig" *
sed -i "s/button = 1/button = KEY_1/Ig" *
sed -i "s/button = 0/button = KEY_0/Ig" *

After that was done, I checked if everything was done correctly for the programs that concerned me most, vlc and totem:
grep -o "button =.*" vlc totem | awk -F":" '{ print $2 }' | sort | uniq
and manually edited/deleted the entries which looked odd. After restarting lirc, everything worked again!

Advertisements

Actions

Information

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




%d bloggers like this: