Kodi Community Forum

Full Version: MCE Remote - Two buttons doing the same action
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I really need your help on this one as i tried evrything i could think off after reading and reading, but i am really stuck.

I have a Logitech Smart Control used on my chromebox runing Openelec. It is coinfigured as a basic RC6 MCE device trough an IR dongle recognized as an ehome infrared receiver... The basic stuff.

The problem i have is two buttons which send two different scancodes are mapped to the same keymap (KEY_SUBTITLE).
If i kill eventlirc and check trough ir-keytable evrything is fine : the two butons are recognized as KEY_TITLE and the other as KEY_SUBTITLE.
But restarting eventlircd and checking via IRW the two buttons are remapped to KEY_SUBTITLE. Same if i check the Kodi Log (which is normal at that point).

Do someone know how i could fix this or at least in which direction i should look at as i can't figure out where this remaping takes place. Is it in the Lircd.conf files, is it in the eventlircd.d evmap files ? or is it hardcoded somewhere else ?

Any help most greatly appreciated Big Grin
assign one of the buttons to a different command that you don't use in the logitech harmony settings - using the app is the easiest way.

then use the keymapper add on to make this key do whatever you want it to do. that is the easiest way to do it, just make sure to choose global in the keymapper and you can use that add on to assign that keypress to anything you want.
Thanks for answering.

But the idea is to get the most usable scancodes harmony can provide.
This key isn't even attributed in the harmony app, but i don't have a lot spare scancodes. Two keys (dot and exit) have the same scancode as hash and back, and channelprev doesn't send any recognized scancode.

But This one key (subtitle in the harmony app) is mapped (ir keytable) to Key_Title, but it seems that ircode.evmap does a remap of this key (key_title=key_subtitle).

I tried to "relink" my remote using custom evmap file assigned via custom 98_eventlircd.rules and loaded through autostart using eventlircd --evmap=/storage/.config/eventlirc.d
But doing so the evmap seems to load, but it breaks something as irw doesn't respond anymore and in kodi just the arrow keys work...
Maybe i should try to explicitely set a lirc socket in my autostart command ?
Well i solved this and it's Openelec related, but anyway it could be of some use, so i share it here.


The problem was indeed the Evmap map used by Eventlircd.

By using this and replacing X by your device ID

Code:
udevadm info -q all /dev/input/eventX

One can see the evmap loaded.

In my case it was ircode.evmap which indeed remapped the KEY_TITLE to KEY_SUBTITLE.

The basic idea is to create as specific evmap file for the remote that will be used instead of ircode.evmap.
(it could be more easy to alterate directly ircode in place but, it's Openelec, so "permission denied" Wink )

1. Copy all the evmap files (yes all, as we will redirect the evmap folder to a new one and some evmap are used even if we create a new one.) from /etc/eventlircd.d to storage/.config/eventlircd.d (create the folder first if needed)

2. ssh

Code:
ir-keytable
and check vendor/product (mine is 147a:e03e) then create a evmap file in storage/.config/eventlircd.d like so 03_147a_e03e.evmap (replace 147a and e03e by your values).

3. Open this file and copy paste the content of ircode.evmap (or the one used by your device of course). and make the alteration you need. I just replaced KEY_TITLE = KEY_SUBTITLE by KEY_TITLE = KEY_TITLE in my case. Save the file.

4. Now we need to modify 98-eventlircd.rules to create a new device (147a:e03e in my case).
But again it's openelec so no way to modify this file in place. So copy it from /usr/lib/udev/rules.d to /storage/.config/udev.rules.d (this folder already exist and is made for that purpose BTW).

5. Open 98-eventlircd.rules and locate these lines
Code:
ENV{ID_VENDOR_ID}=="0bc7", ENV{ID_MODEL_ID}=="0006", \
  ENV{eventlircd_enable}="true", \
  ENV{eventlircd_evmap}="03_$env{ID_VENDOR_ID}_$env{ID_MODEL_ID}.evmap"
Copy them above and replace 0bc7 by 147a and 0006 by e03e (in my case, but use your vendor/product we found earlier of course).
Save it.

6. We are almost done.
As Openelec as no way to automatically redirect evmaps to the folder we created (it can do it for udev.rules.d, rc_keymaps and others, but not evmap ! which is a limitation i think), we will need an autostart script to manually kill eventlircd then reload it with the correct path.
Create an autostart.sh (if you don't use one) in /storage/.config with this code
Code:
#!/bin/sh

killall eventlircd;
sleep 1;
/usr/sbin/eventlircd --evmap=/storage/.config/eventlircd.d --socket=/run/lirc/lircd --release=:_UP &

7. Reboot and that should do it.
(You can check using IRW (via ssh) and press the buttons : you should see the correct key names now).

Now why i don't use parenthesis in the autostart ? because kodi will run first, then eventlircd will be killed (no remote), then it will be restarted and it will works again but it takes time. If you don't shutdown your device and use suspend instead that's not a problem though.
Why i added a 1 second delay. Well this one was tricky in fact, but it takes "time" when eventlircd is killed for it to release the socket or whatever he is handling (or is it beacause other thins happen in the background, who knows ?), so we need that delay before restarting it.
i use /usr/sbin/eventlircd to be on the safe side, but it could work also without the full path. I don't know... it works, so let be it.

That's it guys, hope it will helps.
(2015-07-01, 15:22)Namoi Wrote: [ -> ]Well i solved this and it's Openelec related, but anyway it could be of some use, so i share it here.


The problem was indeed the Evmap map used by Eventlircd.

By using this and replacing X by your device ID

Code:
udevadm info -q all /dev/input/eventX

One can see the evmap loaded.

In my case it was ircode.evmap which indeed remapped the KEY_TITLE to KEY_SUBTITLE.

The basic idea is to create as specific evmap file for the remote that will be used instead of ircode.evmap.
(it could be more easy to alterate directly ircode in place but, it's Openelec, so "permission denied" Wink )

1. Copy all the evmap files (yes all, as we will redirect the evmap folder to a new one and some evmap are used even if we create a new one.) from /etc/eventlircd.d to storage/.config/eventlircd.d (create the folder first if needed)

2. ssh

Code:
ir-keytable
and check vendor/product (mine is 147a:e03e) then create a evmap file in storage/.config/eventlircd.d like so 03_147a_e03e.evmap (replace 147a and e03e by your values).

3. Open this file and copy paste the content of ircode.evmap (or the one used by your device of course). and make the alteration you need. I just replaced KEY_TITLE = KEY_SUBTITLE by KEY_TITLE = KEY_TITLE in my case. Save the file.

4. Now we need to modify 98-eventlircd.rules to create a new device (147a:e03e in my case).
But again it's openelec so no way to modify this file in place. So copy it from /usr/lib/udev/rules.d to /storage/.config/udev.rules.d (this folder already exist and is made for that purpose BTW).

5. Open 98-eventlircd.rules and locate these lines
Code:
ENV{ID_VENDOR_ID}=="0bc7", ENV{ID_MODEL_ID}=="0006", \
  ENV{eventlircd_enable}="true", \
  ENV{eventlircd_evmap}="03_$env{ID_VENDOR_ID}_$env{ID_MODEL_ID}.evmap"
Copy them above and replace 0bc7 by 147a and 0006 by e03e (in my case, but use your vendor/product we found earlier of course).
Save it.

6. We are almost done.
As Openelec as no way to automatically redirect evmaps to the folder we created (it can do it for udev.rules.d, rc_keymaps and others, but not evmap ! which is a limitation i think), we will need an autostart script to manually kill eventlircd then reload it with the correct path.
Create an autostart.sh (if you don't use one) in /storage/.config with this code
Code:
#!/bin/sh

killall eventlircd;
sleep 1;
/usr/sbin/eventlircd --evmap=/storage/.config/eventlircd.d --socket=/run/lirc/lircd --release=:_UP &

7. Reboot and that should do it.
(You can check using IRW (via ssh) and press the buttons : you should see the correct key names now).

Now why i don't use parenthesis in the autostart ? because kodi will run first, then eventlircd will be killed (no remote), then it will be restarted and it will works again but it takes time. If you don't shutdown your device and use suspend instead that's not a problem though.
Why i added a 1 second delay. Well this one was tricky in fact, but it takes "time" when eventlircd is killed for it to release the socket or whatever he is handling (or is it beacause other thins happen in the background, who knows ?), so we need that delay before restarting it.
i use /usr/sbin/eventlircd to be on the safe side, but it could work also without the full path. I don't know... it works, so let be it.

That's it guys, hope it will helps.
Wow you certainly know your stuff half of what you wrote there has gone way over my head lol...
I can't even figure out why I'm struggling with my USB MCE remote only starting every now and again one day it will boot the next day not.
I gave up in the end and use a app now lol
TBH i didn't even know what Eventlircd was two weeks ago Wink

And for your remote, hum, maybe you're using a "bad" MCE Remote or "bad" receiver. On Openelec, "genuine" RC6 MCE remote works out of the box.

My problem was that the Title key doesn't exist on a basic MCE remote (it's why i think it was remapped to subtitle in Openelec), but the harmony app provided the possibility to use this key so it was a waste not to be able to use it because of this remapping.

A good one (which works on windows too of course) is this one

http://www.aimpro21.com/prod_rc118.asp

it's old stuff (recommended by the wiki BTW) and inexpensive too, but it works pretty well and it comes bundled with this receiver which is also rock solid

http://www.aimpro21.com/prod_ir605.asp

Of course there are other remotes which works pretty well too.
(2015-07-01, 16:23)Namoi Wrote: [ -> ]TBH i didn't even know what Eventlircd was two weeks ago Wink

And for your remote, hum, maybe you're using a "bad" MCE Remote or "bad" receiver. On Openelec, "genuine" RC6 MCE remote works out of the box.

My problem was that the Title key doesn't exist on a basic MCE remote (it's why i think it was remapped to subtitle in Openelec), but the harmony app provided the possibility to use this key so it was a waste not to be able to use it because of this remapping.

A good one (which works on windows too of course) is this one

http://www.aimpro21.com/prod_rc118.asp

it's old stuff (recommended by the wiki BTW) and inexpensive too, but it works pretty well and it comes bundled with this receiver which is also rock solid

http://www.aimpro21.com/prod_ir605.asp

Of course there are other remotes which works pretty well too.
Thanks for the link I think maybe I do need a new receiver.
But I don't want the remote to go with them as I bought one of these
http://www.amazon.co.uk/One-For-All-Esse...B003NSIE40
And it has a learn function which I used to copy the cheap MCE remote and receiver so then I can use the one remote control for my Sky tv and Kodi.
You've a new receiver work with this do you think?
I tried to Google it but i couldn't find info about the potocol it uses. The receiver i showed you is RC6 protocol based, so if your remote doesn't use it (or should i say, if the receiver it came from) this one won't work.

Here is a link about this particular remote here in this forum.
Maybe you should have a look first. I didn't had time to dig in it.

192758 (thread)

Edit: look at the third post.
(2015-07-01, 22:39)Namoi Wrote: [ -> ]I tried to Google it but i couldn't find info about the potocol it uses. The receiver i showed you is RC6 protocol based, so if your remote doesn't use it (or should i say, if the receiver it came from) this one won't work.

Here is a link about this particular remote here in this forum.
Maybe you should have a look first. I didn't had time to dig in it.

192758 (thread)

Edit: look at the third post.
Thanks for that mate looks helpful that I will have a proper read tomorrow when I have more time.
I have the manual for my remote I'm sure it will tell me what protocol it uses
Thanks again
Edit : I've just realised I'm talking to you in 2 different forums lol
I use the tapatalk app so not sure which forum I'm on half the time Smile