Kodi Community Forum
How to get a seamless remote experience - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: How to get a seamless remote experience (/showthread.php?tid=104541)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16


RE: How to get a seamless remote experience - trelane - 2020-05-04

(2020-03-10, 01:19)chak1990 Wrote: I just upgraded me HTPC to Linux Mint 19.3 (which is a derivative of Ubuntu 18.04, if memory serves) from Mint 17.3.  My remote worked just fine under Mint 17, (I'm 99% sure I installed LIRC and it was done) but now it's a mess.  I have tested the controller on a different HTPC and I'm confident that it is working just fine.

I installed Mint 18 and 18.3 as a workaround, but hit multiple problems there.  I had more success than with 19.3, but I could still never get the play/pause and stop buttons to work with Kodi.  As the Mint 18 series will reach end of support this year, it seemed like I should refocus on getting 19.3 to work.

I have a cheap IR receiver.  I mean, it was the cheapest thing I could find a couple of years ago.  But it does everything I want/need it to do, so it was fine.  And, as I said, it worked just fine under Mint 17.3 and seemed to be working under 18.  (irw, at least, reported the correct commands, even if Kodi didn't act on them.)  The detailed tutorial at the beginning of this thread really didn't work.  I realize that the Kodi wiki says to use LIRC, but most other tutorials I have read indicate that the version included is faulty and recommend forcing installation of the older version from the Ubuntu Xenial repo.  Not only is this "hacky" but it seems to me likely to cause future potential problems.  Besides - it didn't work.  So decided to take the original author's advice and avoid LIRC and stick with the kernel.

I installed ir-keytable  get the following message:

/sys/class/rc/: No such file or directory
No devices found

This is not helpful.  The relevant lines from lsusb show:
Bus 006 Device 003: ID 1d57:0001 Xenta
Bus 003 Device 002: ID 1d57:ad02 Xenta SE340D PC Remote Control

and the relevant lines from dmesg show:
[    2.419573] input: HID 1d57:ad02 Keyboard as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input5
[    2.476229] input: HID 1d57:ad02 Consumer Control as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input6
[    2.476384] input: HID 1d57:ad02 System Control as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input7
[    2.477190] hid-generic 0003:1D57:AD02.0001: input,hiddev0,hidraw1: USB HID v1.10 Keyboard [HID 1d57:ad02] on usb-0000:00:12.0-2/input0
[    2.477452] input: HID 1d57:ad02 Mouse as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.1/0003:1D57:AD02.0002/input/input9
[    2.477631] hid-generic 0003:1D57:AD02.0002: input,hiddev1,hidraw2: USB HID v1.10 Mouse [HID 1d57:ad02] on usb-0000:00:12.0-2/input1


The device is there.  I know this because some buttons work, but ir-keytable can't seem to understand that.  Honestly, the only buttons I NEED are the direction arrows, enter, esc, play/pause, and stop.  The others are nice, but not necessary.  (The mouse functionality seems to work just fine.)

I'm open to just about anything.  Please help.  Than



RE: How to get a seamless remote experience - Soli - 2020-07-07

(2020-05-04, 22:39)trelane Wrote:
(2020-03-10, 01:19)chak1990 Wrote: I just upgraded me HTPC to Linux Mint 19.3 (which is a derivative of Ubuntu 18.04, if memory serves) from Mint 17.3.  My remote worked just fine under Mint 17, (I'm 99% sure I installed LIRC and it was done) but now it's a mess.  I have tested the controller on a different HTPC and I'm confident that it is working just fine.

I installed Mint 18 and 18.3 as a workaround, but hit multiple problems there.  I had more success than with 19.3, but I could still never get the play/pause and stop buttons to work with Kodi.  As the Mint 18 series will reach end of support this year, it seemed like I should refocus on getting 19.3 to work.

I have a cheap IR receiver.  I mean, it was the cheapest thing I could find a couple of years ago.  But it does everything I want/need it to do, so it was fine.  And, as I said, it worked just fine under Mint 17.3 and seemed to be working under 18.  (irw, at least, reported the correct commands, even if Kodi didn't act on them.)  The detailed tutorial at the beginning of this thread really didn't work.  I realize that the Kodi wiki says to use LIRC, but most other tutorials I have read indicate that the version included is faulty and recommend forcing installation of the older version from the Ubuntu Xenial repo.  Not only is this "hacky" but it seems to me likely to cause future potential problems.  Besides - it didn't work.  So decided to take the original author's advice and avoid LIRC and stick with the kernel.

I installed ir-keytable  get the following message:

/sys/class/rc/: No such file or directory
No devices found

This is not helpful.  The relevant lines from lsusb show:
Bus 006 Device 003: ID 1d57:0001 Xenta
Bus 003 Device 002: ID 1d57:ad02 Xenta SE340D PC Remote Control

and the relevant lines from dmesg show:
[    2.419573] input: HID 1d57:ad02 Keyboard as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input5
[    2.476229] input: HID 1d57:ad02 Consumer Control as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input6
[    2.476384] input: HID 1d57:ad02 System Control as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.0/0003:1D57:AD02.0001/input/input7
[    2.477190] hid-generic 0003:1D57:AD02.0001: input,hiddev0,hidraw1: USB HID v1.10 Keyboard [HID 1d57:ad02] on usb-0000:00:12.0-2/input0
[    2.477452] input: HID 1d57:ad02 Mouse as /devices/pci0000:00/0000:00:12.0/usb3/3-2/3-2:1.1/0003:1D57:AD02.0002/input/input9
[    2.477631] hid-generic 0003:1D57:AD02.0002: input,hiddev1,hidraw2: USB HID v1.10 Mouse [HID 1d57:ad02] on usb-0000:00:12.0-2/input1


The device is there.  I know this because some buttons work, but ir-keytable can't seem to understand that.  Honestly, the only buttons I NEED are the direction arrows, enter, esc, play/pause, and stop.  The others are nice, but not necessary.  (The mouse functionality seems to work just fine.)

I'm open to just about anything.  Please help.  Than
Your remote is seen as a keyboard. So just make a custom keymap that reference that specific keyboard name and the button presses to corresponding actions. you dont need Lirc or ir-keytable. As a bonus, native longpress should "just work" too.


RE: How to get a seamless remote experience - Preacher - 2020-08-09

(2020-03-10, 01:19)chak1990 Wrote: The device is there.  I know this because some buttons work, but ir-keytable can't seem to understand that.  Honestly, the only buttons I NEED are the direction arrows, enter, esc, play/pause, and stop.  The others are nice, but not necessary.  (The mouse functionality seems to work just fine.)

I'm open to just about anything.  Please help.  Thanks.
Try enabling debug mode, then running a "tail -f" against kodi's logfile and press a few remote buttons to see if anything comes up.

I've used this to determine the IDs that Kodi sees when hitting a button, then mapped those to specific desired Kodi operations in a "custom.xml" file in .kodi/userdata/keymaps/ directory.  I used a simple operation like Notification("button pressed","You just hit NUMPAD 5!") to check the correct button was detected first.

Note: you need a kodi restart to re-read changes to the .xml files, so I mapped a button to "ReloadKeymaps" (and another to "ToggleDebug") so that I could make changes and just hit another button to activate my changes without having to restart kodi all the time.


RE: How to get a seamless remote experience - wastis - 2021-02-14

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
Code:
dmesg
gives me
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"
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
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.


RE: How to get a seamless remote experience - birdwatcher - 2021-11-15

(2020-03-10, 01:19)chak1990 Wrote: I realize that the Kodi wiki says to use LIRC, but most other tutorials I have read indicate that the version included is faulty and recommend forcing installation of the older version from the Ubuntu Xenial repo.  Not only is this "hacky" but it seems to me likely to cause future potential problems.
On the contrary, it works fine in Ubuntu 18.04 and 20.04, assuming we are talking about the method shown at https://twosortoftechguys.wordpress.com/2018/07/24/make-lirc-work-in-ubuntu-18-04/ (at least it works for most who have tried it).  Linux Mint may be another matter, some have said it works fine under Mint while others have reported problems getting it working (although to be fair, some have also reported issues installing and/or running Kodi itself under Mint).  I have never personally tried it under Mint because honestly I don't see the point of running Mint on a media center PC, which is how I view TV.

But mainly I just wanted to point out that the main reason people want to use (the older version of) lirc is that it not only allow you to control Kodi, it also allows you to control other programs and/or devices by using a .lircrc file in your home directory.  As a couple of simple examples, let's say that my media center is showing the Ubuntu desktop, in that case I can press one button (one of the color buttons on the remote) to launch Kodi.  Or if Kodi freezes up, I can press that same button and it will kill the current Kodi process and restart it.  But I could also launch other programs, or launch shell scripts to do various other tasks just by pressing a button on the remote.  Most of the people who don't want you to use lirc are advocating solutions that, IF they work at all, will only work inside Kodi and then only if Kodi hasn't become unresponsive.  I'm sorry, but once you've had the ability to control things outside of Kodi using your remote, you don't want to give that up.

Also occasionally you will see someone say to just switch to a distribution with "Elec" in its name, again to me these are far too limiting, what you do in that case is create a single purpose machine that can ONLY run Kodi and pretty much nothing else, in fact they try really hard to keep you out of Linux altogether.  I tried one of those once and it took me all of about 20 minutes to realize that I hated it with the fire of a thousand burning suns.  The breaking point back then for me was that you could not install Midnight Commander to aid with file management; I understand that now they do give you a way to install that but that still doesn't change the fact that you can't install or use most other Linux software.  Maybe some people are happy with that, but I sure wasn't.

What really ticks me off, though, is that installing the older version of lirc was very easy and it worked very well.  You could do it without reading to read a single line of instructions, if all you knew to do was "sudo apt-get install lirc" (don't do that now, you'll get the awful newer version).  Now, no matter whether you try to use the latest lirc version (good luck!) or some other method, it takes paragraphs of arcane technical instructions to explain how to do it, leaving those of us who are not Linux experts feeling lost and confused, and often with something that just doesn't work at all or that works for some keys but not others.  I have said several times that those who think it is easy to get the new lirc working should make a YouTube video walkthrough showing how they do it, strangely no one has ever done that, which leads me to think it is nowhere near as easy as they claim.  I wish the Kodi people (or anyone, really) would fork the older version of lirc that worked and put it in the Kodi repository (just rename it to old-lirc or something) so that we could get it without jumping through the hoops that are currently necessary to get the older version, although those instructions are far easier than any I have seen for any other method (and especially for running the newer version of lirc, seems like you need a computer science degree to pull that off).


This forum uses Lukasz Tkacz MyBB addons.