Pi2 B with RC6 remote duplicates key events

I am using a RC6 MCE remote. Every button I press on the remote is executed twice in OSMC. For example when I press “one down” OSMC executes two down. One way to repair this is to login and disable the following module:

rmmod ir_rc6_decoder

It doesn’t make a difference whether the link /etc/lirc/lircd.conf points to lircd-full.conf or rc6-mce-lircd.conf.
What is the permanent and “correct” way to get rid of the double key event?
Using Linux osmc 3.18.13-1-osmc #1 SMP PREEMPT Sun May 17 18:50:26 UTC 2015 armv7l GNU/Linux

What sort of RC6 remote do you have ? Can you provide a photo of it and the model number ? What type of IR receiver are you using ?

The rc6-mce-lircd profile is now deprecated - basically it was found to cause double presses on some remotes because there are multiple rc6 profiles in the same file with overlapping button codes, and lircd doesn’t handle this properly.

The same issue affects the xbox 360 universal media remote which has a profile in rc6-mce-lircd. Because of this I created a separate xbox 360 profile (which you’ll get if you run updates) which works properly for that remote - no duplicate button presses, plus I’ve fixed up some of the button mapping.

However I don’t have access to any of the other remotes that are supported by the rc6 profile to test with so I haven’t split out any of the others out of that file yet.

If you can, can you try testing each individual profile in rc6-mce-lircd to find which one is the correct one for your remote and whether the button mappings are correct ?

To do this copy the file from /etc/lirc to your osmc home directory then use a text editor to delete all but one of the profiles from the conf file, save those changes then select it through the browse option in remotes. You should find that when you have the correct one on its own you won’t get duplicate button presses.

If you can identify which one is the correct section, confirm the button mappings are correct (and if not tweak them so they are) and provide a photo and model number of the remote and any changes you made to the button mappings I’ll add a new specific entry for that remote to our remote database.

I have a remote marked RC6 that came with a Hauppauge PVR150 or with the XP MediaCenter I bought way back.
I have copied the mceusb_hauppauge profile to a separate custom-lircd.conf file in ~ and found that all keys work. irw produces the following output:

166 0 KEY_INFO linux-input-layer
166 0 KEY_INFO_UP linux-input-layer
16d 0 KEY_EPG linux-input-layer
16d 0 KEY_EPG_UP linux-input-layer
67 0 KEY_UP linux-input-layer
67 0 KEY_UP_UP linux-input-layer
e2 0 KEY_MEDIA linux-input-layer
e2 0 KEY_MEDIA_UP linux-input-layer

Now there are three things that are mixed up but I’m note sure how to fix:

  1. the “power” button (KEY_SLEEP) is has no function. Though a Raspberry Pi2 B is designed to be an all-on device, I’d prefer this to bring up the Power menu where I can choose to reboot.
  2. The “guide” button brings up the context menues. This should be a function of the “more” button (at least it is in WMC).
  3. The “more” button directly links to “Program Information” which is reachable via the context menu.
    So I’d prefer the following:
  4. “power” shows the Power menu with the reboot option (among other),
  5. “EPG” to show the Live TV | Guide
  6. “More” to work as a context menu button.

How would I do that?

Bottom view

There is already a separate profile for this remote - have you tried it ?

Edit: sorry it’s a PVR350, but I would still try it to see if it works.

I have tried the pvr350 profile. It also work - even the 4 buttons that are not present in the pvr350 remote. The profile has the same issues, though, as the mceusb profile. Same remarks apply:

  1. “Power” to show the Power menu with the reboot option (among other),
  2. “EPG” to show the Live TV | Guide,
  3. “More” to work as a context menu button.

Ok well we may as well use the pvr350 profile as a starting point then.

Regarding the power button - there is no way to do what you ask (bringing up the power menu directly, but not powering down) by only editing a lircd.conf file - because there are no mappings in Lircmap.xml in the linux-input-layer section to bring up this menu. (That I know of anyway)

To do this you would need to customise either Lircmap.xml or more probably remotes.xml to change the power button action to bring up that menu instead.

I see in that lircd.conf that the power button is mapped to KEY_POWER2 - this will not do anything (no matching entry in Lircmap.xml) so it should be changed to KEY_POWER. This will trigger an immediate shutdown when you press the button, to change it to bring up a menu instead you will need a custom remote.xml as well.

To change the mappings of the EPG and MORE buttons, you want to monitor the key events using either irw or tail the kodi log in debug mode. Press the button that currently does the function you want and note what KEY_ code it sends. Press the button that you want to do this function instead and see what KEY_ code it sends, then edit the codes in the lircd.conf file.

For the change to take effect re-select the remote in remotes or:

sudo systemctl restart lircd_helper@*

I understand that the lircd.conf maps the scancodes to keys. I agree that I will need to change the key-action-mappings to change behaviour of the POWER and EPG button. So my next step is to identify the necessary files. I am, though, too dumb to find either remotes.xml or lircmap.xml. Googling kodi wiki/forums for information I found hints to look in ~/.kodi/userdata - but no luck:

osmc@osmc:~/.kodi/userdata$ find  . -name \*.xml
./passwords.xml
./RssFeeds.xml
./guisettings.xml
./addon_data/script.module.osmcsetting.updates/settings.xml
./addon_data/plugin.video.ardmediathek_de/settings.xml
./addon_data/script.module.osmcsetting.apfstore/settings.xml
./addon_data/script.skinshortcuts/settings.xml
./addon_data/script.module.osmcsetting.pi/settings.xml
./addon_data/pvr.wmc/settings.xml
./addon_data/pvr.mythtv/settings.xml
./addon_data/plugin.video.youtube/settings.xml
./profiles.xml
./peripheral_data/rpi_2708_1001.xml
./sources.xml

Where can I find the configuration files (or default templates) for osmc on Raspberry Pi2?

The default Lircmap.xml is at /usr/share/kodi/system/Lircmap.xml and the default remote.xml is at /usr/share/kodi/system/keymaps/remote.xml.

You would put custom versions of these at /home/osmc/.kodi/userdata/ and /home/osmc/.kodi/userdata/keymaps/ respectively.

With remote.xml you only need to add the entries you’re customising, you don’t need to copy the entire file - although you can certainly do that and then trim out the stuff you’re not changing.

I’m not sure whether Lircmap.xml works the same way or whether you need to copy (then customise) the entire file, as I haven’t tried this myself. I would tend to leave Lircmap.xml alone if you can make the necessary customisations purely with remote.xml.

The Lircmap.xml looks like total chaos.

  1. the device=“MCE_via_iMON” does not map to any name tags in /etc/lirc (my first expectation)
  2. the IR key identifiers sometimes are KEY_0, sometime “0”. I am wondering where the keys are defined?
    I will work with remote.xml for the tie being.

Yep. :slight_smile: But that’s the default Lircmap.xml that ships with all versions of Kodi.

Just ignore that one. As I said earlier - we remap all remote names to “linux-input-layer” in eventlircd - which you will see when you run irw. So only the linux-input-layer section of Lircmap.xml is relevant.

Linux uinput button names are defined in the Linux kernel, so you have to use one that is valid or it gets filtered out by the kernel.

Since only those that are defined in linux-input-layer in Lircmap.xml are being used, those are the only ones you need worry about.

Have a look at the xbox360 profile I made for an example of a profile that has most of the buttons mapped.

Using irw I mapped the most important keys of my RC6. Some keys - like KEY_EPG - require remapping.

KEY_SLEEP    Power            

KEY_TV        My TV            
KEY_AUDIO    My Music
KEY_CAMERA    My Pictures
KEY_VIDEO    My Videos

KEY_STOP    Stop
KEY_PLAY    Play

KEY_REWIND    Rewind
KEY_FASTFORWARD    Forward
KEY_PREVIOUS    Replay        KEY_CHANNELDOWN
KEY_NEXT    Skip            KEY_CHANNELUP
KEY_EXIT    Back            ok
KEY_INFO    More            ContextMenu

KEY_OK

KEY_MEDIA    GreenButton
KEY_MUTE    Mute

KEY_PVR        Recorded TV        
KEY_EPG        Guide            ActivateWindow(TVGuide)
KEY_TUNER    LiveTV            
KEY_DVD        DVD Menu

KEY_NUMERIC_1    1
...

KEY_SUBTITLE    Teletext

I’ve made some changes and stored the custom files in /home/osmc/.kodi/userdata but the remote behaviour doesn’t change. I’ve rebooted the Raspberry after making the changes.

Any idea what I need to do to apply the changes?

osmc@osmc:~/.kodi/userdata$ diff Lircmap.xml /usr/share/kodi/system/Lircmap.xml
453d452
<                 <power>KEY_SLEEP</power>
osmc@osmc:~/.kodi/userdata$ diff keymaps/remote.xml /usr/share/kodi/system/keymaps/remote.xml
58,59c58,59
<       <title>ActivateWindows(TVGuide)</title>
<       <info>ContextMenu</info>
---
>       <title>ContextMenu</title>
>       <info>Info</info>
69c69
<       <power>ActivateWindow(Power)</power>
---
>       <power>ShutDown()</power>
184,185c184,185
<       <forward>ChapterOrBigStepForward</forward>
<       <reverse>ChapterOrBigStepBack</reverse>
---
>       <up>ChapterOrBigStepForward</up>
>       <down>ChapterOrBigStepBack</down>
194,195c194,196
<       <guide>ActivateWindow(TVGuide)</guide>
<       <subtitle>ActivateWindow(Teletext)</subtitle>
---
>       <guide>ActivateWindow(PVROSDGuide)</guide>
>       <teletext>ActivateWindow(Teletext)</teletext>
>       <subtitle>NextSubtitle</subtitle>

Similar to @DBMandrake, I am also using an Xbox 360 DVD remote.

I have set mine up to open the power menu when I press KEY_POWER. And then close the menu if I press KEY_POWER again. The relevant changes to remote.xml were:

  1. set power button to activate shutdown menu under normal circumstances:

       ... snip ...
    
       <!--   <power>ShutDown()</power>   -->
       <power>ActivateWindow(shutdownmenu)</power>
    
  2. set power button to go back (close shutdown menu), whenever shutdown menu is open:

    PreviousMenu PreviousMenu

Instead of modifying custom xmls in ~/.kodi/userdata I have tried /user/share/kodi/system with success. EPG and Info button work as desired - except for some edge cases when watching LiveTV. I will fiddle with the remote.xml until everything works and then post the files here.

If you only edit the custom mappings in this location without creating the custom maps in the userdata directory, your custom mappings will be overwritten and lost next time Kodi is updated. Custom mappings in userdata will persist even through an update.

Solved it:

Start with : sudo apt-get install ir-keytable
Make a file sudo nano /etc/systemd/system/script.service containing:

[Unit]
Description=Disable duobleclicks with remote
After = remote-fs.target network-online.target mediacenter.service

[Service]
User=osmc
Group=osmc

Type=simple
ExecStart=/var/scripts/remote.sh
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

and then sudo mkdir /var/scripts and sudo nano /var/scripts/remote.sh containing:

#!/bin/sh
#sudo rmmod ir_rc6_decoder
sudo ir-keytable -p lirc
exit 0

change filerights sudo chmod x /var/scripts/remote.sh
last thing: sudo systemctl enable script.service
reboot and it works :grinning:

Hi,

The issue of the RC6 kernel decoder loading automatically is on our to-do list to fix, we just haven’t had a chance to look at it yet. In the meantime you can do what you have above (although putting it in /etc/rc.local is probably sufficient rather than creating a service)

Also it’s possible to disable the decoder using ir-keytable (this is discussed in another thread) but unloading the module will work too.

I chose this solution, because I didn’t want to mess with kernel modules by automation and as a service because you can enable/disable it with a simple command.