Problem Mapping a button in LIRC, Lircmap.xml and remote.xml

Hi guys, this is my first time posting here so first of all thank you for all the help I’ve got from these forums upto date! Secondly I’m relatively new to OSMC and even Linux but am learning and loving it, so go easy on me.

My goal in short:

To map a favourites button on my remote to bring up the favourites menu in OSMC. (I believe it’s possible)

What I’ve got:

I have an old remote from a cable box (made my Cisco I believe) which I’m using with my rpi2 via a GPIO IR receiver I pulled from the same cable box. I couldn’t find any .conf files for it so I’ve “recorded” the remote and all basic buttons work great. There is a “fav” button on the remote that I’d like to bring up the favourites menu on OSMC which is where I’m stuck.

What I’ve done so far:

I’ve recorded the favourites button when recording the remote so I have a line in my .conf file as below:

KEY_FAVORITES 0x129D

(There is a couple of different spellings of favourites / favorites I’ve noticed, when recording the remote its favorites but in OSMC It’s spelt favourites, with the U)

If I run IRW And press the “fav” button on my remote I’ll get:

16c 0 KEY_FAVORITES linux-input-layer
16c 0 KEY_FAVORITES_UP linux-input-layer

I’ve copied my Lircmap.xml file to /home/osmc/.kodi/userdata/

I’ve added a favourites line to that file under the Linux-input-layer, part of it as below:

 <remote device="linux-input-layer">
        <altname>cx23885_remote</altname>
                <left>KEY_LEFT</left>
                <right>KEY_RIGHT</right>
                <up>KEY_UP</up>
                <down>KEY_DOWN</down>
                <favourites>KEY_FAVORITES</favourites>

I’ve copied my remote.xml file to /home/osmc/.kodi/userdata/

I’ve added a favourites line to that file under the first global section as below:

<keymap>
  <global>
    <remote>
      <play>PlayPause</play>
      <pause>Pause</pause>
      <stop>Stop</stop>
.....
      <favourites>ActivateWindow(Favourites)</favourites>
      <myvideo>ActivateWindow(MyVideos)</myvideo>
      <mymusic>ActivateWindow(MyMusic)</mymusic>
      <mypictures>ActivateWindow(MyPictures)</mypictures>
      <mytv>ActivateWindow(TVChannels)</mytv>

And that’s as far as I’ve got, still no reaction from the “fav” button when I press it. I feel like I’m so close yet so far away. Probably missing something simple. Maybe "ActiveWindow(Favourites) is wrong?

Dan

I know it doesn’t help get a solution, but the steps seem right to me (lircd.conf --> Lircmap.xml --> remote.xml).

Have you tried temporarily putting a different command there (one that you know works, from other buttons)? This might prove that the problem is the ActivateWindow(Favourites) command, and not the button mapping / setup?

I don’t see any windows ID for favo(u)rites - which would suggest you are doomed to failure.
To see if the rest is OK, I would use an entry in the remote like

<a mod="ctrl,alt">Notification(Key Pressed, Ctrl+Alt+a, 5)</a> <!--Green -->

suitably adjusted for your keyname. This shows on-screen for 5 secs when the key is pressed.
Derek

Hi berto, dandnsmith,

Yea I’ve been playing about with that idea this morning, and yea that works, if I change:

<favourites>ActivateWindow(Favourites)</favourites>

To

<favourites>Left</favourites>

Then pressing “fav” scrolls left. Which leads me to believe that the connection between lircd.conf --> Lircmap.xml --> remote.xml is working.

So as dandnsmith suggests maybe I’m trying to achieve the unacheivable! A good learning curve at least!

Although the idea started when I read somewhere else about someone doing this in the old xbmc I think, with a similar code. And these is a favourites option in the kodi wiki page on window ID’s.

windows ID’s

Isn’t it window 10134?

Yea I saw that and thought maybe it’s possible, but I don’t know to translate that info into the code I need.

I managed to break something now, kept playing with remote.xml and Lircmap.xml and now my remote does nothing :slight_smile:

I saw it as well, but it didn’t look like the entries in the table for music, videos, and pictures, so I reckoned there were some subtleties to decode.
Derek

Just to check I’m understanding things right too…

The original location for Lircmap.xml is /usr/share/kodi/system/

And for remote.xml it’s /usr/share/kodi/system/keymaps/

But if I copy Lirmap.xml to /home/osmc/.kodi/userdata/ and modify the file at that location kodi will prioritise that new modified file and use the commands I’ve written in it?

Same with remote.xml, but I wasn’t sure if that went in /home/osmc/.kodi/userdata/ or /home/osmc/.kodi/userdata/keymaps/ ? So I put it in both.

Short version, I only need to modify the files in their new locations and leave the originals alone right?

Correct. Modifying files in the system locations will only be overwritten when updates are installed.

Hey guys, I’ve actually got it working through a bit of playing about and with the suggestions I got in here! But I’ve got it working in a way I don’t quite understand and wondered if anyone could shed some light on it…

So now I can press the “fav” button on my remote and it brings up the favourites screen in OSMC. Simples :smile:

I have my Lircmap.xml file in /home/osmc/.kodi/userdata/ and my remote.xml file in /home/osmc/.kodi/userdata/keymaps/ and my lircd.conf file in /home/osmc/

So my lircd.conf is using the key KEY_FAVORITES when I pres the “fav” button on my remote.

In Lircmap.xml under the “Linux-input-layer” I add a line as follows:

<favourites>KEY_FAVORITES</favourites>

Then in remote.xml under the first global remote section I add:

<favourites>ActivateWindow(Favourites)</favourites>

Save and reboot, but my “fav” button does nothing

But if I forget adding those lines to each file and modify an existing line in each section as below:

Lircmap.xml:

<up>KEY_FAVORITES</up>

Remote.xml:

<up>ActivateWindow(Favourites)</up>

Save and reboot and low and behold my “fav” button loads up the favourites screen.

So why do my lines of <favourites>KEY_FAVORITES</favourites> and <favourites>ActivateWindow(Favourites)</favourites> not work when <up>KEY_FAVORITES</up> and <up>ActivateWindow(Favourites)</up> do work?

Interesting. Glad you got it to work!

Perhaps favourites is reserved somehow, and that’s why it was not recognized. Maybe you can use fav, which at least seems closer than up? If nobody here knows for the reason for sure, it might be interesting to post this on the kodi forums and see if you get an answer there.

Oh i tried a few, fav, favs, favor, random letters and numbers. It only works when using something already there.

I was thinking that maybe it needs to appear somewhere else in the remote.xml file, as all other commands do, up, down, left, right etc.

I’ve mapped it to <record> as ill probably never need to use a record button / command.

If i’m feeling brave i might head over to the kodi forums.

Thanks again for the help :smile: -)

Well if you ever get to the bottom of this, I’d be curious to hear more! :grinning:

It seems strange to me that you would need to “re-use” a label, because I have added non-standard entries myself. For example, I use an xbox 360 DVD remote (Xbox 360 DVD IR remote multiple repeats - #6 by DBMandrake), so I added actions for the “xbox” logo button.

In lircd.conf, I added:

KEY_VENDOR       0x0BF2

In Lircmap.xml, I added an xbox key (which did not exist anywhere else in the file):

<remote device="linux-input-layer">
<altname>cx23885_remote</altname>
	<left>KEY_LEFT</left>
	<right>KEY_RIGHT</right>
...
snip
...
	<teletext>KEY_TEXT</teletext>
	<clear>KEY_DELETE</clear>
	<xbox>KEY_VENDOR</xbox>
</remote>

And in remote.xml, I defined xbox actions (where “xbox” again was new here):

<keymap>
  <global>
    <remote>
      <play>PlayPause</play>
      <pause>Pause</pause>
...
snip
...
      <print>Screenshot</print>
      <xbox>scanitem</xbox>
    </remote>
  </global>

Other than the global section, I also further specified xbox actions depending on which screen I was on (i.e. update Music library, when in Music window; update Video library when in Video window)

  <MyMusicLibrary>
    <remote>
      <zero>Queue</zero>
      <star>Queue</star>
      <xbox>UpdateLibrary("music")</xbox>
      <record>PlayerControl(Partymode(music))</record>
    </remote>
  </MyMusicLibrary>

  <MyVideoLibrary>
    <remote>
      <zero>Queue</zero>
      <clear>Delete</clear>
      <xbox>UpdateLibrary("video")</xbox>
      <record>PlayerControl(Partymode(music))</record>
    </remote>
  </MyVideoLibrary>

This seems to work fine for my remote.

Looks like i could be opening up Lircmap and remote again then! As yea it seems to make sense that it should work, And it apparently does for you! Going by what i’ve learnt upto present with computing, it’ll probably work this time i do it and ill have no explanation as to why.

Hi,

I got the same problem, I can overload items existing in the original lircmap but not add new ones.
I see my new key with irw (KEY_ESC)
in userdata/lirmap.xml
<esc>KEY_ESC</esc>
in keymap/remote.xml
<esc>PreviousMenu</esc>
but no effect on kodi.

All new items have this problem, all moved keys (only in remote.xml) are working

Hey,

I never managed to get to the bottom of this unfortunately, i just ended up re-using some that i wasn’t using for anything else…

<record>KEY_FAVORITES</record>

<record>ActivateWindow(Favourites)</record>

I’ve sat at my desktop with notepad++ reading through each config file but couldn’t understand why the new lines weren’t working, But alas I’m still relatively new to Linux. I never tried posting in the kodi forum which was suggested as they may be able to shed some more light on it. Let me know if you manage to get to the bottom of it!

I have the same problem. I wanna map a button to toggle watched/unwatched status.
So in the lircmap I have defined a new action mywatched
<mywatched>KEY_PVR</mywatched>
And then in my remote.xml
<mywatched>ToggleWatched</mywatched>
However it does not work. But it did work like that on my previous HTPC.

Does any developer look into this? It looks like there are multiple people who confirm that it does not work to define own actions, but only using existing ones. With a previous non-osmc kodi installation I was able to do that.

So, last try to confirm the issue.
I habe a button on my remote.
In Putty via irw it shows up as KEY_PVR.
So in the Lircmap.xml I have added
<mywatched>KEY_PVR</mywatched>

And this is how the remote.xml looks like:
<keymap>
<global>
<remote>
<mywatched>ToggleWatched</mywatched>
</remote>
</global>
</keymap>

This DOES NOT work.
But, if I exchange the mywatched with e.g. teletext (a standard KODI command) in both files, it works!
Why is it not possible to use own commands? As far as I know this is generally possible in Kodi, so it is an osmc issue, right?

Can someone confirm for sure that using non standard button names like in the example with the xbox remote above worked in other distributions or earlier versions of Kodi?

Looking at the Kodi Wiki regarding LIRC, it seems like Kodi only understands the predefined button names, which would explain the described behaviour.

According to that article custom buttons have to be defined as „obc1“ through „obc254“ and can then be used as <universalremote> in the remote.xml.