Sunday, November 28, 2010

Getting a media centre remote working with LIRC, in Ubuntu 10.10

Recently I bought a new remote control for my PC, to replace the one that came with my TV tuner card. I picked up a Hauppauge Media Center Remote Control Kit, model 335, which has more logically labelled buttons than what I had. It looks a bit nicer, too, an important consideration as I am attempting to finally build a Home Theatre PC to go in the lounge room.

While the previous Technisat remote worked fine in Ubuntu 10.10, I read of some other people having problems with getting remotes to work - namely the Media Centre-compatible versions. When I plugged in my new one, I also noticed the problem.

A bit of trawling around on the internet uncovered a thread at the ever-reliable Ubuntu forums. It turns out that the newer kernel includes a module for the media centre remote (mceusb), that clashes with the lirc_mceusb module you want to use, with LIRC. When the two modules are loaded, neither works.

What has to be done, is make sure only one of them gets loaded. The user uniden9 posted an excellent how-to in that thread linked above, describing two methods that are available - disabling the old lirc one, or disabling the newer, kernel built-in module. Based on other responses in the thread, most people had more luck with the second method - disabling the newer one. I guess the MythTV key bindings etc. would work better with the old version.

I have included the relevant quote from uniden9's post here, in case there is a problem accessing the forums:

2. Blacklist the kernel source drivers and use the old dkms built drivers.
-Well you already have lirc-sources-modules install and probably had this working on 10.04 or older version of ubuntu.
A. Edit /etc/modprobe.d/blacklist.conf , create it if it doesn't exist.
Add>
blacklist mceusb
line to the file and save it.
B. Update initramfs, #sudo update-initramfs -u -k all
C. reboot
D. Reconfigure lirc if its not already working.
#sudo dpkg-reconfigure lirc
On the Remote, Select "Windows Media Center Transceiver/Remote (All)
E. Thats it.
This is the method I chose after wrestling with button repeats on option 1. I use XBMC and could not figure out how to disable Ubuntu treating the remote as a keyboard device.

I used this method as well, and now have the media centre remote working just fine on my system. I'm now just waiting on the arrival of a VGA to Component Transcoder, that will hopefully allow my PC to connect with my older-style TV that has only component inputs. As an aside, although I have a graphics card that has a component-out attachment, it only puts out a 1080i, 60Hz signal. My TV, being made for the Australian, PAL-based market, requires a 1080i, 50Hz input signal. Fingers are crossed that the transcoder will allow it to work - I'll be posting an update when it arrives and I can try it out.

Thursday, November 11, 2010

Getting Ubuntu installed on a laptop

I had managed to score for free from work an old laptop that was past its use-by date, for business use at least. It's an LG S1 Express Dual, with a Core Duo (not Core 2) processor. Previously, to extend its life a little longer I had installed 2GB of memory in it and a faster hard drive - that made a remarkable difference.

Being from around 2006, it had come with Windows XP pre-installed. I wanted to try a newer operating system than that, so initially I put Windows 7 on it. Now for people saying Linux is hard to get driver support for, Windows 7 was an ordeal in itself. First of all, LG have basically stopped making laptops. Drivers for it were not available on their site for windows 7. Some Vista drivers were available, so I had some of those installed. The graphics chip in this machine is an ATI Mobility Radeon X1400. Going to ATI/AMD's site to find a current driver just sends you to a page saying that it's the laptop maker's responsibility - they don't support it any longer.

Even things like network drivers were unable to be found easily. I remember having to scrounge around looking for whatever I could find, on obscure and slightly dodgy driver sites. In the end, Most of it worked. The on-screen display didn't work, some of the special functions didn't work, and got no joy from the included remote control.

One other setback was the BIOS not recognising hard drives over 137GB/128GiB in size. A bit of a setback, since I'd like to make use of all of the 160GB drive that was installed in it. First up, I tried dual booting with Linux, using the space at the end of the drive that BIOS and Windows couldn't see, but was no problem for Linux. Ubuntu booted fine, but Windows would refuse to boot, until I shrank the partitions down to fit under the 137GB limit.

Finally, I decided to just run a complete install of Ubuntu. Taking advantage of the release of version 10.10, I put in the 32-bit install disc (the Core Duo T2400 does not support 64-bit OSes) and nearly everything seemed to work pretty well. Especially networking, which did not work under Win 7.

A bit of tweaking was needed though. Sound wouldn't work. A little digging through the forums revealed the module for the sound card wasn't installed, and the following had to be added to the end of the file /etc/modprobe.d/alsa-base.conf:

options snd-hda-intel model=lg

This loaded the correct module at boot time, and sound now works.

One other problem I had was with the suspend functionality. While the system would go into suspend mode correctly, upon resuming the wired networking would refuse to work. I haven't tested wireless, as I do not have a wireless router yet. A little research revealed it was due to this bug, and that by manually unloading and reloading the network module, it would come back to life again. The commands to do that are:

sudo modprobe -r et131x
sudo modprobe et131x


Thanks to the user P4Man at ubuntuforums.org, a short script has been created, as detailed in this post:

Create a script named /etc/pm/sleep.d/11ethernet, with the following contents:

#!/bin/bash
case $1 in
suspend)
rmmod et131x
;;
resume)
modprobe et131x
;;
esac


Changing the “et131x” value to whatever the network module is. That is what the module is on this LG laptop.
Save file and make it executable:

sudo chmod 755 /etc/pm/sleep.d/11ethernet

Now, when the laptop goes into suspend mode, the network module gets unloaded, and upon waking up, the module gets reloaded. Networking works!

Boot up time is nice and quick with 10.10 as well - quicker than windows 7 which itself was no slouch. A far cry from its original state, with a slow old hard drive, Windows XP and a bajillion little programs that started on boot. All in all, it's a nice machine. Now I just have to buy a battery for it that works...