Kodi Community Forum
[LINUX] HOWTO iMON MCE new linux input event and driver - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] HOWTO iMON MCE new linux input event and driver (/showthread.php?tid=99042)



[LINUX] HOWTO iMON MCE new linux input event and driver - Nektarios - 2011-04-11

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:

Instructions

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:
Quote:/dev/input/event5


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

Code:
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
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:
Code:
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
Quote:irw

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">
<pause>KEY_PLAY</pause>
<stop>KEY_STOP</stop>
<forward>KEY_FASTFORWARD</forward>
<reverse>KEY_REWIND</reverse>
<left>KEY_LEFT</left>
<right>KEY_RIGHT</right>
<up>KEY_UP</up>
<down>KEY_DOWN</down>
<select>KEY_ENTER</select>
<pageplus>KEY_CHANNELUP</pageplus>
<pageminus>KEY_CHANNELDOWN</pageminus>
<back>KEY_BACKSPACE</back>
<menu>KEY_MENU</menu>
<play>KEY_PLAY</play>
<info>KEY_COMPOSE</info>
<skipplus>KEY_NEXT</skipplus>
<skipminus>KEY_PREVIOUS</skipminus>
<volumeplus>KEY_VOLUMEUP</volumeplus>
<volumeminus>KEY_VOLUMEDOWN</volumeminus>
<mute>KEY_MUTE</mute>
<power>KEY_POWER</power>
<title>KEY_PROG1</title>
<display>KEY_ZOOM</display>
<tab>KEY_SCREEN</tab>
<home>KEY_EXIT</home>
<backslash>KEY_CYCLEWINDOWS</backslash>
<myvideo>KEY_VIDEO</myvideo>
<mymusic>KEY_MEDIA</mymusic>
<mypictures>KEY_CAMERA</mypictures>
<mytv>KEY_TV</mytv>
<subtitle>KEY_SUBTITLE</subtitle>
<language>KEY_LANGUAGE</language>
<one>KEY_NUMERIC_1</one>
<two>KEY_NUMERIC_2</two>
<three>KEY_NUMERIC_3</three>
<four>KEY_NUMERIC_4</four>
<five>KEY_NUMERIC_5</five>
<six>KEY_NUMERIC_6</six>
<seven>KEY_NUMERIC_7</seven>
<eight>KEY_NUMERIC_8</eight>
<nine>KEY_NUMERIC_9</nine>
<zero>KEY_NUMERIC_0</zero>
</remote>

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.


- embo - 2011-06-19

Nektarios,

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:

Code:
(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:

Code:
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: PROP=0
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: PROP=0
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.
Thanks!


- lobothefoots - 2012-03-01

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.


- schoon - 2012-03-02

Hi,

Have you found a solution to your problem?
In advance thank you.


- lobothefoots - 2012-03-04

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