Zotac ID81 remote with LibreElec 9.2.2

Zotac Remote & Receiver

Upgrading from OpenElec 7.0.1 to LibreElec 9.2.2, I found many of the buttons on my remote – namely the "Windows" and Teletext buttons – no longer worked.  It's an external remote & USB receiver combo that's bundled with many Zotac Mini PCs, like the ID81.

The receiver reports as a PHILIPS MCE USB IR Receiver- Spinel plus (Device ID 0471:20CC).

As far as I can tell, the key difference between OpenElec 7.0.1 (and likely LibreElec 7.x too) and LibreElec 9.2.2 is most of the handling of remotes moved from lircd (which handles remotes directly) to eventlircd (where most remotes are now handled by the kernel).

The bundled USB receiver here presents itself as a regular old USB HID keyboard.  While there was a patch written to support it, it was removed in 2018 due to constantly breaking kernel updates.  Fortunately, lircd included in LibreElec still includes the zotac driver (though with a bug).

You'll need SSH access to your installation to proceed.

1. Update LibreElec

The zotac driver in the LibreElec 9.2.2 release has a bug.  HiassofT has patched it, but it doesn't look like it'll be included in a mainstream release until LibreElec 10.

Grab this build from HiassofT:

cd /storage/.update
wget 'https://www.horus.com/~hias/tmp/libreelec/LibreELEC-Generic.x86_64-9.2-devel-20200408115852-106a54a.tar'
reboot

2. Add a udev rule for the USB receiver

With your favourite editor (e.g. nano), create the file /storage/.config/udev.rules.d/99-zotac.rules with:

SUBSYSTEM=="usbmisc", ACTION=="add", \
    ATTRS{idVendor}=="0471", ATTRS{idProduct}=="20cc", \
    SYMLINK+="remote"

SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", \
    ATTRS{idVendor}=="0471", ATTRS{idProduct}=="20cc", \
    ENV{eventlircd_enable}="false", ENV{LIBINPUT_IGNORE_DEVICE}="1"

The first rule creates the symlink /dev/remote that lircd uses (later); the second tells eventlircd and libinput to ignore the device, so we don't get duplicate keypresses.

3. Tell xorg to ignore the USB receiver

Since lircd will be handling all the input from the receiver, we don't want xorg to treat it as a USB keyboard.

Pick the xorg.conf file that matches your graphics card from /etc/X11 (e.g. xorg-i915.conf for an embedded Intel "HD Graphics" adapter).

Copy it to /storage/config/xorg.conf; and append it with the following:

Section "InputClass"
  Identifier "PHILIPS MCE USB IR Receiver- Spinel plus"
  MatchProduct "PHILIPS MCE USB IR Receiver- Spinel plus"
  MatchIsKeyboard "true"
  Option "Ignore" "true"
EndSection

4. Configure lircd

  • Copy /etc/lirc/lirc_options.conf to /storage/.config/lirc_options.conf; and change:
    • driver from default to zotac
    • device from /dev/lirc0 to /dev/remote
  • Create /storage/.config/lircd.conf with the following content:
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.1-git(zotac) on Mon Apr  2 14:10:29 2012
#
# contributed by
#
# brand:                       zotac.conf
# model no. of remote control:
# devices being controlled by this remote:
#

begin remote

  name  zotac.conf
  bits           32
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  gap          100123
  min_repeat      9
#  suppress_repeat 9
#  uncomment to suppress unwanted repeats
#  toggle_bit_mask 0x7004F

      begin codes
          KEY_SLEEP                0x00010082
          KEY_WAKEUP               0x00010083
          KEY_RECORD               0x000C00B2
          KEY_PAUSE                0x000C00B1
          KEY_STOP                 0x000C00B7
          KEY_REWIND               0x000C00B4
          KEY_PLAY                 0x000C00B0
          KEY_FORWARD              0x000C00B3
          KEY_LEFTSHIFT            0x000C00B6
          KEY_RIGHTSHIFT           0x000C00B5
          KEY_BACK                 0x000C0224
          KEY_INFO                 0x000C0209
          KEY_MENU                 0xFFBC000D
          KEY_UP                   0x00070052
          KEY_LEFT                 0x00070050
          KEY_RIGHT                0x0007004F
          KEY_DOWN                 0x00070051
          KEY_OK                   0x00070028
          KEY_VOLUMEUP             0x000C00E9
          KEY_VOLUMEDOWN           0x000C00EA
          KEY_MUTE                 0x000C00E2
          KEY_CHANNELUP            0x000C009C
          KEY_CHANNELDOWN          0x000C009D
          KEY_1                    0x0007001E
          KEY_2                    0x0007001F
          KEY_3                    0x00070020
          KEY_4                    0x00070021
          KEY_5                    0x00070022
          KEY_6                    0x00070023
          KEY_7                    0x00070024
          KEY_8                    0x00070025
          KEY_9                    0x00070026
          KEY_0                    0x00070027
          KEY_NUMERIC_STAR         0x10070025
          KEY_NUMERIC_POUND        0x10070020
          KEY_CLEAR                0x00070029
          KEY_TEXT                 0xFFBC005A
          KEY_TITLE                0x000C008D
          KEY_ENTER                0x00070028
          KEY_RED                  0xFFBC005B
          KEY_GREEN                0xFFBC005C
          KEY_YELLOW               0xFFBC005D
          KEY_BLUE                 0xFFBC005E
      end codes

end remote

5. Reboot

...and enjoy!

Many many thanks to LibreElec developer HiassofT for helping me sort this out.

Original thread here: https://forum.libreelec.tv/thread/21597-remote-woes-after-updating-to-9-2-1/