systemd, lircd, mceusb, xbmc and Arch Linux

systemd, lircd, mceusb, xbmc and Arch Linux

NOTICE!!! This guide may be outdated, please check if your distro has a suitable lircd.service already.

After migrating my Arch based media center to systemd, my IR mceusb remote stopped working with lircd.

I needed to do the following steps in order to make it function again.

  1. Copy /usr/lib/systemd/system/lirc.service to /etc/systemd/system/lirc.service (service files in /etc/systemd/system always takes precedence to files located in /usr/lib/systemd/system).
  2. Edit /etc/systemd/system/lirc.service accordingly:
    [Unit]
    Description=Linux Infrared Remote Control
    [Service]
    EnvironmentFile=/etc/conf.d/lircd.conf
    ExecStartPre=/usr/bin/ln -sf /dev/lirc0 /dev/lirc
    ExecStartPre=/usr/bin/ln -sf /run/lirc/lircd /dev/lircd
    ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid
    Type=forking
    PIDFile=/run/lirc/lircd.pid
    [Install]
    WantedBy=multi-user.target

    diff /etc/systemd/system/lirc.service /usr/lib/systemd/system/lirc.service
    5,6d4
    < EnvironmentFile=/etc/conf.d/lircd.conf
    < ExecStartPre=/usr/bin/ln -sf /dev/lirc0 /dev/lirc
    The creation of the symlink to /dev/lirc eliminates lircd errors like this:
    could not get file information for /dev/lirc
    default_init(): No such file or directory

    There may be more “correct” ways of fixing this, but creating the symlink satifies lircd.
  3. Now adjust variables in /etc/conf.d/lircd.conf:
    LIRC_DEVICE="/dev/lirc0"
    LIRC_DRIVER="mceusb"
    LIRC_EXTRAOPTS=""
    LIRC_CONFIGFILE="/etc/lirc/lircd.conf"
    Get the mceusb conf here: http://lirc.sourceforge.net/remotes/mceusb/lircd.conf.mceusb and copy it to /etc/lirc/lircd.conf
  4. Disable lircd conflicting kernel modules by creating a blacklist file /etc/modprobe.d/blacklist_mce.conf containing:
    # Disabling kernel modules for mce
    install ir_rc6_decoder /bin/false
    install rc_rc6_mce /bin/false
    install ir_rc5_decoder /bin/false
    Reboot or remove these modules using modprobe -r.
  5. Reenable lirc.service:
    systemctl reenable lirc.service
    systemctl start lirc.service
    systemctl status lirc.service