2011-06-29, 19:59
Preface
There seems to be a lot of confusion about how Linux deals with IR receivers and remotes. Many people simply can't get anything to work at all, some are having problems with their remotes sending events twice and others can't get every button to work or get them mapped to XBMC the way they want it.
That's why I decided to try to write this guide to try and take away at least some confusion by outlining the options you have to get your remote to work. I will also to the best of my ability try to explain the procedure to get everything to work the way you want it, but I won't go into too much detail. So if you want or have to compile some silly (source wrapped) proprietary driver to get your receiver to work (e.g. nuvoton) or want to compile a newer version of LIRC or a custom kernel, you're on your own. I consider that to be outside the scope of this guide. I just want to sketch the landscape.
I also would like to make clear that, although I am pretty well versed in Linux, I am by no means an expert with regard to remotes or LIRC. So if I make any mistakes feel free to correct me. I will do my best to keep this guide as accurate as possible. Due to my proficiency with Linux I may get ahead of some of you, so please stop me if I do. Do note, however that this is not a tutorial. It's not a sequences of steps or commands that you have execute and all is well. I think that may work very well for particular configurations such as those Asrocks that come with only one type of receiver and one type of remote. But this more of a guide that attempts to be as generic as possible. I'm trying to make you understand how things work, so you should be able to get any configuration working.
Introduction
I think a big part of this confusion is caused by the migration of LIRC functionality to the Linux kernel (drivers). This change started in 2.6.33 with the inclusion of the ir-core module in the mainline kernel. Many older guides currently on the internet have of course not taken this into account, which is why those traditional guides won't work too well. Hence, a 'new' guide.
Somebody has written a good article about this change. Note that even though he talks about 2.6.35, the change started in 2.6.33. The author is simply talking about iMon specifically, which was indeed included in 2.6.35. This means that from 2.6.33 and onward you are risking conflicts between the new kernel interface and lirc. However, the fact that the core has been included does not mean it works for all devices, but it does mean potential conflicts start there. The 'new' drivers have been included in the following versions:
2.6.33: core
2.6.35: iMON
2.6.36: Lirc bridge
2.6.38: mceusb (MS/HP/Philips or other MCE compatible receivers)
2.6.39: Nuvoton CIR (w83667hg), Winbond Super I/O, ENE KB3926 CIR, Streamzap, ITE IT8712F/IT8512 CIR
3.0: Fintek LPC SuperIO Consumer IR Transceiver
So it depends on your Linux version and IR receiver whether you can follow my guide. Here the overview:
<=2.6.32 all receivers: you can NOT follow this guide, but there will also be no conflicts. Just use a lirc tutorial and you'll be fine
>=2.6.33 all combinations (or better) not (white)listed above: you can NOT follow this guide, because your receiver is not supported (yet). However, there can be conflicts, so disable the new interface by blacklisting all ir-* and rc-* modules. Then you can just use lirc regularly. Or if you can download, compile and install the drivers separately for your kernel, you can of course follow this guide.
All other cases: you can choose to follow my guide OR use the lirc bridge (>=2.6.36) (see section 2.1 in post #2) or do rc-* ir-* mceusb/imon/in-kernel-driver-for-your-receiver blacklisting to just use lirc.
You can find out which version you are running by executing
Note: Ubuntu "Lucid" 10.04 LTS runs 2.6.32 or 2.6.35 (both are included in the official APT repository), so it falls into the first (2.6.32) or second (2.6.35) category, except if you have an iMON receiver. Why you would want to run Lucid on a bleeding edge multimedia system such as an HTPC is beyond me, but I thought I should explicitly mention Lucid a lot of people still run it.
Executive Summary
After reading this guide I hope you are able to:
Anyway, to the guide it is.
The guide
There are roughly three stages that all have to worked out to get a seamless experience. Depending on your hardware, software, configuration and certain choices you make, these stage may require anything from almost no configuration to a lot of compiling and configuring.
0. Table of Contents
Since the posts are restricted to 10000 chars, this will be a three part guide, corresponding to the abovementioned list. Stage 1 will be included in this post and stage 2 and 3 will get their own posts.
1. IR Receiver
The focus will be on the second and third stage, since the first stage isn't radically different from what it used to be in the past. Like with any device it's about finding the right driver (kernel module), optionally compiling it and installing and using it. It's the way it's always been. Like I said, if you want to know about DKMS or something have a look at DKMS guide or tutorial and then come back here. So that I'm not going to pay too much attention to right now.
All I can do if that if you are still planning to buy an IR receiver, make sure it is compatible with Linux out-of-the-box, meaning that the driver should be included in the vanilla Linux kernel. This will make life a lot easier for you.
If you already have a receiver, plug it in and enter
You should see something similar to this:
Also check
At the very least your receiver should be detected and not be listed as "unknown device" or something.
Just so you know, my receiver worked out of the box. I hand picked it .
Anyway, this is nothing new. Like I said it's something you may have to do for every device: look if it works by default, if not, search for and install the appropriate driver(s).
What has changed is the testing procedure. Many traditional guides will start by using
to verify if your receiver can receive IR signals and thus if the driver works well. This however, is no longer a reliable method, due to the changes in Linux 2.6.33 and onward. I will get back to this in stage two, but for the purpose of simply testing your IR receiver, stop lirc and execute
It should be generating events now. I will dissect this command and its output in section 2.2, but for now it suffices to see if it works at all. Remember, this is just about the receiver. If you don't have this command, install the package that provides it. In Ubuntu this is ir-keytable, but I think it varies per distribution.
Also try all your other remotes if it didn't work: from your TV, DVD, BR, Xbox, A/V receiver and your dog. Some remotes simply are not compatible, but one of them definitely will be.
If all of this has failed, it's pretty safe to say your driver probably hasn't been installed correctly. Go back to start and do not receive €20000.
There seems to be a lot of confusion about how Linux deals with IR receivers and remotes. Many people simply can't get anything to work at all, some are having problems with their remotes sending events twice and others can't get every button to work or get them mapped to XBMC the way they want it.
That's why I decided to try to write this guide to try and take away at least some confusion by outlining the options you have to get your remote to work. I will also to the best of my ability try to explain the procedure to get everything to work the way you want it, but I won't go into too much detail. So if you want or have to compile some silly (source wrapped) proprietary driver to get your receiver to work (e.g. nuvoton) or want to compile a newer version of LIRC or a custom kernel, you're on your own. I consider that to be outside the scope of this guide. I just want to sketch the landscape.
I also would like to make clear that, although I am pretty well versed in Linux, I am by no means an expert with regard to remotes or LIRC. So if I make any mistakes feel free to correct me. I will do my best to keep this guide as accurate as possible. Due to my proficiency with Linux I may get ahead of some of you, so please stop me if I do. Do note, however that this is not a tutorial. It's not a sequences of steps or commands that you have execute and all is well. I think that may work very well for particular configurations such as those Asrocks that come with only one type of receiver and one type of remote. But this more of a guide that attempts to be as generic as possible. I'm trying to make you understand how things work, so you should be able to get any configuration working.
Introduction
I think a big part of this confusion is caused by the migration of LIRC functionality to the Linux kernel (drivers). This change started in 2.6.33 with the inclusion of the ir-core module in the mainline kernel. Many older guides currently on the internet have of course not taken this into account, which is why those traditional guides won't work too well. Hence, a 'new' guide.
Somebody has written a good article about this change. Note that even though he talks about 2.6.35, the change started in 2.6.33. The author is simply talking about iMon specifically, which was indeed included in 2.6.35. This means that from 2.6.33 and onward you are risking conflicts between the new kernel interface and lirc. However, the fact that the core has been included does not mean it works for all devices, but it does mean potential conflicts start there. The 'new' drivers have been included in the following versions:
2.6.33: core
2.6.35: iMON
2.6.36: Lirc bridge
2.6.38: mceusb (MS/HP/Philips or other MCE compatible receivers)
2.6.39: Nuvoton CIR (w83667hg), Winbond Super I/O, ENE KB3926 CIR, Streamzap, ITE IT8712F/IT8512 CIR
3.0: Fintek LPC SuperIO Consumer IR Transceiver
So it depends on your Linux version and IR receiver whether you can follow my guide. Here the overview:
<=2.6.32 all receivers: you can NOT follow this guide, but there will also be no conflicts. Just use a lirc tutorial and you'll be fine
>=2.6.33 all combinations (or better) not (white)listed above: you can NOT follow this guide, because your receiver is not supported (yet). However, there can be conflicts, so disable the new interface by blacklisting all ir-* and rc-* modules. Then you can just use lirc regularly. Or if you can download, compile and install the drivers separately for your kernel, you can of course follow this guide.
All other cases: you can choose to follow my guide OR use the lirc bridge (>=2.6.36) (see section 2.1 in post #2) or do rc-* ir-* mceusb/imon/in-kernel-driver-for-your-receiver blacklisting to just use lirc.
You can find out which version you are running by executing
Code:
uname -r
Note: Ubuntu "Lucid" 10.04 LTS runs 2.6.32 or 2.6.35 (both are included in the official APT repository), so it falls into the first (2.6.32) or second (2.6.35) category, except if you have an iMON receiver. Why you would want to run Lucid on a bleeding edge multimedia system such as an HTPC is beyond me, but I thought I should explicitly mention Lucid a lot of people still run it.
Executive Summary
After reading this guide I hope you are able to:
- understand how IR signals are processed by Linux;
- emulate a keyboard with your remote;
- map almost every button on your remote to the appropriate key press or media centre event; or
- assign various actions to the same button on your remote in XBMC, depending on the context
Anyway, to the guide it is.
The guide
There are roughly three stages that all have to worked out to get a seamless experience. Depending on your hardware, software, configuration and certain choices you make, these stage may require anything from almost no configuration to a lot of compiling and configuring.
0. Table of Contents
- IR receiver (post #1)
- The remote (posts #2 and #3)
- Mapping buttons to XBMC (post #4)
Since the posts are restricted to 10000 chars, this will be a three part guide, corresponding to the abovementioned list. Stage 1 will be included in this post and stage 2 and 3 will get their own posts.
1. IR Receiver
The focus will be on the second and third stage, since the first stage isn't radically different from what it used to be in the past. Like with any device it's about finding the right driver (kernel module), optionally compiling it and installing and using it. It's the way it's always been. Like I said, if you want to know about DKMS or something have a look at DKMS guide or tutorial and then come back here. So that I'm not going to pay too much attention to right now.
All I can do if that if you are still planning to buy an IR receiver, make sure it is compatible with Linux out-of-the-box, meaning that the driver should be included in the vanilla Linux kernel. This will make life a lot easier for you.
If you already have a receiver, plug it in and enter
Code:
dmesg
You should see something similar to this:
Code:
[ 13.200050] Registered IR keymap rc-rc6-mce
[ 13.200159] input: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) as /devices/pci0000:00/0000:00:12.0/usb3/3-3/3-3:1.0/rc/rc0/input2
[ 13.200218] rc0: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815) as /devices/pci0000:00/0000:00:12.0/usb3/3-3/3-3:1.0/rc/rc0
[ 13.200267] mceusb 3-3:1.0: Registered Philips eHome Infrared Transceiver on usb3:2
[ 13.200288] usbcore: registered new interface driver mceusb
Also check
Code:
lsusb
At the very least your receiver should be detected and not be listed as "unknown device" or something.
Code:
Bus 003 Device 002: ID 0471:0815 Philips (or NXP) eHome Infrared Receiver
Just so you know, my receiver worked out of the box. I hand picked it .
Anyway, this is nothing new. Like I said it's something you may have to do for every device: look if it works by default, if not, search for and install the appropriate driver(s).
What has changed is the testing procedure. Many traditional guides will start by using
Code:
irw
to verify if your receiver can receive IR signals and thus if the driver works well. This however, is no longer a reliable method, due to the changes in Linux 2.6.33 and onward. I will get back to this in stage two, but for the purpose of simply testing your IR receiver, stop lirc and execute
Code:
ir-keytable -c -p NEC,RC-5,RC-6,JVC,SONY -t
It should be generating events now. I will dissect this command and its output in section 2.2, but for now it suffices to see if it works at all. Remember, this is just about the receiver. If you don't have this command, install the package that provides it. In Ubuntu this is ir-keytable, but I think it varies per distribution.
Also try all your other remotes if it didn't work: from your TV, DVD, BR, Xbox, A/V receiver and your dog. Some remotes simply are not compatible, but one of them definitely will be.
If all of this has failed, it's pretty safe to say your driver probably hasn't been installed correctly. Go back to start and do not receive €20000.