I have a Silverstone case with the iMon LCD/IR package. After the lirc changes (migration to in-kernel) I did make an early attempt at getting it working. However, I spent a couple of days trying to get it to work, and absolutely nothing would work. Eventually I got the LCD working on that attempt, but I never did get the IR working.

Now that it's been a while, I decided to try this again and attempt to document what I've done in order to get it to work.

Known Issues / Notes

Lirc and lcdproc need to be started AFTER modifying the keymaps, in that order. If you modify before, there's a (high) chance ir-keytable will hang the boot process! See Making it all work together in the Table of Contents.

I wound up building the keymap modules into the kernel - I was having stability problems before I did. Technically speaking, these are optional, especially if you are going to override them (like later in this Howto.)

Reboot into the new kernel.

Install userspace helper tools

The kernel is now using keytables in order to generate IR events. In other words, the kernel is supposed to generate actual keypresses when you press a button on your remote (making lirc redundant/obsolete.) What we need to do is install some userspace tools that will provide and allow us to modify these keytables and test the actual kernel IR itself. In gentoo, the package we need to install the newest version of media-tv/v4l-utils:

Before doing anything with any other packages, we need to make sure the kernel IR is working.

The program we'll be using is ir-keytable. This program is like the swiss-army knife for kernel IR. It allows you to view recognized devices, load custom keymaps, switch IR protocols on recognized IR receivers, and even test them (similar to `irw` used with lirc.)

That's good news, it sees the IR receiver! It is the imon receiver. So what does "table rc-imon-pad" mean? This is the remote keys that are currently loaded by the kernel. In this case, it assumes you want to use the original iMon remote. This device also supports MCE-like remotes (protocol RC-6.)

When the driver was loaded, it didn't enable either protocol (which means it won't respond to any IR) - that's why the 'Enabled protocols' is blank.

I like to use the MCE remote, so we're going to change it. When the v4l-utils package was installed, it also installed a bunch of new keymaps under /etc/rc_keymaps. The two that pertain to the iMon are imon_pad and imon_mce. So, to load the new remote and switch IR protocols:

The problem with this "new" method is that it does map direct keypresses. This can be a problem, especially if you're used to having different lircrc tables for each program - you'd have to modify the keyboard keybindings for each program to be the same, which is, uh, not intuitive. What we can do is wedge lirc between the kernel IR and the applications to maintain compatibility. Time to install lirc.

lirc interfaces with the new kernel IR with devinput, so set this in make.conf:

Code:

# Remote (LIRC) configuration
LIRC_DEVICES="devinput"

Now emerge lirc:

Code:

# emerge -av lirc

Once, lirc is installed, it should install a new /etc/lirc/lirc.conf (I'll post the first few lines of it here):

As we can see, the IR is coming through /dev/input/event15. However, we shouldn't tell lirc to listen to this directly (what happens if the IR gets plugged into a different USB port? It stops working.) To get around this, we'll tell it to listen to the device by it's device id:

I always set the LCD to blank/turn off on shutdown. (OnExit=2)
Make sure you use the correct protocol.

Making it all work together (initscript modification)

I discovered an unusual problem when setting up the rc-scripts to start all the services involved. If you modify the keycode tables and/or protocols after LCDd and lircd have started, you run the risk of hanging the boot process (it seems ir-keytable sometimes hangs.) So using a start script in /etc/local.d/ is out of the question - I had to use a live CD to remove it so I could boot again. The failure rate I experienced was high after testing it - 80% of the time ir-keytable would hang.

Unfortunately the only way for me to get this working reliably was to modify /etc/init.d/lircd and /etc/init.d/LCDd in order to modify the keytable and control the order of the scripts.

There were a few modifications to /etc/init.d/lircd - one to change the dependency order, one to change the notification at startup, and one to modify the keytable and change the IR protocol. This is the full initscript:

Reboot the PC. Once it's back up, use `irw` and press some buttons to make sure the remote is working.

Troubleshooting

No output from `ir-keytable -t`? Stop lircd first.

Remote not working? It's almost always because ir-keytable silently failed.

In order to use ir-keytable to test this, you have to stop lircd first. Then type `ir-keytable` with no options and make sure the right protocol is enabled. If it isn't, set it manually and try running `ir-keytable -t`. Once you get ir-keytable working, restart lircd and test with irw.

Conclusion

Now with everything set up, you may want to add 'lirc' and 'lcd' to your USE-flags to build appropriate support. Once that's done, you'll need to build your own .lircrc files to pass codes on to programs (this is outside the scope of this HowTo.)

I just realized none of my existing lircrc files will work, so now I have to redo them all! What fun!

Now that I think about it, the framework is there to set up other remote receivers too. I kept putting the upgrade off, mostly because I tried once while it was in the staging area of the kernel and I just couldn't get the damn thing to work. My mythtv frontend was on 2.6.32 until yesterday.

On mine I only had the one remote control, and I only built the imon driver.

Another thing that it could possibly be unhappy about is you're not setting a protocol. I'd try using the system class identifiers, in your case:

Code:

$ ir-keytable -s rc0 -c -w /etc/rc_keymaps/imon_pad -p other

Edit: You're not running LCDd or lircd when doing this, are you? You need to make changes before starting either.

Edit2: What's the contents of /etc/rc_keymaps/imon_pad? Post it in here (or use pastebin), maybe there's something wrong with it? Have you tried using imon_mce? Does it segfault too? If it doesn't maybe compare the two files, maybe it's crashing on file formatting. I doubt it, but I guess it could happen...

I've just done some testing and blacklisted the other IR device modules, so the iMON is the only device listed in ir-keytable. That didn't seem to make a difference. However, by using the system class IDs instead of the event device I did get ir-keytable to complete (although specifying the protocol didn't go down well):

Even after this, I'm still not getting output from it when testing with ir-keytable. When I cat /dev/input/event5 and hit some keys, there's no output like I had with an old build of lirc. Do you get any output when cat'ing your ir device?

Since reading you guide, I've left LCDd and lirc off to try and get this working.

As I said in my earlier post, I've not tried the original remote. I did a quick google and people seem to struggle to get the imon remote working, and when they do the pad part doesn't seem to work? If I remember right I used it originally with the old lirc setup and it was treated like a mouse. That's why I started using the MCE remote.

If you set the protocol to RC-6 you need to use a Microsoft remote (or philips remote?) with it, the imon remote will not work. Do you have a universal remote that you can program lying around? Actually, I'd bet an xbox remote would work if you have one lying around. At least you could test it.

I don't want to start messing with my install, I only have one imon controller and that's in my living room, I don't want to break the config for obvious reasons.

I find it weird that it says it changes the protocol to other when you put in the imon_pad keymap, but it doesn't show in enabled protocols... what kernel are you using?

If you do have a Microsoft remote lying around try it with the mce keymap and rc6 protocol. When you run ir-keytable -t are you pressing a bunch of buttons in the test mode? I remember when I was setting up mine I had to press a few buttons before it responded.

Yeah, I can appreciate you wouldn't want to go messing with your setup after getting it all working, I'd be the same

I am considering just buying an MCE remote rather than fixing this (I'm sick of my wireless keyboard for one), but first I'm going to try booting into a new genkernel I've just created to see if it helps (my current kernel is manually build). I'll post how I get on...

After trying both a hand-rolled kernel with all driver options selected, and also the genkernel based kernel, neither helped to get the iMON remote working. Oh well, time to buy some different hardware I guess.

After trying both a hand-rolled kernel with all driver options selected, and also the genkernel based kernel, neither helped to get the iMON remote working. Oh well, time to buy some different hardware I guess.

A tip: a cheap harmony universal remote will get you the ability to use the Microsoft remote, and it might be cheaper... I've seen some of the cheaper Harmonies sell for $25.