Stop Kodi from grabbing /dev/input/event* devices?
#1
Hi,

Does anyone know how to prevent Kodi from grabbing the event devices in "/dev/input"? Or, alternatively, how make kodi release these devices at runtime?

The reason I need to do this is that I'm using Kodi in combination with Advanced Launcher for launching emulators (retroarch, mupen64plus and the like). Since I'm running kodi on an ARM-SBC without X11, I need to stop kodi before launching the actual emulator and resume it after exiting the game, which i'm doing via a custom launcher script:
Code:
kill -STOP $(pgrep kodi.bin)
# playing games
kill -CONT $(pgrep kodi.bin)
This part basically works great, except that my Xbox360 controller does not work when I launch emulators like that, because kodi still has control of /dev/input/event2 so that retroarch cannot use them, as reported by:
Code:
$ lsof /dev/input/event0

I disabled joystick and mouse support in guisettings.xml (I'm only using yatse to control Kodi).

Thanks in advance,
Jan
Reply
#2
Just in case someone has the same problem: I figured that there probably is no way to prevent Kodi from grabbing these devices, so I had to revoke its permission to access input devices.

The permissions of my event devices look like this:
Code:
$ ls -l /dev/input/event*
crw-rw---- 1 root input 13, 64  1. Jan 1970  /dev/input/event0
crw-rw---- 1 root input 13, 65  1. Jan 1970  /dev/input/event1
crw-rw---- 1 root input 13, 66 21. Mär 15:53 /dev/input/event2
crw-rw---- 1 root input 13, 67 21. Mär 15:53 /dev/input/event3
crw-rw---- 1 root input 13, 68 21. Mär 15:53 /dev/input/event4
crw-rw---- 1 root input 13, 69 21. Mär 15:53 /dev/input/event5

Thus I removed my kodi user from the input group:
Code:
# gpasswd -d kodi input

Then I added this to my /etc/sudoers:
Code:
kodi ALL=(kodi:input) NOPASSWD: /usr/bin/retroarch, /usr/bin/mupen64plus

Now, my kodi user can't access the input devices, but he can run:
Code:
sudo -u kodi -g input retroarch
and:
Code:
sudo -u kodi -g input mupen64plus

So Kodi itself can't access the event devices, but retroarch/mupenplus can.
Reply
#3
Is there any way to just block /dev/input/event3 ? I have a keyboard that reports touch events on that input, even though it is not a touch device. Makes it useless after touch screen support got added to kodi.
Reply
#4
You can try to stop it loadin in X. with something like these example.

Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "Ignore" "on"
EndSection

This is how i stop my remote from loadin in X so kodi take my kernel driver and not lirc for my remote.
You can try the same for you device you want to stop loading.

Here i match on product name, found with command : dmesg | grep Nuvoton

Add it in : /usr/share/X11/xorg.conf.d/11-evdev-quirks.conf
Section "InputClass"
Identifier "Nuvoton Remote USERDEFINED"
Driver "evdev"
MatchProduct "Nuvoton w836x7hg Infrared Remote Transceiver"
Option "Ignore" "on"
EndSection
Reply

Logout Mark Read Team Forum Stats Members Help
Stop Kodi from grabbing /dev/input/event* devices?0