Configure lirc with kodi (on Ubuntu 16.10 or higher) and still be able to use irexec
#1
Ever since ubuntu 17.04 (but perhaps also 16.10) I could not get Lirc working in Kodi.

A lot of sites on the internet told me to switch to ir-keytable, but I didn't want to because I use irexec which is part of Lirc.

In ubuntu 17.10 I still had problems to get Lirc working in combination with Kodi. I encountered the following problems:
- Not being able to control kodi with remote control at all
- Whenever a key was pressed on the remote, it was repeated indefinitely
- Lirc was working outside Kodi, but not inside Kodi.

This was I did to get it working:
1) Install Lirc
2) disable a specific Lirc service 
3) copy and adjust Lircmap.xml
4) point Kodi to the correct Lirc device

Install lirc
Quote:sudo apt-get install lirc

Test if Lirc is working
Quote:sudo irw

Now press some keys on your remote control. If Lirc is working you should be greeted with something like this:

0000000080010160 00 KEY_OK devinput-32
0000000080010160 01 KEY_OK devinput-32
000000008001006a 00 KEY_RIGHT devinput-32
000000008001006a 01 KEY_RIGHT devinput-32
0000000080010069 00 KEY_LEFT devinput-32
0000000080010069 01 KEY_LEFT devinput-32
000000008001006c 00 KEY_DOWN devinput-32
000000008001006c 01 KEY_DOWN devinput-32

Note the 4th column, this contains the device-name that registers the remote control buttons, this is necessary later on.

Disable lirc service lircd-uinput
Quote:sudo systemctl stop lircd-uinput.service
sudo systemctl disable lircd-uinput.service

For me this was necessary to stop the undef-init key-presses, after one single press on the remote. (see: 322294 (thread))

Copy default Lircmap.xml to kodi userdata folder. Mine was /root/.kodi/userdata
Quote:export kodiuserdata=<your userdata folder>
sudo cp "/usr/share/kodi/system/Lircmap.xml" "${kodiuserdata}/Lircmap.xml"

Noticed the device 'devinput-32' ? It is not in the default Lircmap.xml!! A device called devinput is mentioned!!

Execute the following command to redirect devinput to devinput-32
Quote:sudo sed -i 's/devinput/devinput-32/g' "${kodiuserdata}/Lircmap.xml" 
Direct Kodi to the correct Lirc device
make sure kodi uses the correct reference to Lirc device. I start Kodi using the following command which allows me to give the 'new' device location. (see: 314249 (thread))
Quote:/usr/bin/kodi-standalone --lircdev /var/run/lirc/lircd

After these steps Kodi was working fine with Lirc. And I could still use irexec. Nice !!

Hope this helps someone. I had a very difficult time to put it all together
Reply
#2
HURRAY! I can use LIRC again!

for the last year or two I have used ir-keytable (about the time the code got moved to the kernel.)

I had the infinite key error that you outline how to fix as well.

I am now running Kodi 18 with ubuntu 18.04, and I did not have to do your last two steps:

bash:
sudo sed -i 's/devinput/devinput-32/g' "${kodiuserdata}/Lircmap.xml" 

/usr/bin/kodi-standalone --lircdev /var/run/lirc/lircd

Thanks a bunch for posting! I appreciate it!

I am looooooooving it so much, tap tap tap tap the down button works a LOT better with LIRC than it does with ir-keytable it recognizes every press and acts as you would expect it to, also holding down the up or down button to scroll through a list works better with LIRC than ir-keytable as well, ir-keytable goes waaaay to fast scrolling, I always end up having to back track cause I would overshoot.

I am so very very happy! now to see if I can get irsend to work, so that I can control the volume on my stereo using my MCE remote. (I use an optical cable for passthrough, so controlling the volume in kodi dont work, currently I have to use a second remote to control the volume of my receiver.)
Reply
#3
(2018-09-20, 06:56)xekon Wrote: I am so very very happy! now to see if I can get irsend to work, so that I can control the volume on my stereo using my MCE remote. (I use an optical cable for passthrough, so controlling the volume in kodi dont work, currently I have to use a second remote to control the volume of my receiver.)
 Or, program lirc to work with your remote set to an AVR position you don't use (DVR or LD or something).  That's what I did.  My amp remote controls both kodi and the AVR when it's set to DVR.  All the 'normal' AVR controls are available, but the navigation buttons, enter, back, play, pause, etc etc control kodi.
Learning Linux the hard way !!
Reply
#4
(2017-11-27, 21:44)kaayman Wrote: This was I did to get it working: 
This is great.  Can it be added to the Wiki as a HowTo?  It seems to address many FAQs...
Reply
#5
easy come, easy go.

On Ubuntu 18.04 I did:

sudo apt-get update && sudo apt-get dist-upgrade

and now the directional keys on my remote work, but none of the other buttons do....

sudo irw (which was working perfectly fine) now shows:

Cannot connect to socket /var/run/lirc/lircd: No such file or directory

I am not sure if it was the kernel updating or lirc updating that caused the problem, I was not paying close enough attention....

will postback if I resolve anything.
Reply
#6
Probably you've updated lirc to the version that ships with 18.04 and doesn't work properly !!  If so, re-install 0.9.0 and you should be good to go.  There is a hand-holding guide here should you need one.
Learning Linux the hard way !!
Reply
#7
Thanks black_eagle. I actually had lirc_0.10.0-2 installed and working (and it still does on my other system)

but for some reason after dist-upgrade and a reboot it was broken.

I followed the workaround you listed, it worked.
I then unmarked the package as held and dist-upgraded again to see if it would work again with 0.10.0 (nope)

I then tried the workaround again! this time nothing worked.
I then did:

sudo apt purge ir-keytable lirc
sudo apt-get install -y lirc lirc-compat-remotes
sudo dpkg-reconfigure lirc
sudo irw
sudo systemctl stop lircd-uinput.service
sudo systemctl disable lircd-uinput.service

and now my remote is back to working with lirc_0.10.0-2

If I narrow down the exact cause I will post back, its very odd for sure, but for the moment I am working again with lirc_0.10.0-2

with lirc_0.10.0-2 irw shows output like this:

000000008001006c 00 KEY_DOWN devinput-32
0000000080010067 00 KEY_UP devinput-32
000000008001006c 00 KEY_DOWN devinput-32
0000000080010160 00 KEY_OK devinput-32
00000000800100ae 00 KEY_EXIT devinput-32

under lirc 0.9 for the few minutes I tried the workaround irw showed like this:

000000037ff07bde 00 KEY_RIGHT mceusb
000000037ff07be6 00 KEY_STOP mceusb
000000037ff07be6 01 KEY_STOP mceusb
000000037ff07be9 00 KEY_PLAY mceusb
000000037ff07be9 01 KEY_PLAY mceusb
000000037ff07be7 00 KEY_PAUSE mceusb
Reply

Logout Mark Read Team Forum Stats Members Help
Configure lirc with kodi (on Ubuntu 16.10 or higher) and still be able to use irexec2