2021-02-14, 12:51
I have the Hama Remote Mce - USB - which is also seen as Keyboard / Mouse by Ubuntu. On newer versions of Ubuntu (I now use LinuxMint 20.1 Ulyssa - Xfce and Cinnamon on different PC's), Kodi does not see the Multimedia and Power keys, at least I was not able to get this working by just editing Kodi's keymaps allone. With tail -f ~/.kodi/temp/kodi.log I see some of the events arriving from the remote, the Multmedia-Keys do not. I do not know, whether it is possible to bind Kodi directly onto a specific device, that would ease the solution.
In addition to get the Multimedia Buttons (PLAY/PAUSE/FF/RW/STOP ....) working with Kodi, the Volume Control should stay with the OS, as I need to use the Volume autogain of the sound system of PulseEffects. Kodi's volume control would work against the autogain function of the OS.
So here is the ir-remote part of my solution Kodi on Ubuntu 20.1 Xfce with Hama Remote Mce and DSP. Sorry for some overlap to previouse posts, but this gives a one in all.
Step 1 - Get the remote properly mapped to devices on Ubuntu
gives me
See here 2 Mouse (USB HID v1.10 Mouse, HID 05a4:9881 Mouse) - and 3 Keyboards (USB HID v1.10 Keyboard, HID 05a4:9881, Consumer Control, HID 05a4:9881 System Control)
Unfortunately, due to some naming overlap in the udev process, I only get a reduced number of symlinks in the /dev/input/by-id folder.
The HID 05a4:9881, Consumer Control gets lost - it is there as /dev/input/event5, but not in this symlink list which I could use for inputlirc otherwise.
So we have to create our own list, fortunately this is very easy.
Create udev rule, as you can see, I use the names that have been returned by dmesg.
Other symlink naming would be possible and maybe better, such as SYMLINK+="input/ir-keyboard instead of SYMLINK+="input/irremote0", all config files below would need to be altered in this case to match the symlink naming.
Then trigger udev
If everything goes fine, I can list the new crated symlinks by
A test if multi-media-keys arrive can be done by a small application
Step 2 - Install and configure inputlirc, lirc itself is not needed.
configure inputlirc
remove everything and insert
restart inputlirc
Optional - to test it or to find keycodes, irw from lirc is required. So install it and disable lirc
run the test
Step 3 - Configure Kodi - the following example is for the Hama Remote MCE
I use here the record button to easily come back from menu browsing to the fullscreen video and the explorer key for the powerdown menu.
and insert
That's it for the standard setup. How to setup the OS Equalizer / Autogain and to split out the volume control might be a topic for a different post.
In addition to get the Multimedia Buttons (PLAY/PAUSE/FF/RW/STOP ....) working with Kodi, the Volume Control should stay with the OS, as I need to use the Volume autogain of the sound system of PulseEffects. Kodi's volume control would work against the autogain function of the OS.
So here is the ir-remote part of my solution Kodi on Ubuntu 20.1 Xfce with Hama Remote Mce and DSP. Sorry for some overlap to previouse posts, but this gives a one in all.
Step 1 - Get the remote properly mapped to devices on Ubuntu
Code:
dmesg
Code:
usb 3-9: USB disconnect, device number 20
[27586.308750] usb 3-9: new low-speed USB device number 21 using xhci_hcd
[27586.467274] usb 3-9: New USB device found, idVendor=05a4, idProduct=9881, bcdDevice= 1.20
[27586.467279] usb 3-9: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[27586.476993] input: HID 05a4:9881 as /devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9:1.0/0003:05A4:9881.0024/input/input124
[27586.540933] hid-generic 0003:05A4:9881.0 024: input,hidraw0: USB HID v1.10 Keyboard [HID 05a4:9881] on usb-0000:00:14.0-9/input0
[27586.563257] input: HID 05a4:9881 Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9:1.1/0003:05A4:9881.0025/input/input125
[27586.563436] input: HID 05a4:9881 Consumer Control as /devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9:1.1/0003:05A4:9881.0025/input/input126
[27586.620830] input: HID 05a4:9881 System Control as /devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9:1.1/0003:05A4:9881.0025/input/input127
[27586.620926] hid-generic 0003:05A4:9881.0025: input,hidraw1: USB HID v1.10 Mouse [HID 05a4:9881] on usb-0000:00:14.0-9/input1
See here 2 Mouse (USB HID v1.10 Mouse, HID 05a4:9881 Mouse) - and 3 Keyboards (USB HID v1.10 Keyboard, HID 05a4:9881, Consumer Control, HID 05a4:9881 System Control)
Unfortunately, due to some naming overlap in the udev process, I only get a reduced number of symlinks in the /dev/input/by-id folder.
The HID 05a4:9881, Consumer Control gets lost - it is there as /dev/input/event5, but not in this symlink list which I could use for inputlirc otherwise.
Code:
ls -l /dev/input/by-id/ | grep 05a4
lrwxrwxrwx 1 root root 9 Feb 14 10:07 usb-05a4_9881-event-if01 -> ../event6
lrwxrwxrwx 1 root root 9 Feb 14 10:07 usb-05a4_9881-event-kbd -> ../event3
lrwxrwxrwx 1 root root 9 Feb 14 10:07 usb-05a4_9881-if01-event-mouse -> ../event4
lrwxrwxrwx 1 root root 9 Feb 14 10:07 usb-05a4_9881-if01-mouse -> ../mouse0
So we have to create our own list, fortunately this is very easy.
Create udev rule, as you can see, I use the names that have been returned by dmesg.
Code:
sudo vim /etc/udev/rules.d/10-irremote.rules
SUBSYSTEM=="input",ATTRS{name}=="HID 05a4:9881",SYMLINK+="input/irremote0"
SUBSYSTEM=="input",ATTRS{name}=="HID 05a4:9881 Mouse",SYMLINK+="input/irremote1"
SUBSYSTEM=="input",ATTRS{name}=="HID 05a4:9881 Consumer Control",SYMLINK+="input/irremote2"
SUBSYSTEM=="input",ATTRS{name}=="HID 05a4:9881 System Control",SYMLINK+="input/irremote3"
Then trigger udev
Code:
sudo udevadm control --reload-rules
sudo udevadm trigger
If everything goes fine, I can list the new crated symlinks by
Code:
ls -l /dev/input | grep irremote
lrwxrwxrwx 1 root root 6 Feb 14 10:07 irremote0 -> event3
lrwxrwxrwx 1 root root 6 Feb 14 10:07 irremote1 -> event4
lrwxrwxrwx 1 root root 6 Feb 14 10:07 irremote2 -> event5
lrwxrwxrwx 1 root root 6 Feb 14 10:07 irremote3 -> event6
A test if multi-media-keys arrive can be done by a small application
Code:
sudo apt install evtest
sudo evtest /dev/input/irremote2
Step 2 - Install and configure inputlirc, lirc itself is not needed.
Code:
sudo apt install inputlirc
configure inputlirc
Code:
sudo vim /etc/default/inputlirc
remove everything and insert
Code:
# Options to be passed to inputlirc.
EVENTS="/dev/input/irremote*"
#-g exclusive -m 0 from message 0 -c capture modify to add shift etc, -r repeat 280 ms
#http://manpages.ubuntu.com/manpages/trusty/man8/inputlircd.8.html
OPTIONS="-g -m 0 -c -r 280"
restart inputlirc
Code:
sudo systemctl restart inputlirc
Optional - to test it or to find keycodes, irw from lirc is required. So install it and disable lirc
Code:
sudo apt install lirc
sudo systemctl disable lirc
run the test
Code:
irw
Step 3 - Configure Kodi - the following example is for the Hama Remote MCE
I use here the record button to easily come back from menu browsing to the fullscreen video and the explorer key for the powerdown menu.
Code:
vim ~/.kodi/userdata/Lircmap.xml
and insert
Code:
<lircmap>
<remote device="/dev/input/irremote3">
<power>KEY_SLEEP</power>
</remote>
<remote device="/dev/input/irremote2">
<play>KEY_PLAYPAUSE</play>
<stop>KEY_STOPCD</stop>
<skipplus>KEY_NEXTSONG</skipplus>
<skipminus>KEY_PREVIOUSSONG</skipminus>
<start>KEY_HOMEPAGE</start>
<volumeplus>KEY_VOLUMEUP</volumeplus>
<volumeminus>KEY_VOLUMEDOWN</volumeminus>
<mute>KEY_MUTE</mute>
</remote>
<remote device="/dev/input/irremote1">
<menu>BTN_MOUSE</menu>
<title>BTN_RIGHT</title>
</remote>
<remote device="/dev/input/irremote0">
<record>CTRL_KEY_R</record>
<reverse>CTRL_SHIFT_KEY_B</reverse>
<forward>CTRL_SHIFT_KEY_F</forward>
<left>KEY_LEFT</left>
<right>KEY_RIGHT</right>
<up>KEY_UP</up>
<down>KEY_DOWN</down>
<select>KEY_ENTER</select>
<pageplus>KEY_PAGEUP</pageplus>
<pageminus>KEY_PAGEDOWN</pageminus>
<back>KEY_BACKSPACE</back>
<info>ALT_META_KEY_ENTER</info>
<display>KEY_ESC</display>
<myvideo>CTRL_KEY_E</myvideo>
<mymusic>CTRL_KEY_M</mymusic>
<mypictures>CTRL_KEY_I</mypictures>
<mytv>CTRL_SHIFT_KEY_T</mytv>
<one>KEY_KP1</one>
<two>KEY_KP2</two>
<three>KEY_KP3</three>
<four>KEY_KP4</four>
<five>KEY_KP5</five>
<six>KEY_KP6</six>
<seven>KEY_KP7</seven>
<eight>KEY_KP8</eight>
<nine>KEY_KP9</nine>
<zero>KEY_KP0</zero>
<star>KEY_KPASTERISK</star>
<hash>ALT_KEY_KP5</hash>
<clear>CTRL_KEY_O</clear>
<teletext>CTRL_KEY_G</teletext>
<obc1>CTRL_KEY_T</obc1>
<obc3>CTRL_SHIFT_KEY_M</obc3>
<obc2>ALT_KEY_F4</obc2>
</remote>
</lircmap>0
Code:
vim ~/.kodi/userdata/keymaps/remote.xml
Code:
<keymap>
<global>
<remote>
<start>ActivateWindow(shutdownmenu)</start>
<teletext>XBMC.RunScript(service.xbmc.tts,key.ITEM_EXTRA)</teletext>
<record>FullScreen</record>
<power>Powerdown</power>
</remote>
<universalremote>
<obc1>XBMC.RunScript(service.xbmc.tts,key.REPEAT)</obc1>
<obc2>XBMC.RunScript(special://home/addons/service.xbmc.tts/enabler.py)</obc2>
<obc3>XBMC.RunScript(service.xbmc.tts,key.STOP)</obc3>
</universalremote>
</global>
<MyVideoFiles>
<remote>
<clear>Delete</clear>
</remote>
</MyVideoFiles>
<MyMusicFiles>
<remote>
<clear>Delete</clear>
</remote>
</MyMusicFiles>
<Home>
<remote>
<title>ActivateWindow(favourites)</title>
</remote>
</Home>
</keymap>
That's it for the standard setup. How to setup the OS Equalizer / Autogain and to split out the volume control might be a topic for a different post.