I bought some HTPC a few years ago to run XBMC, a neat media
center solution. At the time, to avoid any problems, I installed it on
top of a minimal Ubuntu Lucid installation with the official packages
from the team XBMC. Recently, XBMC Eden has been released and
XBMC has landed into Debian unstable. It was a good
occasion to make the switch.

TL;DR: Installing XBMC on Debian Wheezy is quite easy: it almost
works out of the box. The big difficulty is the configuration of the
remote control: either it works as you expect or you will have to
scratch your head over the pile of layers needed to work with a remote control.
The configuration of my HTPC is as follows:
Contents
Installing Debian Wheezy2 is pretty easy. Nowadays, getting a
bootable USB key from a
netinst image of Debian Installer for Wheezy is simplified:
$ sudo dd if=debian-testing-i386-netinst.iso \ > of=/dev/disk/by-id/usb...
The installation was smooth with the exception of GRUB which was
unable to install itself on the disk. This is a
known bug when dealing with LVM and it comes with a
simple workaround. I hope it will be corrected in time for Wheezy release.
While this has little to do with the installation of XBMC, I wanted to
test systemd which may become the default init in Debian (at
least in Debian GNU/Linux). From
1 | README.Debian |
:
1 systemdcan be installed alongside
1 sysvinitand will not change
the behaviour of the system out of the box. This is intentional.
To test
1 systemd, add
1 init=/bin/systemdto the kernel command
line and then rebooting, or install the
1 systemd-sysvpackage.
The final system boots in about 15 seconds.
Because video decoding in nouveau driver is still a
work in progress, the use of the proprietary NVIDIA drivers is
mandatory to be able to watch high resolution videos. Therefore,
1 | /etc/apt/sources.list |
should be completed with
1 | contrib |
and
1 | non-free |
repository. Then, you can install the appropriate packages:
1 | xserver-xorg-video-nvidia |
,
1 | nvidia-vdpau-driver |
and
1 | xserver-xorg |
.
Here is my
1 | /etc/X11/xorg.conf.d/nvidia.conf |
:
Section "Device" Identifier "NVidia ION" Driver "nvidia" VendorName "NVIDIA Corporation" Option "HWCursor" "False" Option "NoFlip" "False" Option "FlatPanelProperties" "Scaling = Native" Option "DynamicTwinView" "False" Option "ConnectedMonitor" "DFP-1" Option "CustomEDID" "DFP-1:/etc/X11/edid.bin" Option "NoLogo" "True" EndSection Section "Extensions" Option "Composite" "false" EndSection
The
1 | CustomEDID |
option allows the driver to get an appropriate EDID
even when the AV receiver is off. You can get yours, free of charge,
with
1 | get-edid |
from
1 | read-edid |
package.
Thanks to the work of Andrés Mejía, XBMC is now available in Debian
Wheezy. To install it, just type
1 | aptitude install xbmc |
. I have
dropped the following
1 | xbmc.service |
in
1 | /etc/systemd/system |
directory:
[Unit] Description = XBMC media center After = syslog.target [Service] User = xbmc Group = xbmc Type = simple ExecStart = /usr/bin/xinit /usr/bin/xbmc-standalone -- :0 Restart = on-failure [Install] WantedBy = multi-user.target
Enable this service on boot with
1 | systemctl enable xbmc.service |
. You
need to allow
1 | xbmc |
user to run X. The simplest way is to run
1 | dpkg-reconfigure -plow x11-common |
and to allow anybody to run
X.
1 | sudo |
may be an alternative.
While I wanted to use PulseAudio, I want the AV receiver to be
able to upmix stereo streams itself. With PulseAudio, it would always
receive a 6-channel signal. Therefore, I directly use ALSA.
First, unmute the appropriate outputs:
$ amixer scontrols | grep IEC958 Simple mixer control 'IEC958',0 Simple mixer control 'IEC958 Default PCM',0 Simple mixer control 'IEC958',1 $ amixer sset 'IEC958',0 unmute $ amixer sset 'IEC958 Default PCM',0 unmute $ amixer sset 'IEC958',1 unmute $ sudo systemctl stop alsa-utils.service
The order of channels is incorrect. With the following
1 | /etc/asound.conf |
, we declare a new output,
1 | hdmi2 |
, with a different mapping:
pcm.hdmi2 { type asym playback.pcm { type plug slave.pcm "remap-surround51" } } pcm.!remap-surround51 { type route slave.pcm "hdmi" ttable { 0.0= 1 1.1= 1 2.4= 1 3.5= 1 4.2= 1 5.3= 1 } }
In XBMC, this output should be used instead of the default one.
1 | hdmi |
should still be used for passthrough. To check if each speaker is
mapped correctly, one can use
1 | speaker-test -D hdmi2 -c 6 |
.
The LCD display integrated into the SoundGraph iMON is supported by
the
1 | imon |
kernel module and the
1 | lcdproc |
package. I have only
modified a few lines of
1 | /etc/LCDd.conf |
to make it work:
[server] Driver=imonlcd ServerScreen=off [imonlcd] Protocol=1 OnExit=2 Contrast=400
This is the most difficult part. I have a Logitech Harmony remote
which is a great universal remote. Its support in Linux is acceptable:
you can configure through Logitech website and use
congruity to push the new configuration.
Before Linux 2.6.36, most remote controls would need LIRC to work:
1 | /dev/lirc |
.
1 | lircd |
, with the help of a configuration file describing the
protocol used by the remote control, will read the signal and turn
it into the appropriate LIRC code.
1 | lircd |
and receives incoming LIRC codes. It will
translate them to an XBMC command. This translation is specified in
1 | Lircmap.xml |
.
1 | Play |
,
1 | Fullscreen |
,
…) using a keymap. This keymap can handle commands received by
a remote control, but also by a keyboard, a mouse or a joystick.
Since Linux 2.6.36, remote controls will be mapped as a generic
input device (just like a keyboard):
1 | ir-keytable |
. The decoder will
turn the signal into the appropriate event (usually, some keypress).
And to add more complexity to the mix, in this last case, you can
still use LIRC:
1 | lircd |
will listen to events generated by the kernel
and turn them into LIRC codes. This can be very confusing.
Moreover, the SoundGraph iMON IR receiver accepts two IR protocols:
the iMON protocol and the RC-6 one. The Linux driver accepts both of
them but uses the first one by default. The RC-6 protocol is the
protocol used by many MCE remote controls.
I hope you are still with me here.
To get a reasonable configuration out of the box, here is how to
configure each layer:
1 | /etc/lirc/hardware.conf |
, put
1 | DEVICE=/dev/input/by-id/usb-15c2_0038-event-if00 |
and
1 | DRIVER=devinput |
. In
1 | /etc/lirc/lircd.conf |
, just put
1 2 | include "/usr/share/lirc/remotes/devinput/lircd.conf.devinput" |
.
To switch to RC-6 protocol, install the
1 | ir-keytable |
package and use
the following commands:
$ sudo modprobe rc-imon-mce $ sudo ir-keytable -s rc0 -p rc-6 -c -w /lib/udev/rc_keymaps/imon_mce Read imon_mce table Old keytable cleared Wrote 77 keycode(s) to driver Protocols changed to RC-6
To make the change permanent, add the
1 | rc-imon-mce |
module to
1 | /etc/modules |
and create
1 | /etc/udev/rules.d/90-imon.rules |
with the
following content:
# Override the keytable for iMON ACTION=="add|change", SUBSYSTEM=="rc", DRV_NAME="imon", \ RUN+="/usr/bin/ir-keytable -s $name -p rc-6 -c -w /lib/udev/rc_keymaps/imon_mce"
Now, you may want to bind custom actions to some (physical or virtual)
buttons. Basically, you are left with two solutions:
The first option can be quite difficult. You need to find an unused
code for the Logitech Harmony. You can try to make it learn a new code
if you have some RC-6 remote control. Then, you need to ensure that
this code will be present in the keytable used by
1 | ir-keytable |
. If
not, you need to add it. That’s not easy since you need a
to enable some debug stuff in the kernel to find the
appropriate scancode. After that, the code needs to be translated in
1 | lircd.conf |
. You will then have to translate it again in
1 | Lircmap.xml |
. At least, you need to add it to a keymap in XBMC.
The other way is not ideal but seems less cumbersome. The first step
is to configure the Logitech Harmony as a Microsoft MCE keyboard: it
has a lot of available keys. Because of the lack of multimedia keys,
let’s match the keyboard configuration of XBMC:
| Button | Command | Button | Command | ||||
|---|---|---|---|---|---|---|---|
| Channel Down |
|
Stop |
|
||||
| Channel Up |
|
Skip back |
|
||||
| Prev |
|
Skip forward |
|
||||
| Up |
|
Play |
|
||||
| Down |
|
Rewind |
|
||||
| Left |
|
Fast forward |
|
||||
| Right |
|
Star |
|
||||
| OK |
|
Pound |
|
||||
| Menu |
|
Red |
|
||||
| Exit |
|
Green |
|
||||
| Guide |
|
Yellow |
|
||||
| Info |
|
Blue |
|
Unfortunately, the keytables provided with
1 | ir-keytable |
are not
complete enough. I have built a
more complete table3. With this table and the
bindings described above, most functions will work out of the box
without LIRC.
Additional keys can be configured in a dedicated keymap4. Here
is an excerpt of mine:
<keymap> <global> <keyboard> <end>XBMC.ShutDown()</end> <f1>XBMC.ActivateWindow(MusicLibrary)</f1> <f2>XBMC.ActivateWindow(Videos,TvShowTitles)</f2> <f3>XBMC.ActivateWindow(Videos,MovieTitles)</f3> <f4>XBMC.ActivateWindow(Weather)</f4> </keyboard> </global> <FullscreenVideo> <keyboard> <opensquarebracket>SubtitleDelayMinus</opensquarebracket> <closesquarebracket>SubtitleDelayPlus</closesquarebracket> <f6>xbmc.runscript(script.xbmc.subtitles)</f6> </keyboard> </FullscreenVideo> </keymap>
Instead of using SSH, I prefer to drop new files with anonymous
FTP. vsftpd fits this purpose. Here is my configuration file:
listen=YES xferlog_enable=YES use_localtime=YES setproctitle_enable=YES secure_chroot_dir=/var/run/vsftpd/empty nopriv_user=ftp ftpd_banner=XBMC hide_ids=YES ftp_username=xbmc anon_umask=022 anon_root=/home/xbmc/media anonymous_enable=YES write_enable=YES anon_upload_enable=YES anon_world_readable_only=YES
It is currently not compatible with systemd (see bug #670308). I
have removed the symlink in
1 | /etc/rc2.d |
and I have used the following
unit file:
[Unit] Description=Vsftpd ftp daemon After=syslog.target network.target [Service] Type=simple ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf ExecReload=/bin/kill -HUP $MAINPID ExecStartPre=-/bin/mkdir -p /var/run/vsftpd/empty [Install] WantedBy=multi-user.target
In
1 | /etc/default/grub |
, reduce
1 | TIMEOUT |
to 0 to shorten the boot time.
Enabling dirty regions can help speed up XBMC.
1 | aptitude install upower pm-utils |
to be able to shutdown/suspend
from XBMC. Since XBMC was configured to be started outside any
session, you need to explicitely give the appropriate rights by
creating the following
1 | /var/lib/polkit-1/localauthority/50-local.d/xbmc.pkla |
:
[Actions for xbmc user] Identity=unix-user:xbmc Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.* ResultAny=yes ResultInactive=yes ResultActive=yes
The readibility of the LCD screen is very bad. You should look
at the VFD version. The IR receiver reception is poor. The
provided remote control is a joke. ↩
Debian Wheezy is not yet released. If you are unfamiliar
with Debian, it may be cumbersome to maintain it until the
freeze happens in a few months. ↩
Some keys are missing from the provided table. For
example, there is no exclamation mark. While there is a
scan code for such a key in RC-6 protocol, there is no
appropriate key code to translate to: on a QWERTY
keyboard, the exclamation mark is on the same key as the
number 1. It is possible to map it to some other key code,
but the mapping would have been difficult to use. ↩
For example, in
1 | ~/.xbmc/userdata/keymaps/harmony.xml |
. ↩
Article source: Go to Source
Feed source: http://planet.debian.org/rss20.xml
License: The original licenses are retained – MIT (Expat) License