Mythtv on Ubuntu 20.04 (edit: mostly ir-keytable/lirc issue)

For discussion of topics specific to MythTV on linux
yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Mythtv on Ubuntu 20.04 (edit: mostly ir-keytable/lirc issue)

Post by yawlhoo » Sat Apr 11, 2020 10:38 pm

I've been running MythTV for years and have found the major hurdles are when I change to a new version of the platform I run it on, Ubuntu, or upgrade to a new version of MythTV. For example, with respect to the latter I recently upgraded to v31 (on 18.04 LTS) and found that mythfilldatabase was no longer being run on the backend each early morning. I had to switch to getting new guide data using a cron job as I was unable to figure out why the update was not being run.

Both my backend and frontend are running on Ubuntu 18.04 LTS, whose life is coming to an end. I thought I would try to get an idea of the problems to be encountered upgrading to 20.04 LTS, by setting up a front end.

Overall this went well, but I've encountered a knotty problem getting my remotes working. It seems that these days remotes are to be run using ir-keytable, not LIRC. Following various postings I can get a keytable installed, but nothing I do seems to make it work, i.e., poke a key, see something happen on the screen.

The closest I can get to something working is install a Kodi keytable per:

https://github.com/clontarfx/kodi-rc6-mce-nolirc

This allows a poke of my remote's Enter button to execute the current selection, but none of the other buttons do anything, no matter how I edit the keytable.

The entire (Kodi-derived) rc6_mce table looks like this:
===
# table rc6_mce, type: RC6
0x800f0400 KEY_0
0x800f0401 KEY_1
0x800f0402 KEY_2
0x800f0403 KEY_3
0x800f0404 KEY_4
0x800f0405 KEY_5
0x800f0406 KEY_6
0x800f0407 KEY_7
0x800f0408 KEY_8
0x800f0409 KEY_9
0x800f040a KEY_DELETE
0x800f040b KEY_ENTER
0x800f040c KEY_SLEEP
0x800f040d KEY_ESC
0x800f040e KEY_MUTE
0x800f040f KEY_I
0x800f0410 KEY_VOLUMEUP
0x800f0411 KEY_VOLUMEDOWN
0x800f0412 KEY_PAGEUP
0x800f0413 KEY_PAGEDOWN
0x800f0414 KEY_FASTFORWARD
0x800f0415 KEY_REWIND
0x800f0416 KEY_PLAY
0x800f0417 KEY_RECORD
0x800f0418 KEY_SPACE
0x800f0418 KEY_SPACE
0x800f0419 KEY_X
0x800f041a KEY_NEXTSONG #NEXT
0x800f041b KEY_PREVIOUSSONG #PREVIOUS
0x800f041c KEY_NUMERIC_POUND
0x800f041d KEY_NUMERIC_STAR
0x800f041e KEY_UP
0x800f041f KEY_DOWN
0x800f0420 KEY_LEFT
0x800f0421 KEY_RIGHT
0x800f0422 KEY_ENTER
0x800f0423 KEY_BACKSPACE
0x800f0424 KEY_O
0x800f0425 KEY_H
0x800f0426 KEY_E
0x800f0427 KEY_ZOOM
0x800f0432 KEY_MODE
0x800f0433 KEY_PRESENTATION
0x800f0434 KEY_EJECTCD
0x800f043a KEY_BRIGHTNESSUP
0x800f0446 KEY_TV
0x800f0447 KEY_AUDIO
0x800f0448 KEY_B
0x800f0449 KEY_CAMERA
0x800f044a KEY_VIDEO
0x800f044c KEY_LANGUAGE
0x800f044d KEY_TITLE
0x800f044e KEY_PRINT
0x800f0450 KEY_RADIO
0x800f045a KEY_T
0x800f045b KEY_RED
0x800f045c KEY_GREEN
0x800f045d KEY_YELLOW
0x800f045e KEY_BLUE
0x800f0465 KEY_POWER2
0x800f046e KEY_PLAYPAUSE
0x800f046f KEY_PLAYER
0x800f0480 KEY_BRIGHTNESSDOWN
0x800f0481 KEY_PLAYPAUSE
===
Is there perhaps some newer way to handle remotes with Ubuntu 20.04?

User avatar
heyted
Senior
Posts: 157
Joined: Sun Jun 08, 2014 2:14 am
Location: South Florida
Contact:
United States of America

Re: Mythtv on Ubuntu 20.04

Post by heyted » Sat Apr 11, 2020 11:28 pm

Open a terminal and enter "sudo ir-keytable -t". Press a button on the remote, and see if the scancode matches what you have in the table file.
Ted | My blog

LinuxGeek28
Newcomer
Posts: 6
Joined: Mon Dec 24, 2018 4:55 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by LinuxGeek28 » Sun Apr 12, 2020 1:34 am

https://www.zdnet.com/article/mark-shut ... -lifespan/

FYI - It looks like 18.04 will be supported until 2028.

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Sun Apr 12, 2020 3:34 am

The output of "sudo ir-keytable -t" gives the matching scancode, but alas, it doesn't do anything in MythTV, other than the exception noted above.

wesnewell
Senior
Posts: 672
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Mythtv on Ubuntu 20.04

Post by wesnewell » Sun Apr 12, 2020 6:38 am

Getting a remote to work with ir-keytable is petty simple but does require some work. Been using it for several years on all my remote frontends. There's just 2 things you need, but they have to be right.
1. You have to have a valid keymap file in /etc/rc_keymaps.
Example:
wes@mythfe0:~$ ls /etc/rc_keymaps
myremotes

2. /etc/rc_maps.cfg must point to your keymap file.
Example:
wes@mythfe0:~$ cat /etc/rc_maps.cfg|grep myremotes
# mceusb rc-rc6-mce /etc/rc_keymaps/myremotes
mceusb * /etc/rc_keymaps/myremotes

Heck, let me plug in an ir receiver now.
wes@mythfe0:~$ ir-keytable
Found /sys/class/rc/rc3/ (/dev/input/event19) with:
Name: Media Center Ed. eHome Infrared Remote Transceiver (0471:0815)
Driver: mceusb, table: rc-rc6-mce
lirc device: /dev/lirc3
Supported protocols: other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
Enabled protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp
Extra capabilities: <access denied>
If you run as root it will give you more info, but it's really not needed.
bus: 3, vendor/product: 0471:0815, version: 0x0000
Repeat delay = 500 ms, repeat period = 125 ms
Note that the mceusb driver needs to be loaded for the receiver to work. And whichever protocol your remote uses must also be enable. If the receiver doesn't support the protocol your remote uses, it's not going to work. You enable the protocols you want in the first line of your keymap file. I just enable all my receiver supports.
wes@mythfe0:~$ cat /etc/rc_keymaps/myremotes|grep table
# table *, type:rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp

Now you just need build your keymap file, point to it and that's pretty much it.
Note that the examples are for my receiver and my remote. Yours will probably different. Hope I didn't forget anything. Been a few years since I set this up. If you search ir-keytable on this forum, you'll find quite a few other threads that might help.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

User avatar
heyted
Senior
Posts: 157
Joined: Sun Jun 08, 2014 2:14 am
Location: South Florida
Contact:
United States of America

Re: Mythtv on Ubuntu 20.04

Post by heyted » Sun Apr 12, 2020 12:59 pm

When you press the one button on the remote when testing with "sudo ir-keytable -t", does the output include "KEY_1"? If not, you need to check the files as Wes mentioned.
Ted | My blog

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Sun Apr 12, 2020 4:13 pm

Thanks for the input. I have read many postings about ir-keytable, etc., finding yours (wesnewell) hugely informative.

One thing I spotted in your posting in this thread is this, in your output of ir-keytable:
==
..
Driver: mceusb, table: rc-rc6-mce
...
==
Mine looks like this:
==
...
Driver: nuvoton-cir
...
==
with no table entry. (The receiver is in an Intel NUC.) I tried modprobing mceusb, which then shows up in a lsmod listing, but that doesn't change matters.

I have all the configs in place per your mini-howto, ir-keytable -t gives KEY_1 and all that, it's just they don't DO anything.

wesnewell
Senior
Posts: 672
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Mythtv on Ubuntu 20.04

Post by wesnewell » Sun Apr 12, 2020 7:40 pm

Then you need to replace MY mceusb with your driver. And make sure you load it. modprobe nuvoton-cir.
EXP:
wes@mythfe0:~$ lsmod|grep nuvoton
wes@mythfe0:~$ sudo modprobe nuvoton-cir
wes@mythfe0:~$ lsmod|grep nuvoton
nuvoton_cir 20480 0
rc_core 53248 18 ir_kbd_i2c,mceusb,ir_rc6_decoder,ir_sanyo_decoder,ir_jvc_decoder,ir_nec_decoder,rc_rc6_mce,ir_sharp_decoder,cx23885,ir_rc5_decoder,ir_mce_kbd_decoder,nuvoton_cir,ir_xmp_decoder,rc_fusionhdtv_mce,ir_sony_decoder
wes@mythfe0:~$
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Sun Apr 12, 2020 10:21 pm

It's already loaded at boot:
===
$ sudo lsmod |grep nuvoton
nuvoton_cir 20480 0
rc_core 53248 4 ir_rc6_decoder,rc_rc6_mce,nuvoton_cir
===
The driver is specified:
===
$ cat /etc/rc_maps.cfg |grep nuvoton
nuvoton-cir * /etc/rc_keymaps/rc6_mce
===
Output of ir-keytable:
===
$ sudo ir-keytable
Found /sys/class/rc/rc0/ with:
Name: Nuvoton w836x7hg Infrared Remote Transceiver
Driver: nuvoton-cir
Default keymap: rc-rc6-mce
Input device: /dev/input/event8
LIRC device: /dev/lirc0
Attached BPF protocols: Operation not supported
Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
Enabled kernel protocols: lirc rc-6
bus: 25, vendor/product: 1050:00c3, version: 0x0033
Repeat delay = 500 ms, repeat period = 125 ms
===
But remote-keypresses do nothing to control the frontend.

User avatar
bill6502
Developer
Posts: 1730
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by bill6502 » Mon Apr 13, 2020 12:39 am

@yawlhoo, as to your original comment about mythfilldatabase, viewtopic.php?f=30&t=3697
or discussions on the mailing list or the v31 Release Notes MythTV Wiki discuss changes to mythfilldatabase. You
didn't mention if you've converted to JSON Schedules Direct downloads (which is mandatory if you use SD.) Using
cron wouldn't help.

wesnewell
Senior
Posts: 672
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Mythtv on Ubuntu 20.04

Post by wesnewell » Mon Apr 13, 2020 12:47 am

So you actually have a keymap file at /etc/rc_keymaps/rc6_mce? If so, post the first line, and tell me what protocol your remote is using. Note that you only have 2 protocols enabled in your ir-receiver, lirc and rc-6. If you use any other protocol than one of those the remote won't work. At minimum, you need to enable the one you are going to use. If you look at my ir-keytable output above, you will notice I just enabled all the receiver supports.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Mon Apr 13, 2020 2:46 am

Thanks for your interest and comments, wesnewell.
===
$ head /etc/rc_keymaps/rc6_mce
# table rc6_mce, type: RC6
0x800f0400 KEY_0
0x800f0401 KEY_1
0x800f0402 KEY_2
0x800f0403 KEY_3
...
===
$ sudo ir-keytable
Found /sys/class/rc/rc0/ with:
Name: Nuvoton w836x7hg Infrared Remote Transceiver
Driver: nuvoton-cir
Default keymap: rc-rc6-mce
Input device: /dev/input/event8
LIRC device: /dev/lirc0
Attached BPF protocols: Operation not supported
Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
Enabled kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
bus: 25, vendor/product: 1050:00c3, version: 0x0033
Repeat delay = 500 ms, repeat period = 125 ms
===
Sorry that this output of ir-keytable differs from that above, I have been doing a lot of installing and uninstalling various packages (including ir-keytable), trying to solve the problem.

I have been hacking away at this for quite a while, reading various documentation and trying all kinds of things. I believe that my problem is not due to a misconfiguration, but means something new is going on with 20.04 LTS. After all, such a platform wraps a whole bunch of new versions of tools as well as the latest kernels; currently I am running:

$ uname -a
Linux nuc3 5.4.0-21-generic #25-Ubuntu SMP Sat Mar 28 13:10:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Mon Apr 13, 2020 3:07 am

In response to bill6502, sometime after I switched to v31 (in early March, I believe) I noticed that mythfilldatabase was not running automagically as it had with v30. This is on my backend running 18.04 LTS, which is fully updated to a JSON Schedules Direct working configuration. I spent quite a lot of time trying to debug why mythfilldatabase was not running (looking thru the MythTV config screens, backend logs, etc.) but was unable to figure anything out.

So I do it via a cron job, which fires at 4:05A and it is working well, for example this morning I saw:
===
Last mythfilldatabase run started on Sun Apr 12 2020, 4:07 AM and ended on Sun Apr 12 2020, 4:07 AM. Successful.
Suggested next mythfilldatabase run: Mon Apr 13 2020, 4:07 AM.
There's guide data until 2020-04-30 01:00:00 (17 days).
===
I'd much rather have it run via the backend MythTV software, to keep the moving pieces to a minimum, but for a while cron will have to suffice.

wesnewell
Senior
Posts: 672
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Mythtv on Ubuntu 20.04

Post by wesnewell » Mon Apr 13, 2020 4:11 am

Try this to include rc-6, not RC6 and others you might want use later.
# table *, type:rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp

Reboot after changes and test remote in notes, terminal, and/or other apps.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

yawlhoo
Junior
Posts: 92
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: Mythtv on Ubuntu 20.04

Post by yawlhoo » Tue Apr 14, 2020 4:59 pm

I been pounding away on this for some time to no avail. It seems as tho everything is in place, but somehow remote key presses are not reaching mythtv, or if they are, they are not causing actions.

I wonder if there is any way to log remote control key press events in mythtv?

Post Reply