Linux Cannot change LIRC IR remote actions
#1
Hi,

I'm setting up a HTPC with Kodi for a friend and have a problem with his infrared (IR) remote. I have LIRC installed and running, and most keys work. Some however don't work correctly (most notably the back key) and some not at all. The former show up if I try with irw and they even show up in kodi.log as LIRC input, but they don't cause any action. The nonworking ones shall be ignored for the moment as they're not really important (yellow, blue buttons and such).

Thus, I figured I had to set up a custom ~/.kodi/userdata/keymaps/keymap.xml, and have done so like this:

Code:
<keymap>
  <global>
    <remote>
      <back>PreviousMenu</back>
    </remote>
  </global>
</keymap>

irw shows me when I press the back key multiple times:

Code:
falko@htpc:~/.kodi/temp$ irw
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
000000008001009e 00 KEY_BACK devinput
^C

If I start Kodi, go to the settings screen and press the back key multiple times, nothing happens. kodi.log however indicates the input is received:

Code:
12:28:48.569 T:140308100778368   DEBUG: LIRC: Update - NEW at 21103:000000008001009e 00 KEY_BACK devinput (KEY_BACK)
12:28:49.331 T:140308100778368   DEBUG: LIRC: Update - NEW at 21865:000000008001009e 00 KEY_BACK devinput (KEY_BACK)
12:28:49.996 T:140308100778368   DEBUG: LIRC: Update - NEW at 22530:000000008001009e 00 KEY_BACK devinput (KEY_BACK)

I'm clueless on what to do now. Information on the system:
  • OS: Ubuntu 16.04 Xenial Xerus, up to date as of 2017-09-11.
  • Kodi version: 2:17.4+git20170822.1009-final-0xenial
  • Full kodi log: https://pastebin.com/6QLwyLsZ
  • uname -a: Linux htpc 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Kodi was installed via the team-xbmc/ppa PPA.
  • There are two addons installed. Keymap Editor and TVHeadend PVR. I have deleted anything Keymap editor generated in ~/.kodi/userdata/keymaps before I obtained the above information and before I added my own keymap.xml.
  • The IR remote is a cheap one found on ebay. It identifies to lsusb like this: Bus 001 Device 002: ID 0471:0613 Philips (or NXP) Infrared Transceiver
  • The IR remote is listed in /dev as /dev/input/by-id/usb-PHILIPS_MCE_USB_IR_Receiver-_Spinel_plus-event-ir and is configured in LIRC via the generic Linux devinput driver.

What do I need to do to make the back key work?
Reply
#2
Hi,

I guess some button names in the keymap.xml are wrong, and thus no action is performed.

1. Can you see the Lirc event (button-press) in the kodi.log (debug!)? There should be the correct name and actions of the remote keys pressed. Or, if theres no output for a button, you know something is wrong with your lirc config (if the same button is working in irw though, something is very strange).

2. Do you have a lircmap.xml in \home\.kodi\userdata\ ?

For me it looks like this:

Code:
<lircmap>
    <remote device="devinput">
        <left>KEY_LEFT</left>
        <right>KEY_RIGHT</right>
        <up>KEY_UP</up>
        <down>KEY_DOWN</down>
        <select>KEY_ENTER</select>
        <back>KEY_BACKSPACE</back>
        <record>KEY_R</record>
        <play>KEY_P</play>
        <pause>CTRL_KEY_P</pause>
        <stop>KEY_S</stop>
....
</lircmap>

Info: http://kodi.wiki/view/LIRC#lircmap.xml

My remote sends Keyboard-presses so i have to configure the button names that will be sent to kodi.
Structure is:

<kodi-button-name>IRW_BUTTON_NAME</kodi-button-name>

In your case there you can try and insert <back>KEY_BACK</back>, if all the other keys on your remote are working out of the box you can just leave it with that one entry.

good luck, cheers
Reply
#3
First, get to a Linux command prompt and run this:

sudo dpkg-reconfigure lirc

A menu should appear. On the first screen scroll all the way down until you see something like Windows MCE compatible - I forget the exact phrase but it starts with Windows, and you want to pick the Media Center Edition compatible (MCE) setting since your remote is identifying as MCE (PHILIPS_MCE_USB_IR).

You don't have a transmitter so pick none in that menu.

After you have made those choices your remote should send the correct codes and Kodi should recognize them. You may have to back out any changes you have made (you should NOT need to have a custom ~/.kodi/userdata/keymaps/keymap.xml). When you say "I have deleted anything Keymap editor generated in ~/.kodi/userdata/keymaps" you may have screwed yourself royally by doing that, if it still doesn't work you may need to totally remove and reinstall unless you backed up what you deleted (NEVER just delete stuff unless you are absolutely sure what you are doing, at the very least move it to a different directory until you are sure you don't need it). I would not be surprised if you now need to reinstall Kodi from scratch (if you do, rename the ~/.kodi directory first so Kodi will create a new one, hopefully including the files you removed).

Pro tip: Never install LIRC from the Ubuntu software center because it will not show you the configuration menu. Always use sudo apt install lirc instead.

I know LIRC works fine with Kodi 17.4 and Ubuntu 16.04 because we just put that on a system a couple of weeks ago. If you still have problems you may have an extra "dummy" IR device in your system - run sudo ir-keytable and make sure it only shows one IR device. If it shows more than one, edit /etc/modprob.d/blacklist.conf and add a line to blacklist the extra device (example: blacklist ite_cir), then reboot.
Reply
#4
(2017-09-11, 12:59)2thestars Wrote: Hi,

I'm setting up a HTPC with Kodi for a friend and have a problem with his infrared (IR) remote. I have LIRC installed and running, and most keys work. Some however don't work correctly (most notably the back key) and some not at all. The former show up if I try with irw and they even show up in kodi.log as LIRC input, but they don't cause any action. The nonworking ones shall be ignored for the moment as they're not really important (yellow, blue buttons and such).

Thus, I figured I had to set up a custom ~/.kodi/userdata/keymaps/keymap.xml, and have done so like this:

This is wrong. For Lirc you have to edit remote.xml
Reply
#5
You may also want to look into creating a Lircmap.xml. It lives in the root of userdata (not in keymaps), and maps the button names from your lircd.conf to the names that Kodi uses for remote.xml. For the remotes I use, I always create one, so I can use the same remote.xml, and the Lircmap.xml takes care of the lirc <-> Kodi mapping of button names.

http://kodi.wiki/view/LIRC#lircmap.xml
Reply
#6
Okay, I don't understand why you guys are creating extra files. I install LIRC, make sure it is configured to recognize a Windows MCE remote, and it just works, except on the systems where I have to blacklist a fake IR device. I have never created a remote.xml or a Lircmap.xml and it still just works. I have created a ~/.lircrc file, but only so I can map button presses that take effect outside of Kodi (for example, to start Kodi, or to reboot the system). If I had some other way to start Kodi I would not even need that, because once Kodi is up all the button presses work. So why on earth would you need or want a remote.xml or Lircmap.xml or whatever?

Is there some advantage to creating one or both of these files when using a Windows MCE compatible remote that I'm not aware of? I understand that such files may be needed with other types of remotes, but Kodi has never had a problem with a Windows MCE compatible remote that I am aware of. If there is some advantage, is there a web page somewhere that describes what you are doing?

EDIT: Forgot to mention that I also add irexec (irexec -d) to Ubuntu's startup manager, but IIRC that is only needed to recognize the ~/.lircrc file I mentioned above. Anyway, everything works the way I want it to.
Reply
#7
(2017-09-11, 20:29)FernetMenta Wrote:
(2017-09-11, 12:59)2thestars Wrote: Hi,

I'm setting up a HTPC with Kodi for a friend and have a problem with his infrared (IR) remote. I have LIRC installed and running, and most keys work. Some however don't work correctly (most notably the back key) and some not at all. The former show up if I try with irw and they even show up in kodi.log as LIRC input, but they don't cause any action. The nonworking ones shall be ignored for the moment as they're not really important (yellow, blue buttons and such).

Thus, I figured I had to set up a custom ~/.kodi/userdata/keymaps/keymap.xml, and have done so like this:

This is wrong. For Lirc you have to edit remote.xml
As I understand it - as long as it's an .xml and it's in userdata/keymaps it doesn't matter what it's called. Any .xml files in there are read in alphabetical order. That isn't specific to LIRC.
Reply
#8
@troggy: Correct. My remote keymap file is not named remote.xml, and it works fine.

@xbmclinuxuser: In general this is true. However, my remotes have some additional keys that aren't properly mapped by the MCE lircd.conf, so I have a custom lircd.conf file for each different type of IR receiver I use across my household. Then, I can create a single Lircmap.xml that maps whichever remote/receiver in use on the system to Kodi, meaning I can keep a single file that I copy to new installations that will work regardless of the host system's hardware. In this way, everything is consistent from a UX perspective, even if the underlying hardware is different. (I have nuvoton, meson and rc6 receivers across several machines. I have a single 'userdata' folder that I copy to new Kodi installs that works, irrespective of the system I'm setting up.)
Reply
#9
rpcameron, I get why you are using that file then. I was just trying to make it clear for the OP (and anyone else that might wander across this thread) that you normally don't need to set up any kind of custom keymap file just to get a basic MCE-compatible remote to work inside of Kodi. You may need to use some type of additional file if you have a remote with extra keys (as in your case), or if ithe remote is almost but not quite MCE compatible, or if you want the remote to be able to do things when Kodi isn't running (such as start Kodi, with or without options) but at the very least a MCE compatible remote should mostly work inside Kodi with no additional files needed.

For some reason the OP thought he should create a keymap.xml file, install a Keymap Editor addon, and then remove files from ~/.kodi/userdata/keymaps, when he probably shouldn't have done any of those, at least not until he had his remote working at a basic level. I am not at all surprised that some of his remote keys aren't working as expected.
Reply
#10
Wow, so many replies in such a short time O_o. Thanks to everybody!

Funky_Funked Wrote:Can you see the Lirc event (button-press) in the kodi.log (debug!)?

Yes I can. See the full debug log I already posted: https://pastebin.com/6QLwyLsZ

Funky_Funked Wrote:Do you have a lircmap.xml in \home\.kodi\userdata\ ?

No, I don''t have one.

Funky_Funked Wrote:In your case there you can try and insert <back>KEY_BACK</back>,

Creating that Lircmap.xml and inserting this (in proper XML skeleton of course) does not change anything. I have even tried to do a full custom mapping with irrecord and then manually mapping all the keys with Lircmap.xml, but it's always the same keys that are failing.

xbmclinuxuser Wrote:On the first screen scroll all the way down until you see something like Windows MCE compatible - I forget the exact phrase but it starts with Windows, and you want to pick the Media Center Edition compatible (MCE) setting since your remote is identifying as MCE (PHILIPS_MCE_USB_IR).

This sounds like a promising approach. I had tried an entry saying something with "Philips" in it before, but that failed completely, not a single key worked. I will try this suggestion once I get back to the machine. I am on vacation for about 1,5 weeks from now on, so I don't have access to the machine until I return. I will report back once I can try your suggestion.

xbmclinuxuser Wrote:You don't have a transmitter so pick none in that menu.

I have already picked that. Though it does say it is a "transceiver", so isn't that a transmitter + receiver?

xbmclinuxuser Wrote:, if it still doesn't work you may need to totally remove and reinstall unless you backed up what you deleted (NEVER just delete stuff unless you are absolutely sure what you are doing, at the very least move it to a different directory until you are sure you don't need it).

I have a complete backup copy of my ~/.kodi directory before I made any changes related to the IR remote.

xbmclinuxuser Wrote:Pro tip: Never install LIRC from the Ubuntu software center because it will not show you the configuration menu. Always use sudo apt install lirc instead.

I'm comfortable with the Linux commandline. I've actually never installed anything from Ubuntu software center, always used the commandline.

xbmclinuxuser Wrote:For some reason the OP thought he should create a keymap.xml file, install a Keymap Editor addon, and then remove files from ~/.kodi/userdata/keymaps, when he probably shouldn't have done any of those, at least not until he had his remote working at a basic level. I am not at all surprised that some of his remote keys aren't working as expected

Nothing on a computer happens magically (unless you're Google and doing Big Data). I am a programmer, and if required, I can take a look at Keymap Editor's source code and see what it does. From my observations without a look into the source code, it simply generates XML files inside ~/.kodi/userdata/keymaps (a directory which is empty after a vanilla installation and first start/shutdown), which corresponds do what the wiki says about manual modification of the keymap. I felt safe enough in my conclusion to try things around. Restoring the backup directory has the same effect as deleting the XML files in there -- they keys work to the extend described in the first post of this thread.
Reply
#11
I successfully had a remote working devinput, both with and without lirc, outside of Kodi. However, it seemed that Kodi was doing its own weird mapping of the keynames that differed from what ir-keytable was spitting out. It wasn't reacting to the keypresses, regardless of whether my actions were defined in keyboard or remote elements of keymap.xml.

I eventually gave up on getting Kodi to work with devinput and went the route of using lirc's default driver and the old standard of /dev/lirc0. Part of the problem may be that I wasn't using systemd-uinput, or that I use libinput rather than evdev. Whatever the case, I found a suitable solution, but there are still problems with the way Kodi handles some things I think.
Reply

Logout Mark Read Team Forum Stats Members Help
Cannot change LIRC IR remote actions0