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

For discussion of topics specific to MythTV on linux
nexzzt
Junior
Posts: 17
Joined: Wed Jun 18, 2014 3:58 am
Australia

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

Post by nexzzt » Mon Jun 01, 2020 3:26 am

Ah OK, looks good to me. Moving on...

Lester_Burnham
Newcomer
Posts: 14
Joined: Sat Jun 14, 2014 7:50 am
Australia

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

Post by Lester_Burnham » Mon Jun 01, 2020 4:19 am

wesnewell wrote:
Fri May 29, 2020 4:39 am
Did a fresh install of 20.04LTS and no luck with ir-keytable. While all the remote buttons work using ir-keytable -t, only a few work in apps. All 4 arrow keys and the Return key are the only ones that worked in app or CL iirc. Not sure why it doesn't work. More info here.
https://answers.launchpad.net/ubuntu/+question/690977

But no response yet. In the meantime, I've just switched to using mini wireless KB's.
Hi,

In 20.04 with ir-keytable I didn’t have to set a config file. (rc_maps.cfg) I remember years ago I needed a config as you have done, but not this time.
With mine I just had to copy the remote file from “sudo cp /lib/udev/rc_keymaps/rc6_mce.toml /etc/rc_keymaps/“ then modify the button presses to suit what key I wanted to see output. Need to reload config and restart the frontend to test from memory.
Maybe it’s something as simple as your old config is tripping it up.

Lester

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

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

Post by wesnewell » Mon Jun 01, 2020 4:50 am

Could be. Problem is my remote uses my own codes that I uploaded to the remote. I've added an entry for it in /lib/udev/rc_keymaps/
wes@mythfe0:~$ ls /lib/udev/rc_keymaps/my*
/lib/udev/rc_keymaps/myremotes.toml
But I'm not sure it's in the right format yet. Been busy with something else and will get back to this later.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

Lester_Burnham
Newcomer
Posts: 14
Joined: Sat Jun 14, 2014 7:50 am
Australia

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

Post by Lester_Burnham » Mon Jun 01, 2020 7:05 am

No worries.
What ever is in /etc/rc_keymaps/ is loaded by default, otherwise if you only have your remote config in /lib/udev/rc_keymaps/ you will need to tell it what to load. Which is what your config used to do.

You could try just copying your config to /etc/rc_keymaps/ and reload ir-keytable to see what happens.

My rc6_mce.toml has the likes of these codes in there. The scan code is very different to yours.
0x800f0408 = "KEY_8" #WAS KEY_NUMERIC_8
0x800f0409 = "KEY_9" #WAS KEY_NUMERIC_9
0x800f040a = "KEY_DELETE"
0x800f040b = "KEY_ENTER"
0x800f040c = "KEY_SLEEP"
0x800f040d = "KEY_M" #WAS KEY MEDIA

Good luck when you get around to it.
Lester

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

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

Post by wesnewell » Wed Jun 03, 2020 7:38 pm

OK, finally took some time to look into this more and got it working in all apps and CL. Had to redo my rc-map file because the one from 18.04 wouldn't load properly and renamed it to *.toml. Once I did that, I had to manually load it. I also copied it to lib/udev/rc_keymaps dir and usr/lib/udev/rc_keymaps. I don't know if that's needed but... To get it to load automatically on boot, I had to make it the top entry in /etc/rc_maps.cfg.
Here's portions of that;

# Table to automatically load the rc maps for the bundled IR's provided with the
# devices supported by the linux kernel
mceusb * /etc/rc_keymaps/myremotes.toml

#driver table file
* rc-adstech-dvb-t-pci adstech_dvb_t_pci.toml

And here's the top of my map file.Note the equal signs and quotes. Also had to remove trailing comments from original.

[[protocols]]
name = "myremotes"
protocol = "nec"
variant = "nec"
[protocols.scancodes]
0x0f = "KEY_F12"
0x2b = "KEY_L"
0x29 = "KEY_T"
0x26 = "KEY_B"
0x21 = "KEY_COMMA"

Hope this gives you enough to get yours working.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

Lester_Burnham
Newcomer
Posts: 14
Joined: Sat Jun 14, 2014 7:50 am
Australia

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

Post by Lester_Burnham » Thu Jun 04, 2020 9:26 am

Hi,

I see some smart cookie on the mailing list figured out the new lirc remote and blasting setup. I was interested in the remote part and it works well. I just needed to tweak the mythtv lircrc to match some remote buttons for an mceusb. Need to look at irexec Now to launch apps.

https://www.mythtv.org/wiki/FTDI_USB_IR ... using_LIRC

I’m fine with what I have now, but it’s good to have options.
Lester

nouglywires
Newcomer
Posts: 8
Joined: Sun Nov 23, 2014 7:17 pm
United States of America

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

Post by nouglywires » Sat Oct 03, 2020 7:05 pm

Thanks for this thread, and thanks especially to wesnewell who got me pointed in the right direction. Here are the details of what i did to get my remote control working again with MythTV after upgrading from 18.04 to 20.04.1:
wesnewell wrote:
Wed Jun 03, 2020 7:38 pm
Had to redo my rc-map file because the one from 18.04 wouldn't load properly and renamed it to *.toml.
KEY_RETURN (the numpad Enter key) is no longer supported; I had to make that KEY_ENTER.

You must add sections for protocols and protocols.scancodes. Here's the new preamble in my /etc/rc_keymaps/rc6_mce.toml. The Debian manual page for ir-keytable lists some known protocols and variants:

Code: Select all

[[protocols]]
name = "myremotes"
protocol = "rc-6"
variant  = "rc-6-mce"
[protocols.scancodes]  
Previously, this simple format was supported:

Code: Select all

0x800f0412 KEY_PAGEUP
Now you must code

Code: Select all

0x800f0412 = "KEY_PAGEUP"
I ran "sudo ir-keytable -c -p rc-6 --write=/etc/rc_keymaps/rc6_mce.toml --sysdev=rc0" and ! my remote control worked again. (I determined the sysdev from the output of ir-keytable (no arguments - it "Found /sys/class/rc/rc0/ with: ..."). "-p" sets the protocol to rc-6, -c clears existing entries (you may not want to do this).

I have only one copy of the file - /etc/rc_keymaps/rc6_mce.toml - and the first line of /etc/rc_maps.cfg points to it:

Code: Select all

mceusb * /etc/rc_keymaps/rc6_mce.toml
I also had to ensure that this runs on every restart, so I saved the command into a script - /usr/local/bin/ir-keytable-setup.sh (root:root, 755) :

Code: Select all

#!/bin/bash
sudo ir-keytable -c -p rc-6 --write=/etc/rc_keymaps/rc6_mce.toml --sysdev=rc0
and made it a service - this goes in /etc/systemd/system/ir-keytable-setup.service (root:root, 644)

Code: Select all

[Unit]
Description=Set IR Keytable for Myth TV
After=network.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/ir-keytable-setup.sh

[Install]
WantedBy=default.target
To verify that the service works, execute sudo service ir-keytable-setup start and check the results with ir-keytable -r

Now do sudo systemctl enable ir-keytable-setup and reboot.


I hope someone finds this helpful.

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

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

Post by heyted » Mon Nov 02, 2020 12:05 am

My experience:

On my Ubuntu 20.04 Asus box with an Inteset IR receiver, setup was very easy. I just replaced the contents of /lib/udev/rc_keymaps/rc6_mce with my previous 18.04 info, edited the info to match the new toml format, added the top protocols info, and rebooted. That worked.

On my Xubuntu 20.04 Zotac box with an Inteset IR receiver, setup was not as easy. I tried placing the edited toml file in /etc/rc_keymaps/, rebooted, but that did not work. I tried editing /etc/rc_maps.cfg and rebooted, but that did not work. I used an /etc/systemd/system service file similar to that used by nouglywires. That worked.

Code: Select all

[Unit]
Description=Load rc_keymap file
After=rc-local.service systemd-user-sessions.service

[Service]
Type=oneshot
ExecStart=bash -c "ir-keytable -c -w /etc/rc_keymaps/bdrm_remote.toml"

[Install]
WantedBy=multi-user.target
Ted | My blog

instantlinux
Newcomer
Posts: 1
Joined: Fri Dec 18, 2020 3:23 am
Location: San Francisco
Contact:
United States of America

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

Post by instantlinux » Fri Dec 18, 2020 3:47 am

After quite a bit of digging, I found this pair of bug reports in the upstream Ubuntu repository (for package v4l-utils):

- https://bugs.launchpad.net/ubuntu/+sour ... ug/1903966
- https://bugs.launchpad.net/ubuntu/+sour ... ug/1906986

The udev rule that used to work in 18.04 has to be updated. Ubuntu 20.04.1 LTS currently has v4l-utils version 1.18.0-1. If you type this:

dpkg -s v4l-utils

and see a version less than 1.20.0-2 (released 1-Dec-2020), you can workaround the issue by manually adding the file /lib/udev/rules.d/70-infrared.rules with this content:

Code: Select all

# Automatically load the proper keymaps after the Remote Controller device
# creation.  The keycode tables rules should be at /etc/rc_maps.cfg

ACTION=="add", SUBSYSTEM=="input", SUBSYSTEMS=="rc", KERNEL=="event*", ENV{.rc_sysdev}="$id", RUN+="/usr/bin/ir-keytable -a /etc/rc_maps.cfg -s $env{.rc_sysdev}"
If you have a custom keymap file, you need to put it in .toml format thus:

Code: Select all

[[protocols]]
name = "myremotes"
protocol = "rc6"
variant  = "rc6_mce"

[protocols.scancodes]  
0x800f0400 = "KEY_0"
0x800f0401 = "KEY_1"
 ...
The older formats that don't have a protocols header don't work anymore. My old keymap file had a third field on each scancode line; I had to drop the third field (keycode) and simplify to just specify scancode = "name". Because I installed MythTV a dozen years ago, the keycode names in my database are undoubtedly different from those found in a fresh install. If this is the case for you, and you have a keymap that works under 18.04, keep the names that were working for you.

Look in the directory /lib/udev/rc_keymaps for the name of the file matches your remote. Using that same file name, put your customized version into the (empty directory from the distro) /etc/rc_keymaps. It must have the suffix .toml. The udev startup rule, as corrected above, will look for your remote there in /etc before looking in /lib/udev/rc_keymaps.

By adopting this solution, the other workarounds proposed earlier in this thread (adding a /etc/rc.local or systemd unit file, plus some other suggestions I tried) aren't needed. Edit: After writing the above and verifying it on my first frontend, I found it didn't work on a second frontend. I wound up adding this file as /etc/rc.local - to run the exact same command as the one defined in udev:

Code: Select all

#!/bin/bash
/usr/bin/ir-keytable -a /etc/rc_maps.cfg 2>&1 | /usr/bin/logger -t ir-keytable-fudge
The frontends are running kernel 5.4.0-58.

None of this is well-documented anywhere, and I cannot fathom why the upstream repos ever bother to change code related to antiquated IR technology -- but I've had to overhaul this every couple years since the 2000s. Hope this explanation helps. I'm open to suggestions on how to improve upon this analysis and solution.
Last edited by Steve Goodey on Fri Dec 18, 2020 8:12 am, edited 3 times in total.
Reason: url amended as new user.
- rich braun

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

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

Post by wesnewell » Fri Dec 18, 2020 5:10 am

Don't know if it's mentioned here, but newer kernels have broken ir-keytable.
https://bugs.launchpad.net/ubuntu/+sour ... ug/1901089
https://bugzilla.kernel.org/show_bug.cgi?id=210755
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.

Post Reply