input devices not recognised by kodi
#1
I'm currently trying to make a module to use a rotary encoder usable as a volume control on my raspberry pi by turning the increments into volume up/down buttons.
the module I have made now works to adjust the volume on the raspbian desktop but not in kodi.
I have enabled advanced input logging and the device is picked up by kodi the same as my physical keyboard is, but kodi does not recognise the input.
I have tested this with evtest and even altered the code so that the reported capabilities, bus, VID and PID all match my physical keyboard and yet kodi still doesn't recognise any input from my device.
I have also found the same behaviour with the gpio_keys driver that is part of raspbian.
from logs, keyboard that works getting picked up:
Code:
18:22:01.787 T:1910902784    INFO: Found input device /dev/input/event2
18:22:01.787 T:1910902784    INFO: opened device 'Microsoft Microsoft® 2.4GHz Transceiver v6.0' (file name /dev/input/event2), m_bSkipNonKeyEvents 0
18:22:01.787 T:1910902784 WARNING: no keymap support (requires /dev/tty0 - CONFIG_VT)
my device:
Code:
18:22:02.227 T:1910902784    INFO: Found input device /dev/input/event4
18:22:02.227 T:1910902784    INFO: opened device 'GPIO Rotary Encoder Volume' (file name /dev/input/event4), m_bSkipNonKeyEvents 0
18:22:02.227 T:1910902784 WARNING: no keymap support (requires /dev/tty0 - CONFIG_VT)

with the physical keyboard i get events like this:
Code:
19:01:47.225 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0
19:01:47.225 T:1911083008   DEBUG: OnKey: long-volume_up (0x100f0b9) pressed, action is VolumeUp
19:01:47.225 T:1911079680   DEBUG: CAnnouncementManager - Announcement: OnVolumeChanged from xbmc
19:01:47.226 T:1911079680   DEBUG: GOT ANNOUNCEMENT, type: 64, from xbmc, message OnVolumeChanged
19:01:47.310 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0
19:01:47.310 T:1911083008   DEBUG: OnKey: long-volume_up (0x100f0b9) pressed, action is VolumeUp
19:01:47.311 T:1911079680   DEBUG: CAnnouncementManager - Announcement: OnVolumeChanged from xbmc
19:01:47.311 T:1911079680   DEBUG: GOT ANNOUNCEMENT, type: 64, from xbmc, message OnVolumeChanged
19:01:47.391 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0
19:01:47.391 T:1911083008   DEBUG: OnKey: long-volume_up (0x100f0b9) pressed, action is VolumeUp
19:01:47.392 T:1911079680   DEBUG: CAnnouncementManager - Announcement: OnVolumeChanged from xbmc
19:01:47.392 T:1911079680   DEBUG: GOT ANNOUNCEMENT, type: 64, from xbmc, message OnVolumeChanged
19:01:47.471 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0
19:01:47.471 T:1911083008   DEBUG: OnKey: long-volume_up (0x100f0b9) pressed, action is VolumeUp
19:01:47.472 T:1911079680   DEBUG: CAnnouncementManager - Announcement: OnVolumeChanged from xbmc
19:01:47.472 T:1911079680   DEBUG: GOT ANNOUNCEMENT, type: 64, from xbmc, message OnVolumeChanged
19:01:47.554 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0
19:01:47.554 T:1911083008   DEBUG: OnKey: long-volume_up (0x100f0b9) pressed, action is VolumeUp
19:01:47.555 T:1911079680   DEBUG: CAnnouncementManager - Announcement: OnVolumeChanged from xbmc
19:01:47.555 T:1911079680   DEBUG: GOT ANNOUNCEMENT, type: 64, from xbmc, message OnVolumeChanged
19:01:47.600 T:1911083008   DEBUG: Keyboard: scancode: 0x73, sym: 0x00af, unicode: 0x0000, modifier: 0x0

could it be because my device and the gpio_keys drivers only implement keycodes and not scancodes?
Reply
#2
so i've raised a kodi bug report: here

but from diving into the kodi source it looks like the issue is that if the device has less than 21 keys it is not assigned the LI_DEVICE_KEYBOARD type, and if it doesn't meet any other types criteria it falls through and is assigned LI_DEVICE_NONE, then in the event handler if the type is LI_DEVICE_NONE it returns without handling any events.

the way the gpio-keys driver from the linux tree is written it only reports key capabilities for the keys that are registered with it, which would rarely be 21 or more. so this driver would pretty much always be ignored. i'd suggest it would be better to alter the fall through so that if no type is more applicable as long as it has at least 1 button it gets given the LI_DEVICE_KEYBOARD type.
Reply
#3
i have created a pull request to fix this issue here but in the mean time I've made an altered gpio-keys driver that declares extra keys to get around the kodi limitation here

for anyone interested i have also make a kernel module to use a rotary encoder as a volume control here
Reply

Logout Mark Read Team Forum Stats Members Help
input devices not recognised by kodi0