metaruss

MythTV and the Adesso Vista MCE Remote Control

by on Aug.16, 2023, under Computing

I am documenting here, for posterity, my journey while trying to maintain support for the Adesso Vista MCE remote control on my MythTV front ends.  Yes, I still use Myth and I believe I have had a backend running continuously since 2004, possibly earlier.  I’ve had plenty of misadventures with it over the years, but the one thorn that has always been in my side is IR remote control support.  In the early days, this was pretty clumsy as it required the use of LIRC: an out-of-tree set of drivers to support IR receivers through a serial interface.  I would usually use it with some generic universal remote control or a remote that came with a video capture card.  Once it was working, it usually worked fine for a while.  However when it came time to perform an OS upgrade, the remote would always be broken because of issues between LIRC and the kernel.  LIRC went through several generations of config changes as well, so my painstakingly-created lircrc would often not work even when I managed to get LIRC itself working.  Eventually I threw in the towel and bought a bespoke MCE remote that was supposed to “just work”.  There were a number of these available that were designed to work with Windows Media Center.  I chose…poorly.

Originally, the Adesso Vista MCE Remote Control was supported in MythTV via the mceusb LIRC driver.  Since it was being supported through LIRC, keys could easily be remapped in the usual way.  Of course, it wasn’t quite that simple as the usbhid driver always wanted to grab the device before mceusb could find it (it presents itself as a HID keyboard).  The workaround was to blacklist usbhid, which created other problems but I didn’t care about other HID devices on my frontends.  Even so, LIRC always remained frail; the drivers were a pain to port and compile, and the whole thing would still break somehow every couple of years at the next Debian upgrade.

Eventually, the mceusb driver was abandoned and the usbhid driver itself became the only way to support the Vista MCE.  It mostly worked, as the default keymap for it had been improved.  Most incorrect keys could be remapped within MythTV itself.  However for technical reasons, there are two very important keys that can only be remapped via ir-keytable triggered by udev rules: ESC (the back key) and M (to bring up the menu).  These rules did the trick:

KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",IMPORT{program}="input_id %p"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_KEYBOARD}=="1",ACTION=="add",SYMLINK="input/irremote0", RUN+="/usr/bin/ir-keytable --set-key=0x70029=KEY_BACKSPACE,0x7002a=KEY_ESC --device %N"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_MOUSE}=="1",ACTION=="add",SYMLINK="input/irremote1", RUN+="/usr/bin/ir-keytable --set-key=0x90002=KEY_M --device %N"

This worked fine until one day the ir-keytable tool dropped support for the –device option for reasons that are not clear.  Sean Young claimed it did not work and was “misleading”, however there are no apparent alternatives since the remote is handled as a straight HID device and does not present itself as an rc device anywhere in the kernel.  The –device option is literally the only way to get it to work.

As with everything related to IR, the flavor of the month to support this thing has likely shifted to some other subsystem.  For now, I am pinning ir-keytable to the version from Debian 11 “Buster” (you can also use “apt-mark hold”).  This still works as of the upgrade to Debian 12 “Bookworm”, but I suspect that I will have to forward-port –device support back into the tool at some point or find some other way to reach the device.

Package: ir-keytable
Pin: release n=buster
Pin-Priority: 1000

This workaround seemed to work fine until I noticed a timing issue in udev causing the RUN command to fail in some cases where the device node had not quite been created by the kernel yet.  To work around this, the calls to ir-keytable were moved to a script that introduces an artificial delay before actually calling ir-keytable.  The udev rules were adjusted thusly:

KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",IMPORT{program}="input_id %p"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_KEYBOARD}=="1",ACTION=="add",SYMLINK="input/irremote0",RUN+="/usr/local/bin/mce-remap keyboard %N"
KERNEL=="event*",SUBSYSTEM=="input",ATTRS{idVendor}=="05a4",ATTRS{idProduct}=="9881",ENV{ID_INPUT_MOUSE}=="1",ACTION=="add",SYMLINK="input/irremote1",RUN+="/usr/local/bin/mce-remap mouse %N"

I hate this remote.  I suppose I could buy a different one, but I don’t see the point as the entire concept of a DVR is waning.  Myth’s days are numbered.

No comments for this entry yet...

Leave a Reply

Search

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact me.

Sites that interest me

A few highly recommended friends...

Meta