Friday, May 6, 2011

Tightwad + Ubuntu = Agony.

So I recently bought this to control my Ubuntu based XBMC for  a whole 18 US dollars off of that e-bay:
It says "HP" on it. Obviously Genuine

I plugged my tightwad remote into my tightwad computer which runs Ubuntu 10.10 and predictably it didn't work. Both because it's cheap junk and Ubuntu is designed to test the most patient amongst us. I blame myself for all of this, you know.

So, the not so obvious first step is to install LIRC, the Linux remote control software because it just is.
sudo apt-get install lirc
You will get a funky little text based installer asking you to choose what type of device you have. Instead of guessing, you want to choose "Windows Media Center Transceivers/Remotes (all)" for the  remote and "None" for the transmitter.

Did that work? Of course not.

Next thing is to do is find out what it really is in the box.
user@Revo:~$ lsusb
Bus 003 Device 004: ID 1934:5168 Feature Integration Technology Inc. (Fintek) F71610A or F71612A Consumer Infrared Receiver/Transceiver
Oh yes, the well known HP "Fintek" thingy. A bit of googling tells me that this is a generic part which is a single chip USB / IR solution. You need to add a tiny memory chip to it to get it to report another name (you know, like "HP" or "Microsoft"); something LIRC may recognise. Amusingly, the difference between the F71610A and the  F71612A is that one is a transceiver and the other a receiver only; except they are the same part and you enable the additional functionality by adding a resistor.

The problem then is not all Linux - these knock-off devices are being put on the market without the proper identification because it saves a few pennies. So, I may now know what it is but lamentably Ubuntu 10.10 does not have a scooby doo. How to fix this. Who can tell. Well, me after a bit (lot) of hunting around on the Internet.

The first problem is; this may be fixed in future versions of the Linux kernel, but it's not fixed in the kernel I have, and it's unlikely to be fixed as there's been a change in the way LIRC handles things. It used to be a "kernel extension" and now it's "in kernel". And of course it's much harder to change the new "in kernel" module. So we'll go back to doing it the old way.

First thing to do is blacklist the new kernel module so it won't load any more:
sudo sh -c 'echo "blacklist mceusb" > /etc/modprobe.d/blacklist-mce.conf'
That'll show it.
Next we need to add the Fentek device (ID 1934:5168) to the old kernel extension and that means <sigh> we need to re-compile it. Get the source code first:
sudo apt-get install lirc lirc-modules-source
Then you need to edit the file /usr/src/lirc-0.8.7~pre3/drivers/lirc_mceusb/lirc_mceusb.c adding the following lines into the big structure of similar entries:
/* Crappy Fintek based Chinese Remote */ {USB_DEVICE(VENDOR_FINTEK, 0x5168) },
Then do the actual build and install of the old style kernel module:
sudo dkms remove -m lirc -v 0.8.7~pre3 --all
sudo dkms add -m lirc -v 0.8.7~pre3
sudo dkms -m lirc -v 0.8.7~pre3 build
sudo dkms -m lirc -v 0.8.7~pre3 install
Hang on, we are getting there... And finally tell LIRC to load the old fashioned kernel extension instead of the new one; in file /etc/lirc/hardware.conf change the line:
REMOTE_MODULES="lirc_dev mceusb" 
to:
REMOTE_MODULES="lirc_dev lirc_mceusb"

You then need to restart and if you made no mistakes (hah!) it will work.

The final thing you need to do with this remote is to change the key mappings a bit, it has a single "Play/Pause" button where it looks like others have separate buttons. This means that within XBMC neither is detected.

I fixed this by modifying the file /usr/share/xbmc/system/lircmap.xml There is probably a better way of doing this by changing something in your user folder but I don't know what that is.
Two lines should be changed in the  <remote device="mceusb"> section. Before:

<play>Play</play>
<pause>Pause</pause>
and after:

<play>PlayPause</play>
<pause>PlayPause</pause>
Several wasted hours later it should work as you hoped!

3 comments:

  1. Dan, you're a life saver...

    This was my last step in getting a Mythbuntu 11.04 back/front-end system up and running on a Revo 3700.

    Your instructions were perfect, and allowed me to perform the magic.

    Thanks for taking the time to put up the details of your hard work.

    Cheers,
    ronkinoz.

    ReplyDelete
  2. I have a similar problem. Also ordered an IR receiver off ebay. Supposedly an HP OVU400102/71, P/N 5187-4593. But when I plug it in, lsusb doesn't even output anything for it. To me, it seems totally dead. Windows also doesn't recognise it. Did you have problems like that at all? By the way, who was the seller? I bought from user huijuan128 on ebay.

    ReplyDelete
  3. If it's not showing up in lsusb it may well be dead - I can only suggest the obvious that you try it in a port that you know for sure works already. My first remote was broken and I was sent a new one without any fuss from the now long forgotten vendor.

    ReplyDelete