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

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:
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 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!


Kubuntu (KDE) together with Ubuntu 9.10

4 12 2009

I really do like the new Ubuntu, but there are some things that KDE has which it doesn’t offer. For one thing, the kio_slaves and Kate, the best free text editor that I used so far. I have considered installing Kubuntu in parallel to Ubuntu, but neither a shared home directory for them nor two home directories sounds intriguing. You can have both desktop environments by apt-get install kubuntu-desktop

Then you’ll be able to select KDE as window manager when logging in to your account. This will also replace the bootsplash theme in your initramfs that you see during bootup with Kubuntu’s theme, though. If you want to get the old one back: sudo update-usplash-theme usplash-theme-ubuntu

While we’re concerned with boot options, fiddling around with grub2 is beginning to grow into a rather complex task. What’s easier: Controlling your boot menu through the Startup manager.

Ubuntu 9.10 on a HP Compaq Presario CQ71 Notebook PC

4 12 2009

This is the second time that my IBM Thinkpad R51 died on me, and since I love it dearly but the hardware is outdated by now, I bought a Hewlett-Packard Compaq Presario CQ71 Notebook PC. Since the 9.10 version of Ubuntu, dubbed “Karmic Koala”, was released recently, I decided to try it out. It’s really nice – things like the integrated webcam work out of the box on my notebook, e.g. through Cheese. What didn’t work too well, though, was audio.

Apparently that’s a problem with the snd-hda-intel module. The built-in card identifies as follows:
# cat /proc/asound/card0/codec#* | grep Codec
Codec: IDT 92HD75B2X5
Codec: Intel G45 DEVCTG

There are numerous tips out there how to fix this problem that ALSA has with the snd-hda-intel model, most of them involve editing your /etc/modprobe.d/alsa-base.conf in a desperate attempt to find the right combination of options to get it working. I suggest before you try experimenting, you try what I did: install linux-backports-modules-alsa-karmic-generic via apt-get install linux-backports-modules-alsa-karmic-generic For me, this made my audio start working out of the box again without any more changes.

No text in Flash with libflashplayer in Linux

13 04 2008

It seems that Macromedia/Adobe finally managed to produce a Flash plugin which doesn’t crash your browser on every second Youtube video you want to see. Although the FreeBSD patches that I have seen and some reports might even indicate that this was a Kernel problem. No idea, but – you might be suffering from the same problem as I did and have invisible fonts on some Flash pages that you visit. For me, this was the case after a reinstallation. Looking for clues on Google, I’ve seen mentions of this from as early as 2004, with some tips about fixing the configuration for the X Font server xfs, which must have been so broken that it isn’t in use any more. I’ve found a minimal example to see if you’re affected or not, too: If you don’t see the text next to the checkboxes on this political cartoon on CNN, then your problem will be that the Arial font is missing on your system. For other things like web sites, there are usually fallbacks to fonts which look about the same, but Flash is picky with this: If you don’t have the font installed, then you see nothing.

What you’ll have to do to fix this is to install the Microsoft Core Fonts package. If you are using Debian, run apt-get install msttcorefonts (or apt-get install msttcorfonts for earlier distributions) as root. If you are using Gentoo, run emerge corefonts as root. For other Linux systems, visit the Corefonts home page for instructions. Restart your browser after that. Now you should have the Arial font and be able to read the text in the Flash movies, too.

Moving a Linux installation to a bigger drive

7 02 2008

I recently wanted to move my Gentoo installation from one notebook HDD to another, a bigger one. Moving the data over the network was fairly easy: Boot up two laptops with live CDs, in my case I happened to have two Ubuntu 7.10 CDs flying around, then start up netcat as root on one of them and using it on the other to copy the data:
nc -l -p 3333 > /dev/hdX on the receiving part and dd if=/dev/hdX | nc -q1 <target IP> 3333 on the sending one. You can use any other port, 3333 was the example that I used, and remember to replace hdX with your actual device. Alternatively, and a lot easier, is to use a mobile HD case to connect one of the drives to an USB port and then do the same as above without using netcat. If you do it this way, with dd, then you will retain everything, including the MBR so even your boot manager will be preserved. The next thing is to resize (expand) your data partition so that it can grow to make use of the additional storage space on your drive.

At first I tried using Partition Magic and similar tools from Acronis, which were always helping me out during my Windows days. Granted, the software was already a little dated, but the ext3 partitions wouldn’t have been any trouble for them. But nada, Partition Magic refused to do anything as it reported that the disk geometry of the target drive didn’t match the physical disk geometry present, which could lead to data loss and corruption. I was afraid that this was a real problem that was induced through my transfer solution, but it actually reported the same on the original drive as well. I popped in the Ubuntu live CDs again and was delighted to see that the Partition Manager parted had no trouble to fulfill the task, and with the graphical version GParted which can be accessed through System > Administration > Partition Editor, you have a nice GUI which is reminiscent of Partition Magic itself. The Qt version QtParted strangely wasn’t able to do this task, so give the Gnome version a try if you run into trouble.
GParted in action

How to get meaningful backtraces

1 11 2007

The Gentoo people have a very good guide online which explains how to get meaningful backtraces in Gentoo and gives a general introduction to gdb, the GNU debugger, too. In case one of your applications continues to crash and you want to submit a helpful bug report, take a look at the guide to find out how you can contribute a backtrace with your report.

Synchronizing the clock with network time

5 10 2007

My system time on the notebook always seems to be a little behind, so /etc/conf.d/net now takes care that it gets synchronized with internet time servers when connected:

postup() {
	if (route -n | grep "^*"$IFACE"$" > /dev/null) then
		einfo "(Re)connected to the internet, synchronising system clock ..."
		/etc/init.d/ntpd restart &
	return 0