Zotac Remote Control for Kodi/XBMC
This article describes the steps needed to configure a Zotac remote control for Kodi/XBMC under Linux.
In the original configuration of Kodi/XBMC in Ubuntu the remote control works at all but several buttons on the remote control e.g. the colored buttons are not recognized by Kodi/XBMC.
This guide was created and tested on the following system:
- Zotac ZBOX ID83
- CPU Intel® Core™ i3-3120M CPU @ 2.50GHz; Intel Graphics HD4000
- 8 GB 1600 MHz DDR3 RAM
- 60 GB Kingston SSDNow V+200 SVP200S37A60G
- Ubuntu 15.04 Vivid Vervet installed from scratch (debootstrap)
- Kernel 4.0.0-997 Ubuntu Mainline intel-drm
- Kodi 14.2 stable
Information Sources
Build and install Lirc from source code
Download and unpack the source code from FernetMentas github repository. If unsure how to do this, please read the Forum thread mentioned above.
zbox:~$ sudo apt-get install wget unzip dialog checkinstall zbox:~$ mkdir src zbox:~$ cd src zbox:~/src$ wget https://github.com/FernetMenta/lirc/archive/master.zip zbox:~/src$ mv lirc-master lirc zbox:~/src$ cd lirc
Now start actually the configure and build process.
zbox:~/src/lirc$ ./autogen.sh zbox:~/src/lirc$ ./setup.sh
(requires package dialog, select driver zotac, save & configure)
zbox:~/src/lirc$ make
Generally it is not the Debian/Ubuntu way to run a make install. Using checkinstall from the package with the same name is a better way. This utility asks for some information and after that generates a Debian/Ubuntu package from the install process. This package may easily become uninstalled using the package manager apt-get purge lirc-zotac.
zbox:~/src/lirc$ sudo checkinstall make install
Configure Lirc
/etc/lirc/hardware.conf
# Chosen Remote Control
REMOTE="Zotac MCE Remote"
REMOTE_DRIVER="zotac"
REMOTE_LIRCD_CONF="zotac/lircd.conf.zotac"
REMOTE_MODULES=""
REMOTE_DEVICE="/dev/remote"
REMOTE_SOCKET=""
REMOTE_LIRCD_ARGS=""
#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
#Disable kernel support.
#Typically, lirc will disable in-kernel support for ir devices in order to
#handle them internally. Set to false to prevent lirc from disabling this
#in-kernel support.
#DISABLE_KERNEL_SUPPORT="true"
#Enable lircd
#START_LIRCD="true"
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"
#Try to load appropriate kernel modules
#LOAD_MODULES="true"
# Default configuration files for your hardware if any
LIRCMD_CONF=""
#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
START_LIRCMD=""
START_LIRCD="true"
LOAD_MODULES=""
/etc/lirc/lircd.conf
#This configuration has been automatically generated via
#the Ubuntu LIRC package maintainer scripts.
#
#It includes the default configuration for the remote and/or
#transmitter that you have selected during package installation.
#
#Feel free to add any custom remotes to the configuration
#via additional include directives or below the existing
#Ubuntu include directives from your selected remote and/or
#transmitter.
#Configuration for the Linux input layer (/dev/input/eventX) remote:
#include "/usr/share/lirc/remotes/devinput/lircd.conf.devinput"
# 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
Configure UDEV
There are two goals of this UDEV rule. First create a link pointing to the correct /dev/usb/hiddev? device. Second it sends a message to the Upstart script that the device is available now.
Create a UDEV rule in file /etc/udev/rules.d/10-ir.rules. It differs from the content of the original article. If using the SUBSYSTEM=="usb" the created link from this rule /dev/remote points to something like /dev/bus/usb/003/002. It seems that lircd cannot handle that device but needs a device like /dev/usb/hiddev?.
The output of
zbox:~$ udevadm info --attribute-walk --name=/dev/usb/hiddev1
showed that a rule containing SUBSYSTEM=="usbmisc" will produce the correct link. It is strongly recommended to not hardcode the /dev/usb/hiddev<num> device in the other config files. On my system the device gets nearly on every reboot a different number.
# /etc/udev/rules.d/10-ir.rules
# vim:set ft=udevrules:
#
# remote control 0471:2168
SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="0471", ATTRS{idProduct}=="2168", SYMLINK+="remote", ACTION=="add", RUN+="/sbin/initctl --quiet emit --no-wait ir-ready"
Configure System Startup
Configure Upstart
# content of /etc/init/lirc.conf
# vim:set ft=upstart ts=2 sw=2 et:
description "lirc"
emits "lirc-ready"
expect fork
start on (remote-filesystems
and local-filesystems
and started rsyslog
and ir-ready)
stop on runlevel [!2345]
pre-start script
while [ ! -e /dev/remote ]
do
sleep 1
done
mkdir /var/run/lirc
end script
exec /usr/local/sbin/lircd -H zotac -d /dev/remote --output=/var/run/lirc/lircd
post-start script
ln -s /var/run/lirc/lircd /dev/lircd
end script
post-stop script
rm /dev/lircd
rm -rf /var/run/lirc
end script
Configure SYSV init
After Upstart isn't default init system anymore, the following simple script in /etc/init.d/lirc will do the job:
#! /bin/sh
### BEGIN INIT INFO
# Provides: lirc
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# X-Start-Before: rmnologin
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Provide support for Zotac remote control
# Description: Provide support for Zotac remote control
### END INIT INFO
. /lib/lsb/init-functions
N=/etc/init.d/lirc
set -e
case "$1" in
start)
mkdir /var/run/lirc
/usr/local/sbin/lircd -H zotac -d /dev/remote --output=/var/run/lirc/lircd
ln -s /var/run/lirc/lircd /dev/lircd
;;
stop)
killall lircd
rm /dev/lircd
rm -rf /var/run/lirc
;;
*)
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit 0
Configure Xorg
Create a file /usr/share/X11/xorg.conf.d/09-zotac.conf with following content. It is not recommended to edit the file /usr/share/X11/xorg.conf.d/10-evdev.conf what recommend other guides, because this file is overwritten during every Xorg update.
This configuration section tells Xorg not to configure the remote control device as a keyboard.
# content of /usr/share/X11/xorg.conf.d/09-zotac.conf # vim:set ft=xf86conf ts=2 sw=2 et: Section "InputClass" Identifier "PHILIPS OVU710023" MatchProduct "PHILIPS OVU710023" MatchIsKeyboard "true" Option "Ignore" "true" EndSection
The exact name of the device differs.
The following command could help to discover the correct name:
zbox:~$ dmesg | grep hid-generic
[ 2.590261] hid-generic 0003:0471:2168.0001: input,hiddev0,hidraw0: USB HID v1.11 Keyboard [PHILIPS OVU710023] on usb-0000:00:14.0-1/input0
Configure Kodi/XBMC
configure and test
While testing keymaps it is often helpful to activate the changed keymap without restarting Kodi/XBMC. There is a XBMC event ReloadKeymaps to handle that. Either you could assign that command to a key on the remote or on the keyboard
<remote> ... <mykey>ReloadKeymaps</mykey> ... </remote>
or you can send it from the command line:
xbmc-send --action=reloadkeymaps
Eventually you have to install the xbmcsend utlity before (here the Ubuntu way):
sudo apt-get install xbmc-eventclients-xbmc-send
~/.kodi/userdata/Lircmap.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Map lirc buttons to Kodi buttons >
<!-- vim:set ft=xml ts=2 sw=2 et: -->
<lircmap>
<remote device="zotac.conf">
<power>KEY_SLEEP</power>
<wake>KEY_WAKEUP</wake>
<record>KEY_RECORD</record>
<pause>KEY_PAUSE</pause>
<stop>KEY_STOP</stop>
<reverse>KEY_REWIND</reverse>
<play>KEY_PLAY</play>
<forward>KEY_FORWARD</forward>
<skipminus>KEY_LEFTSHIFT</skipminus>
<skipplus>KEY_RIGHTSHIFT</skipplus>
<back>KEY_BACK</back>
<info>KEY_INFO</info>
<menu>KEY_MENU</menu>
<up>KEY_UP</up>
<left>KEY_LEFT</left>
<right>KEY_RIGHT</right>
<down>KEY_DOWN</down>
<select>KEY_OK</select>
<volumeplus>KEY_VOLUMEUP</volumeplus>
<volumeminus>KEY_VOLUMEDOWN</volumeminus>
<mute>KEY_MUTE</mute>
<up>KEY_CHANNELUP</up>
<down>KEY_CHANNELDOWN</down>
<zero>KEY_0</zero>
<one>KEY_1</one>
<two>KEY_2</two>
<three>KEY_3</three>
<four>KEY_4</four>
<five>KEY_5</five>
<six>KEY_6</six>
<seven>KEY_7</seven>
<eight>KEY_8</eight>
<nine>KEY_9</nine>
<red>KEY_RED</red>
<green>KEY_GREEN</green>
<yellow>KEY_YELLOW</yellow>
<blue>KEY_BLUE</blue>
<star>KEY_NUMERIC_STAR</star>
<hash>KEY_NUMERIC_POUND</hash>
<subtitle>KEY_TEXT</subtitle>
<guide>KEY_TITLE</guide>
<clear>KEY_CLEAR</clear>
</remote>
</lircmap>
Test, Debug and Troubleshooting
There are different Levels to check if all is going well. To check if Lirc is going well you could use the irw utility. After starting that with root rights it should show a message for every key press on remote control.
zbox:~$ sudo irw 0000000000070051 00 KEY_DOWN zotac.conf 0000000000070052 00 KEY_UP zotac.conf
Problems with the USB device you could detect in the log file at /var/log/lircd. Correct handling looks as follows:
... zbox lircd: lircd(zotac) ready, using /var/run/lirc/lircd zbox lircd: zotac initializing '/dev/remote' zbox lircd: accepted new client on /var/run/lirc/lircd zbox lircd: removed client ...
To check if Xorg and Kodi/XBMC are configured correctly you have to enable debugging inside Kodi/XBMC system settings or using command line
zbox:~$ xbmc-send --action=ToggleDebug
After that you should see the following messages in the XBMC log file after every keypress on remote control:
zbox:~$ tail -f .kodi/temp/kodi.log ... 12:58:44 T:139757977200576 DEBUG: LIRC: Update - NEW at 2594:0000000000070051 00 KEY_DOWN zotac.conf (KEY_DOWN) ... 12:58:52 T:139757977200576 DEBUG: LIRC: Update - NEW at 3409710:0000000000070052 00 KEY_UP zotac.conf (KEY_UP) ...
The most important thing is that 'zotac.conf' in these lines. Otherwise the remote control device is handled by another driver (e.g. inputlirc) and you will not be able to use all remote buttons.