What's current best practice for remote controls?

For discussion of topics specific to MythTV on linux
Post Reply
loddonlily
Junior
Posts: 40
Joined: Sun Mar 31, 2019 10:03 am
Great Britain

What's current best practice for remote controls?

Post by loddonlily »

Excuse me for asking a question that's been asked a zillion times, but I am going bug-eyed from all the contradictory threads I've been reading on this topic, some of which are very old!

I've had a working Ubuntu/MythTV/Kodi setup for many years, upgraded various times, using LIRC and a Harmony Remote with a MCE-compatible receiver. When I built on Ubuntu 18.04, I remember that at the time there was a lot of concern about later LIRC versions, so I followed some advice to grab an old version from the 16.04 repos and use that.

For various reasons I've now updated everything. My backend MythTV is at v32, and my frontend is also at v32, on Ubuntu 22.04, with a recent Kodi (can't remember which right now). It mostly works fine.

But what do I do about LIRC? "Out of the box", presumably using EVDEV and not LIRC, things more or less work - but not close enough to be usable. I've read in one place that I should forget LIRC and just use EVDEV, but as I say a good number of keys aren't working and in any case Kodi insists on installing LIRC.

I don't mind spending time chasing through a pile of options and configurations (well, I kind of do but I accept it!) but I've got no confidence that I'm heading in the right direction.

Can anyone give me just a few pointers about what is considered best practice these days? I can configure the Harmony to do most things, that's not the issue. But I do want to be able to set activities for MythTV and Kodi, and to be able to run scripts (was via irexec with LIRC) to switch between the two.

[Aside: I don't find the Myth plugin to Kodi very usable, so don't want to consolidate on that as a single UI]

Line-by-line instructions aren't necessarily what I'm looking for (though if they exist somewhere I'd like to see them), more just a general strategy pointer so I don't waste any more time flogging dead horses. Old LIRC? New LIRC? No LIRC?
loddonlily
Junior
Posts: 40
Joined: Sun Mar 31, 2019 10:03 am
Great Britain

Re: What's current best practice for remote controls?

Post by loddonlily »

Hmm, 38 views so far and no responses... was that was because it was a dumb question, or because no-one fancied taking it on? ;)

OK, I'll have a go myself having spent another couple of days playing and researching. I make absolutely no claim to superior knowledge, so if you know better then please do chip in! But there really is an awful lot of old, contradictory advice out there...

Baseline: this is for a Xubuntu 22.04 HTPC running Mythfrontend V32, and Kodi. Fresh install on old hardware. MCE compatible IR reader, Logitech Harmony Elite remote control (using "Microsoft Windows Media Centre" configuration).

Credit to this thread: viewtopic.php?f=29&t=3729

So my conclusion is that the kernel-based, evdev, irkeytable, approach is the way to go. Lirc is very old, and not being maintained, and there are sooo many complaints about later versions. OK, so use the newer stuff then ... it's very tempting, especially when you do a vanilla install and it so nearly works straight out of the box.

BUT I find that a load of keys just don't work, and its driving me nuts. It ought to be easy: I can tweak the "keys" that the remote is sending, I can change the ir-keytable, and I can change keymapping in Myth. How can it go wrong? Easy,it turns out.

The killer for me was that I could press a key on the remote ("1" or "OK" or "Yellow", say), and see what looked like a suitable response with "ir-keytable -t" - "KEY_NUMERIC_1" or "KEY_OK" or "KEY_YELLOW". But these keys are steadfastly ignored by Mythfrontend or indeed anything else, and it took a passing comment in the thread I mentioned to put me on the right lines. Nearly all of the keycodes generated by my remote were >256, which X (apparently) doesn't like.

The solution was to create a customised ir-keytable (/etc/rc_remotes/xxx.toml) to map all of the offending keys to something <256, like "KEY_1" or "KEY_ENTER". And then, where necessary, map keys again in Mythfrontend to do something useful.

Mythfrontend is now working nicely, though its possible I will have to tweak further when I set about fine tuning Kodi (because the ir-keytable has to work for both).

One final touch was that with my "old" setup I used irexec to run scripts to start and stop Mythfrontend and Kodi, which is no longer available in this model. The simple workaround was to find a couple of unused commands and assign them to keyboard shortcuts in Ubuntu, which run the required scripts. Credit: https://ubuntuforums.org/showthread.php?t=2403500

One last point: several times while looking into this I found myself exhorted to remove all traces of Lirc before trying to do this. While I can kind of understand that, it's a bit difficult if you want to use Kodi as it's automatically installed as a dependency! So I chose to ignore that advice.

I can't say I have cracked everything but its looking promising. If anyone with real knowledge would like to chip in, you'd be very welcome!
yawlhoo
Senior
Posts: 120
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: What's current best practice for remote controls?

Post by yawlhoo »

I hesitantly weigh in, because I'm certainly no expert on this.

I have installed lirc on several upgraded systems using this howto:

https://twosortoftechguys.wordpress.com ... ntu-18-04/

and it works.

Whether this is the best way to go or not, I leave that to the experts.

FWIW.
loddonlily
Junior
Posts: 40
Joined: Sun Mar 31, 2019 10:03 am
Great Britain

Re: What's current best practice for remote controls?

Post by loddonlily »

Yes, I looked at that - in fact I'm pretty sure that's what I did when I build an 18.04 system some years ago. Have you been able to do that on recent (eg 22.04) builds?
yawlhoo
Senior
Posts: 120
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: What's current best practice for remote controls?

Post by yawlhoo »

My current frontend is Ubuntu 20.04.4 LTS, the lirc "fix" works on that.

I have one system that is 22.04, but I had a problem with it working with my label printer, so I installed 20.04 in a partition and I'm dual-booting to it.

I tried the lirc fix on the 22.04 system, but immediately ran into a missing key for the xenial repository error in the initial install of the old lirc package, and gave up.

ir-keytable is supposed to be the answer, but in the past I've been unable to get it working with my setup.

When you get a frontend/backend setup of Mythtv working it's lovely. But it can be absolute hell getting there!
yawlhoo
Senior
Posts: 120
Joined: Wed Apr 15, 2015 4:18 pm
United States of America

Re: What's current best practice for remote controls?

Post by yawlhoo »

FWIW, I solved the missing key problem using apt-key as in the following:

https://linuxconfig.org/ubuntu-20-04-gp ... e-verified

I then was able to install the xenial lirc and pin the version per the twosortoftechguys link above.

irw reports the remote's key presses via /dev/lirc0. However, as far as the remote controlling Mythtv goes, no joy. Whether that's a fundamental problem with the approach, or just some misconfiguration of the system, I don't know.
loddonlily
Junior
Posts: 40
Joined: Sun Mar 31, 2019 10:03 am
Great Britain

Re: What's current best practice for remote controls?

Post by loddonlily »

Just an update in case anyone is interested, i.e. following a similar path! In the end I have both Myth and Kodi working satisfactorily, I think - there may be the odd tweak required but it's close enough. And, of course, the vast majority of the rabbit holes I dived into were just that, and if I'd known what I was doing it would have been a whole lot easier!

As I now have it Kodi is completely out-of-the box - the default keyboard.xml (note - the remote, used this way, appears as a keyboard) is fine.

Mythfrontend is almost out-of-the-box ... I think I ended up only changing a handful of key mappings, if that. P for Play and Space for Pause was the main change, I think.

Most of the heavy lifting was done in /etc/rc_keymaps/rc6_mce.toml , where almost all of the keys I'm actually using had to be remapped, such as KEY_NUMERIC_1 to KEY_1, KEY_PLAY to KEY_P, KEY_EXIT to KEY_ESC and many others.

The Harmony remote configuration wasn't too far off the default, though I did map STOP differently for the Myth and Kodi activities (as Myth doesn't have a Stop function).

I dare say that none of this will come as a surprise to people who already have this working, but it's been hard work for me, mainly because of the vast amount of contradictory and out-of-date info that is still floating around. Maybe somone hunting in future will find this helpful!
User avatar
heyted
Senior
Posts: 301
Joined: Sun Jun 08, 2014 2:14 am
Location: South Florida
Contact:
United States of America

Re: What's current best practice for remote controls?

Post by heyted »

Ubuntu users with a remote and receiver that is compatible with a kernel driver can use Mythbuntu Control Panel to quickly configure a remote.

Wiki: https://www.mythtv.org/wiki/Mythbuntu_C ... g_a_Remote
Related forum thread: viewtopic.php?f=3&t=4678
Ted | My blog
Post Reply