Remote control is not working in a container

Hello. I installed Kodi as a container passing /dev/dri/card0, /dev/dri/renderD128, /dev/fb0 and /dev/ttyX from the host and using Kodi via GBM (very light and no graphical server or extra dependencies needed).

The most annoying part of the installation process was having a USB keyboard be identified by the container. After a lot of research I found this (that saved my life, because by the time I found this thread I was almost giving up) and it worked ok with the keyboard so that I could complete a basic Kodi installation.

Now I’m controlling it with my Android phone but what I really want is to use a Rii MX3 Air Remote Control I have (easier and more comfortable).

Thing is although it gets recognized, not all buttons work (and I know the keymap of this remote works out of the box because I’ve used it before, with this same configuration, when I was using Proxmox).

So I followed the suggested approach by the aforementioned thread and passed /run/udev/data as follows (btw, is this the correct way to achieve that in Incus?):

incus config device add kodi udev_data disk source=/run/udev/data path=/home/alscx/udev/data

Before Kodi starts I copy the content of /home/alscx/udev/data to /run/udev/data (couldn’t I pass /run/udev/data from the host directly to /run/udev/data on the container so that I’d remove one extra step?)

Then, I tried to pass the remote control device one of these following ways:

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 1915:1025 Nordic Semiconductor ASA USB Composite Device
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

incus config device add kodi rii-mx3 usb vendorid=1915 productid=1025 required=false

Doing so the remote control is not recognized by Kodi… I also tried unix-hotplug with no success.

The other way I tried was:

ls -lh /dev/input/by-id/
total 0
lrwxrwxrwx 1 root root 10 set 18 15:09 usb-XING_WEI_2.4G_USB_USB_Composite_Device-event-if03 → ../event12
lrwxrwxrwx 1 root root 9 set 18 15:09 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if02-event-kbd → ../event9
lrwxrwxrwx 1 root root 10 set 18 15:09 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if03-event-mouse → ../event10
lrwxrwxrwx 1 root root 9 set 18 15:09 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if03-mouse → ../mouse0

incus config device add kodi remote-event-if03 unix-char path=/dev/input/event12 required=false gid=994
incus config device add kodi remote-event-if02-event-kbd unix-char path=/dev/input/event9 required=false gid=994
incus config device add kodi remote-event-if03-event-mouse unix-char path=/dev/input/event10 required=false gid=994
incus config device add kodi remote-event-if03-mouse unix-char path=/dev/input/mouse0 required=false gid=994

Now I can use the remote, but not all buttons get recognized. That or sometimes buttons that were being recognized just stop working. This remote has a kind of ‘mouse mode’ that sometimes may force this behavior in some situations, but I made sure of disabling it. Obviously I’m using new batteries.

Is there a more suitable way to achieve what I need?

Yes i remember this problem. Did you try something like evtest and check how the keys of the device are binded? Maybe mapping them to different actions might work.

I would also check if the device is proberly supported by linux before i would dig into the lxd stuff…might save you some time…

Hey @Dr.Axelbauer

Thanks for taking the time to answer. I simply don’t know what happened, but I deleted and recreated the container, inserted the usb dongle and… well… now it’s working!

I noticed something different, though:

ls -lh /dev/input/by-id/
total 0
lrwxrwxrwx 1 root root 9 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-event-if03 → ../event6
lrwxrwxrwx 1 root root 9 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if02-event-kbd → ../event4
lrwxrwxrwx 1 root root 13 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if02-hidraw → ../../hidraw0
lrwxrwxrwx 1 root root 9 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if03-event-mouse → ../event5
lrwxrwxrwx 1 root root 13 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if03-hidraw → ../../hidraw1
lrwxrwxrwx 1 root root 9 set 19 10:28 usb-XING_WEI_2.4G_USB_USB_Composite_Device-if03-mouse → ../mouse0

As you see, there are 2 new entries, hidraw0 and hidraw1, that weren’t available before. I sincerely have no idea about the reasons, but when I passed these two along with the other ones that were already being passed, everything worked. All the remote buttons are working properly.

Now I’d like to see If I find a more elegant and definitive way of passing the content of folder /run/udev/data to the container.

Yes it is a very “dirty” solution but anyway it works on my system without flaws for many years now :wink: … If you find a better one please post …