Kodi Community Forum

Full Version: [LINUX] HOWTO iMON MCE new linux input event and driver
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Although there is already a howto for iMon under the new input layer of the newer kernels (> 2.6.35), this one is for using the iMon in MCE mode free of bugs and keep it working.

First of all, I have to say that the new imon driver and the new input layer/lirc system of the newer kernels are riddled with horrible bugs and I spent countless hours to finally find a solution and a fix.

The new IR system in linux works like this:

Kernel IR core -> Driver/Module producing input events -> Lirc listening to dev input -> XBMC listening to Lirc

It's quite complicated and involves many layers, and with the peculiar iMon with its mode switches (iMon/MCE) it's rather buggy and difficult, but with my instructions it should work:


First follow these instructions from Lyka's guide:

lyka Wrote:With Ubuntu 10.10 due to some changes to lirc and its modules, my harmony-mce remote stopped to work. I decided to try to use IMON codes and follow the new way of lirc:

Quote:sudo dpkg-reconfigure lirc
then select
Quote:Linux input layer (/dev/input/eventX)

on "IR transmitter" i picked none.

on "Custom event interface for your dev/input device: " open a new shell and run:

Quote:cat /proc/bus/input/devices

you will face somethig like this:

Quote:I: Bus=0003 Vendor=15c2 Product=0038 Version=0001
N: Name="iMON Remote (15c2:0038)"
P: Phys=usb-0000:00:0b.0-6/input0
S: Sysfs=/devices/pci0000:00/0000:00:0b.0/usb2/2-6/2-6:1.0/rc/rc0/input5
U: Uniq=
H: Handlers=kbd mouse1 event5
B: EV=100007
B: KEY=fff 0 0 400000 108c0320 2d50082 0 0 30000 4 119000 4196 14100801 809e1680 0 2000000 10004002
B: REL=103

select the event you want lirc to listen, in my case:

Then we need to change to MCE mode. To do this we need 2 things:

1. To change the imon's IR protocol from "other" to "MCE"
2. And to load the imon MCE keymap to kernel, so the mce codes get picked up.

And we need them to be done in every reboot/resume/thaw.

Fortunately both of these can be done through the use of the ir-keytable from v4l-utils, though it has several bugs and it doesn't work. But fear not because I fixed all of them and made a patch:

1. download this git snapshot of v4l-utils

mkdir ~/src
cd ~/src
wget "http://git.linuxtv.org/v4l-utils.git?a=snapshot;h=0bcc28a1d4ad19dfe40fff570670e8d26952a274;sf=tgz" -O v4l-utils-git.tgz
tar zxf v4l-utils-git.tgz
cd v4l-utils

wget http://pastebin.com/raw.php?i=3KwdVuKH -O keytable-imon-fixes.patch
patch utils/keytable/keytable.c < keytable-imon-fixes.patch

make install

With ir-keytable now working, you need to create a new udev rule (this one took me the most time to make) to change to the MCE mode and to load the keymaps in each reboot/resume/thaw or just plain module load:
sudo wget "http://pastebin.com/raw.php?i=pjY3G8q0" -O /etc/udev/rules.d/10-imon-mce.rules

Now continue to follow the rest of Lyka's guide:

Quote:after this try

and check if it works.
my device prints something like:

Quote:000000008001001c 00 KEY_ENTER devinput
since my remote declare himself as "devinput" i had to edit Lircmap.xml:

Quote:sudo gedit /usr/share/xbmc/system/Lircmap.xml

You can change them following your taste.
Quote:<remote device="devinput">

And you are done! You should reboot now and it should work! Wink

Check it with reboot, suspend and hibernate to make sure everything works correctly.

I hope you find this useful.

I was hoping to use your instructions to change my iMon remote receiver to receive MCE signals. However, I'm not having any luck. It is not responding to MCE remote keypresses.

I noticed that after typing this line: "patch utils/keytable/keytable.c < keytable-imon-fixes.patch", I get the following errors:

(Stripping trailing CRs from patch.)
patching file utils/keytable/keytable.c
Hunk #1 succeeded at 138 with fuzz 1.
Hunk #2 FAILED at 267.
patch unexpectedly ends in middle of line
Hunk #3 FAILED at 454.
2 out of 3 hunks FAILED -- saving rejects to file utils/keytable/keytable.c.rej

Any ideas on what I may be doing wrong?

Also, for "cat /proc/bus/input/devices", I get the following 2 devices:

I: Bus=0003 Vendor=15c2 Product=0038 Version=0002
N: Name="iMON Panel, Knob and Mouse(15c2:0038)"
P: Phys=usb-0000:00:1d.0-2/input1
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/input/input5
U: Uniq=
H: Handlers=kbd mouse1 event5
B: EV=100007
B: KEY=10800320 2000002 0 0 30000 0 110000 110 100001 e0600 0 0 0
B: REL=103

I: Bus=0003 Vendor=15c2 Product=0038 Version=0002
N: Name="iMON Remote (15c2:0038)"
P: Phys=usb-0000:00:1d.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/rc/rc0/input6
U: Uniq=
H: Handlers=kbd event6
B: EV=100013
B: KEY=fff 0 0 400000 108c0320 2d50080 0 0 30000 4 119000 4186 14100801 809e1680 0 2000000 10004002
B: MSC=10

So, I selected "event6" for my device... When I tried irw, I was able to see the keypresses from my iMon remote, so I'm assuming this is the correct device. Howerver, I did notice that this event number keeps changing after reboots... Sometimes, it is event4. Any ideas how to make this permanent?

Looking forward to your help and comments.
First I'd like to thanks for this tutorial it helped a lot.

I had the same problem as embo when I applied the patch command so I patched the file manually.

Now IRW respond when I press a key.

Have you found a solution to your problem?
In advance thank you.
Yes, my problem is solved.
I reinstalled XBMC live Beta 3 did the upgrade to RC2 and configure my harmony to mimic my antec veris RM100 remote instead of trying to configure it as a MCE.

All worked without editing anything in Linux, I just did configure my Harmony remote