# Kodi and LIRC



## recluce (Apr 26, 2017)

I was wondering if anybody has Kodi working with an IR remote and LIRC under FreeBSD 11.0-STABLE. 

It was actually quite easy to setup LIRC and the LIRC tools show that the remote is recognized and key presses are interpreted correctly on the OS side. Kodi 16.10 has been build from ports with LIRC support enabled (currently on Kodi 16.10_11). But when I start Kodi, there is no mention of LIRC in Kodi's log file and it simply does not work - with no debug or log data available from Kodi.

If anybody had success getting this to work, I would appreciate it if he or she could chime in here.


----------



## SirDice (Apr 26, 2017)

Did you follow this? http://kodi.wiki/view/HOW-TO:Set_up_LIRC#Configure_Kodi_to_understand_Lirc.27s_commands


----------



## recluce (Apr 26, 2017)

Thank you for the link, but I tried that guide early on. However, I went through the steps again, just to be sure and when starting kodi with "--lircdev /dev/lirc0 --debug", I finally got something in the log file:


```
09:03:34 T:34845252864    INFO: LIRC Process: using: /dev/lirc0
09:03:34 T:34845252864    INFO: LIRC Connect: connect failed: Socket operation on non-socket
09:03:34 T:34845252864    INFO: CRemoteControl::Process - failed to connect to LIRC, will keep retrying every 5 seconds
```

A couple of seconds later, a message that it gave up on lirc:


```
09:03:44 T:34844270592  NOTICE: closing down remote control service
09:03:44 T:34845252864   DEBUG: Failed to connect to LIRC. Giving up.
09:03:44 T:34845252864   DEBUG: Thread RemoteControl 34845252864 terminating
09:03:44 T:34844270592    INFO: LIRC SetEnabled: disabled
```


----------



## aht0 (Apr 26, 2017)

Have you tried updating ports recently? I built Kodi using ports over the last weekend and got 17.1 out of it.

Can't chime in about LIRC, I am using remote which is recognized as mouse (ums) by FreeBSD


----------



## recluce (Apr 26, 2017)

17.1 currently breaks passthrough audio for me (Kodi tells me it is enabled, but only 2.0 arrives at the amplifier), so I am staying away from it at the moment (I rolled back to 16.10_11). The issue has existed since I set up the system (originally with 16.10_7).

I checked the sockets on that machine, /var/run/lirc/lircd exists. Does the socket error indicate a bug in Kodi?


----------



## SirDice (Apr 26, 2017)

After you've configured LIRC make sure the daemon runs before starting Kodi; `service lircd start`. If I recall correctly it's the daemon process that creates the device.


----------



## SirDice (Apr 26, 2017)

recluce said:


> I checked the sockets on that machine, /var/run/lirc/lircd exists. Does the socket error indicate a bug in Kodi?


No, it's more likely that /dev/lirc0 is not correct and you need to point it to /var/run/lirc/lircd.


----------



## recluce (Apr 26, 2017)

lircd is started on system boot and I verified it is running, creating /dev/lirc0 and /var/run/lirc/lircd



SirDice said:


> No, it's more likely that /dev/lirc0 is not correct and you need to point it to /var/run/lirc/lircd.



You may be onto something here. I tried /var/run/lirc/lircd. While it did not work, the result is different:


```
11:25:28 T:34845252864   DEBUG: Thread RemoteControl start, auto delete: false
11:25:28 T:34845252864    INFO: LIRC Process: using: /var/run/lirc/lircd
11:25:28 T:34845252864   DEBUG: LIRC: Failed to initialize Inotify. LIRC device will not be monitored.
11:25:28 T:34845252864    INFO: CRemoteControl::Process - failed to connect to LIRC, will keep retrying every 5 seconds
```


----------



## recluce (Apr 26, 2017)

Inotify is a Linux-specific API, right?


----------



## recluce (May 2, 2017)

I found a workaround, as Kodi simply does not seem to work with lircd under FreeBSD. I ordered a second generation FLIRC (the all metal one), a nifty little device that is a programmable infrared receiver, but emulates a regular USB keyboard towards the computer. Once programmed, no driver or software is needed. Works!


----------

