XBMC HTPC

After my old CD-Player broke down I decided that it would be time to replace the 20 year old ancient HiFi rack with something more suitable. Either an universal player or a self built HTPC. The HTPC won obviously...

= Hardware =

I built the PC based on a recommendation from c't Magazine 26/2012 -not the most recent hardware (from a mid-2013 point of view) and not the cheapest possible system and also not the most silent solution, but a good overal setup:


 * CPU: Celeron G1610 'boxed' (including cooler and fan)
 * Motherboard: Gigagbyte GA-Z77MX-D3H
 * RAM: 2x4 GB Transcend JM1333KLN-8GK
 * Disk: Samsung 840 Pro 128 GB
 * BluRay: Pioneer BDR-208DBK
 * Case: Silverstone GD04B
 * Power supply: be quiet! Pure Power L7 350W
 * Case fan: 2x Scythe Slip Stream 120 500rpm (SY1225SL12SL)
 * flirc.tv: IR dongle (shares the remote of my Sony TV)

Surprisingly, there are only very few HTPC cases, which fit in a HiFi rack, while having enough space for regular microATX components, a full size BD-ROM player and USB 3 front ports.

I had a look at the Silverstone GD04B (the only with USB 3 front connectors AND a full size drive bay), the FractalDesign Node605 (only slimline drives) and the OrigenAE H6 (no front USB 3) which I liked the most, but which was unfortunately too large for my cabinet. Finally I chose the Silverstone case. The aluminium front panel is nice, but the overall built quality is not spectacular given the price (and it has only two "HiFi" feet at the front).

I had to replace the fans, which came with the Silverstone case, because they are really noisy. The CPU fan is acceptable. Overall, this makes for a very silent (but still audible) system, which -thanks to the SSD- boots in < 20 sec. to XBMC.

All media data is stored on a home NAS, thus only a small system disk had to be installed.

Assembly
Straight forward, no surprises -although I can't remember when I last had to dig out a screwdriver to fix drives and case lids in place (no thumb screws on the GD04).

Some Images:

As you can see, the mainboard and the power supply fit well into the Silverstone chassis. The BD-drive will sit on top of the motherboard, providing some headache in case you want to replace the boxed cooler and fan with a low noise cooler.

There are quite a few reviews on the case out there, so no more details.

= Software =


 * Operating System: Had to be Linux if possible. The most mainstream Media Center software seemed to be XBMC, which is developed using Ubuntu, so this decided the flavour of underlying OS. To prevent a reinstall every 9 month or so, I decided to go with the current LTS version 12.04 Precise Pangolin. In case things would not work out (e.g. unresolvable issues with graphics, sound or BD-playback) I had planned to fail back to Windows 7.
 * Media Center Software: XBMC 12 Frodo.

Installation
I did a Ubuntu 12.04 minimal install (from CD-RW), basically following the HowTo discussed on http://wiki.xbmc.org/index.php?title=Installing_XBMC_for_Linux#Official_Team_XBMC_repositories. It took me surprisingly long to find out, what the basis for XBMCbuntu is, and which alternatives exist (I considered OpenElec and other distros/other versions of Ubuntu).

There are several other HowTos, which are more detailed and apparently there is none covering the most recent version vanilla installation in details (although this is easy to do, it would be nice).

login as unpriviledged Ubuntu user "xbmc".

sudo su - apt-get install python-software-properties pkg-config apt-get install software-properties-common add-apt-repository ppa:team-xbmc/ppa apt-get update apt-get install xbmc

First test start (no autostart yet)

exec su -c "xinit /usr/bin/xbmc --standalone -- -nocursor :0" xbmc

Hardware acceleration
It worked (tm), but without hardware acceleration apparently, see Debug settings in XBMC or simply press "o" (see http://wiki.xbmc.org/index.php?title=Keyboard for the XBMC keyboard layout).

Hardware acceleration should work, but it does not. Reading XBMC forum entries yielded some hints, that the Intel driver must be above a certain version number.

Check version of driver: apt-cache policy xserver-xorg-video-intel --> [..]2:2.17[..]

this is too old (e.g. no sna acceleration for Intel 2000), need to install this from yet another ppa

sudo add-apt-repository ppa:glasen/intel-driver [..]Installs 2.2:21[..]

There where some warnings about KMS deactivated in grub with e.g. "i915.modeset=0" in /etc/default/grub

sudo apt-get update sudo apt-get dist-upgrade

This installed mesa et al. and the new Intel driver.But starting xbmc crashed the X server.

It seemed that X had been initialized using the correct SNA module:

xbmc@hollywood:~$ cat /var/log/Xorg.0.log | grep -i sna [   48.445] (**) intel(0): Option "AccelMethod" "sna" [   48.776] (II) intel(0): SNA initialized with Ivybridge (gen7, gt1) backend

It turns out, that the default user does not belong to the video group by default, see: http://ubuntuforums.org/showthread.php?t=2122588, which boils down to

xbmc@hollywood:/var/log$ sudo usermod -a -G video xbmc xbmc@hollywood:/var/log$ sudo usermod -a -G audio xbmc

and we are go.

HD audio via HDMI
I skipped HD Audio via HDMI, as this would only work with the TV, but not the amplifier (which is an old Fisher analog stereo amp with analog input only). If you want HD audio, prepare for some trouble: See here as an entry point: http://forum.xbmc.org/showthread.php?tid=156400 See here: http://forum.xbmc.org/showthread.php?tid=34655, and also here (very useful): http://wiki.xbmc.org/index.php?title=AudioEngine/HOW-TO:_Configure_audio, and finaly this: http://wiki.xbmc.org/index.php?title=Intel_Linux_Modifications_for_HD_Audio i.e. it seems we hit the jackpot again, as 12.04 has

xbmc@hollywood:~$ uname -a Linux hollywood 3.2.0-48-generic-pae #74-Ubuntu SMP Thu Jun 6 20:05:01 UTC 2013 i686 i686 i386 GNU/Linux

D'oh!

Silence the BD drive
As the BD drive was a bit noisy, I tried to silence it using spindown: http://forum.xbmc.org/showthread.php?pid=523814%23pid523814 with mixed results.

Auto eject not working
There where severe issues with auto-ejecting CD-ROMs etc. The only (of the many) solutions, which worked, was this:

Edit the udev rule /etc/udev/rules.d/70-persistent-cd.rules and add another RUN script, which sets eject -i 0 for all defined drives. Thereby unlocking the open/close button (although it appears to be unlocked already). It did not help to put that extra rule in a custom udev rules file (although it should). If I have more time to dig into this, I may update this section. It works for now, but be aware, that any regular updates may overwrite the file.

Shutdown
Tweaked shutdown like this: http://wiki.xbmc.org/index.php?title=HOW-TO:Suspend_and_wake_in_Ubuntu

Playing BluRay disks
BluRay info can be found here: https://wiki.archlinux.org/index.php/BluRay

Apparently one needs libaacs, as a basis for libbluray. libaacs then needs a KEYDB.file, which may or may not be legal to posses. Follow the links.

Minor stuff
I tried to remove the Canonical advertisements (MOTD based) with this

http://askubuntu.com/questions/23246/how-do-i-edit-the-ssh-motd

and

http://manpages.ubuntu.com/manpages/raring/man1/landscape-sysinfo.1.html

basically landscape-sysinfo --exclude-sysinfo-plugins=LandscapeLink

and we are good.

Things which work

 * DVD playback and DVD autostart on insert
 * CD-ROM playback and CD-ROM autostart on insert, auto eject (either via eject button or hardware button)
 * Scanning of media libraries (video, audio)
 * mkv and other video formats (including fan-art display etc.)
 * mp3 and other audio formats
 * Megapixel image display
 * Video streaming (Youtube et al)

So all basic functions of XBMC work as advertised using hardware acceleration where possible.

Issues

 * BluRay playback: As advertised. BD+ encrypted discs won't play, the others will work more or less (with menus working halfways). You can work around that -whether the workaround is legal or not is up to where you live.
 * Hanging system. I had several occasions (while playing audio CD-ROMs and DVDs) when XBMC got stuck. I was able to login via ssh in some cases and e.g. kill the XBMC process or restart the machine. Should not happen.
 * flirc.tv. Although a very hassle free solution (insert in USB port at the back (sic!) of the case and go (no direct line of sight needed)) it has an anoying issue with key repeats. If I press and hold a key on the Sony remote, flirc.tv apparently issues lots of key presses, which confuses XBMC at times. To date no solution to this.
 * Noisy BD drive. The BD-drive is somewhat resistant to "spindown", it appears to get less noisy, but not really silent. At least not to audio CD player noise level.
 * There is a short but anoying cracking sound on the loudspeakers on startup. No workaround yet.

The system still feels a bit too much like a PC at times (startup with fans at max speed for a moment, software issues described above, some of the XBMC GUI behaviour).