Monday, August 23, 2010

Installing XBMC on AsRock ION 330 HT with Ubuntu 10.04

This blog has been moved to
ASRock box
Today I installed my AsRock ION box (after it sitting in some desk for 6 months). For those of you who don't know the AsRock ION, it's a tiny desktop PC driven by an Intel Atom CPU, and featuring an Nvidia Ion graphical chip. Although the Atom CPU is considered slow, the Nvidia Ion chipset more then makes up for that when watching high definition, 1080p video content. The Ion chip basically offloads whatever CPU processing would be required to decode the video content. As such, the GPU takes over all the work, and we're not really bothered with the fact that the Intel Atom is slow.

When I initially bought it there were issues with the infra-red remote when using Linux. As I wanted to use it as an HTCP, and could only get the Nvidia Ion GPU acceleration when using Linux, I didn't really bother with it anymore.

Luckily, in the meantime, AsRock have provided drivers for the latest Ubuntu 10.04, providing full support for the IR receiver through lirc, so I dediced to go ahead with it. What I thought would be a breeze turned out to be a bit more difficult.

On the hardware front, things were looking good. I bought the barebone version, excluding the hard drive and the RAM.

ASRock components

I still had a 2.5inch external hard drive that I wasn't using anymore, so I stripped it down, and used it in my ASRock.

Stripping my external HD

So I ended up with the following additional parts to complete the build :

2.5 hard drive and 2 GB SO-DIMM

The initial goals are :
  • Installing a suiteable OS on the AsRock
  • Having network (wired + wireless) up & running
  • Installing XBMC
  • Ensuring GPU acceleration is enalbed
  • Ensuring the remote control works properly
  • Ensuring audio over HDMI is working properly
  • Being able to play 1080p High Definition video
  • Being able to suspend / resume the machine using the remote control
  • Configuring Ubuntu in 'XBMC' mode

Installing a suitable OS on the AsRock

I installed Ubuntu after burning the standard desktop edition ISO to a CD. Installing it on the AsRock was simply next-next-next-finish, and after a while it booted into the Gnome Desktop. Another option off course is to through the XBMC Live CD.

Having network (wired + wireless) up & running

Both the wireless card as the wired controller were discovered by Ubuntu, however, the wired connection wasn't working initially. I wasn't able to get an IP address from my router (while the wireless connection worked fine after providing the WPA2 password).

In an attempt to solve the problem, I added the following in my /etc/network/interfaces file :

auto eth0
iface eth0 inet dhcp

After a reboot however, while I now got an IP address from my router, the connection was "unmanaged". There was no way to view or configure eth0 in Unbuntu anymore. After some googling, I had to change the managed property to true in /etc/NetworkManager/nm-system-settings.conf


Installing XBMC
After making sure my Ubuntu was updated with the newest features, all I needed to do was execute the following commands in order to get my xbmc setup :

sudo apt-get install python-software-properties pkg-config
sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc xbmc-standalone
sudo apt-get install libvdpau1 nvidia-185-libvdpau

Starting Xbmc

When starting xbmc, I was prompted with the following dialog :
<put opengl error here>

Ensuring GPU acceleration is enabled
When installing Ubuntu, the Nvidia X Drivers were installed but not being used. I had to execute the following command to get them working :


After a reboot, the nvidia drivers were properly initialized.

XMBC could be started using the xbmc command. XBMC starts in full-screen mode. If you want to start XBMC in windowed mode, just tap the backslash key (\) to run it in windowed mode.

Setting up the Remote

I had very high hopes for the remote, as I friend of mine (who bought the ASRock Ion HT at the same time I did) was struggeling at first to get the remote up & running. A lack of driver support for the IR receiver caused him to run without a remote for a while. However, with the latest XMBC live release, everything was running smooth. And indeed, when going to the ASRock site, IR drivers (both 32 and 64 bit) for Ubuntu 10.04 were indeed available.

So, to continue, I copied the CIR receiver driver for Ubuntu 10.04 32/64bit new kernel ver:1.0.4 from the ASrock site.

Direct download can be found at

AsRock provides a PDF that guides you through the installation. However, this didn't really work out for me.

Installing the ASRock IRC drivers

This is done using the following command :
sudo dpkg -i lirc-nct677x-x64-1.0.4-ubuntu10.04_kernel2.6.32-23.deb 
However, I ran into some issues here as apparently lirc was not correctly installed.

Selecting previously deselected package lirc-nct677x-x64.
(Reading database ... 145522 files and directories currently installed.)
Unpacking lirc-nct677x-x64 (from lirc-nct677x-x64-1.0.4-ubuntu10.04_kernel2.6.32-23.deb) ...
dpkg: dependency problems prevent configuration of lirc-nct677x-x64:
 lirc-nct677x-x64 depends on lirc (>= 0.8.6-0ubuntu2); however:
  Package lirc is not installed.
dpkg: error processing lirc-nct677x-x64 (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:

When I tried installed lirc, I ran into a second issue (unmet dependencies) :

sudo apt-get install lirc

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run `apt-get -f install' to correct these:
The following packages have unmet dependencies:
  lirc: Depends: libftdi1 (>= 0.17) but it is not going to be installed
        Depends: setserial but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
As suggested by ubuntu, apt-get -f install solved the issue and I was able to continue :

ubuntu10.04_kernel2.6.32-23$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libftdi1 lirc setserial
Suggested packages:
  lirc-modules-source lirc-x
The following NEW packages will be installed:
  libftdi1 lirc setserial
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 658kB of archives.
After this operation, 2,839kB of additional disk space will be used.
Do you want to continue [Y/n]? 

After this was finished, the command below (that we started off with) worked).

sudo dpkg -i lirc-nct677x-x64-1.0.4-ubuntu10.04_kernel2.6.32-23.deb

By executing the command above, you'll get the lirc configuration screens, you'll see the Nuvoton Transceivers / Remotes the second time the screen pops. (the first time, it doesn't show up in the list).

More info can be found here :

However, after a reboot, a quick peek in dmesg showed me the following :

dmesg | grep lirc
[    6.018537] lirc_dev: IR Remote Control driver registered, major 61 
[    6.090735] lirc_wb677: disagrees about version of symbol lirc_register_driver
[    6.090746] lirc_wb677: Unknown symbol lirc_register_driver

This appears to be a bug described in ubuntu launchpad.

The workaround involves executing the following commands to get the remote up & running.

sudo aptitude install lirc-modules-source
sudo dpkg -i lirc-nct677x-src-1.0.4-ubuntu9.10.deb lirc-nct677x-1.0.4-ubuntu9.10.deb
cd /tmp
sudo apt-get install dpkg-dev
sudo apt-get install pgp
sudo apt-get source lirc-modules-source
sudo apt-get build-dep lirc-modules-source
cd lirc-0.8.6/
vi debian/patches/series
sudo dpkg -i ../lirc-modules-source_0.8.6-0ubuntu4.1_all.deb 
sudo dkms remove -m lirc-nct677x-src -v 1.0.4-ubuntu9.10 --all
sudo dkms add -m lirc-nct677x-src -v 1.0.4-ubuntu9.10
sudo dkms build -m lirc-nct677x-src -v 1.0.4-ubuntu9.10
sudo dkms install -m lirc-nct677x-src -v 1.0.4-ubuntu9.10

After executing these commands, the IR remote on the AsRock was working fine.
asrock@asrock-desktop:~/Downloads$ dmesg | grep lirc
[   16.862456] lirc_dev: IR Remote Control driver registered, major 61 
[   16.946345] lirc_wb677 w677hga: chip id high: 0xb4
[   16.946361] lirc_wb677 w677hga: chip id low: 0x73 expect:0x73
[   16.947528] lirc_dev: lirc_register_driver: sample_rate: 0
This was verified using the irw command
asrock@asrock-desktop:~/Downloads$ irw
000000037ff07bfe 00 One mceusb
000000037ff07bfe 01 One mceusb
000000037ff07bfe 02 One mceusb
000000037ff07bfd 00 Two mceusb
000000037ff07bfd 01 Two mceusb
000000037ff07bfc 00 Three mceusb
000000037ff07bfc 01 Three mceusb
000000037ff07bfb 00 Four mceusb
000000037ff07bfb 01 Four mceusb
000000037ff07bfa 00 Five mceusb
000000037ff07bf9 00 Six mceusb
000000037ff07bf9 01 Six mceusb
000000037ff07bf9 02 Six mceusb
000000037ff07be6 00 Stop mceusb
000000037ff07be6 01 Stop mceusb
000000037ff07be6 02 Stop mceusb
000000037ff07be9 00 Play mceusb
000000037ff07be9 01 Play mceusb
000000037ff07be5 00 Skip mceusb
000000037ff07be5 01 Skip mceusb
000000037ff07be5 02 Skip mceusb
000000037ff07be4 00 Replay mceusb
000000037ff07be4 01 Replay mceusb
000000037ff07be4 02 Replay mceusb
And it was working fine in XBMC as well.

Ensuring audio over HDMI is working properly

When playing the first movie in xbmc, there was no sound coming out of the HDMI connection. My AsRock is connected via HDMI to an Onkyo receiver for audio, passing on video via HDMI to my television.

In terms of configuring XBMC, just make sure the following is set in Settings - System - Audio output :
  • Audio Output : digital
  • Dolby Digital (AC3) Capable Receiver : Y
  • DTS Capable Receiver : Y
  • Audio output device : HDMI
  • Passthrough output device : HDMI
After applying these settings however, no sound was coming from the receiver.

The hardware side of things seems to be ok, as can be seen from the following command (notice the lowercase l argument)
asrock@asrock-desktop:~/Downloads$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC889A Analog [ALC889A Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC889A Digital [ALC889A Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
The Nvidia HDMI audio output was properly detected.
asrock@asrock-desktop:~/Downloads$ aplay -L
    Discard all samples (playback) or generate zero samples (capture)
    Playback/recording through the PulseAudio sound server
    HDA NVidia, ALC889A Analog
    Front speakers
    HDA NVidia, ALC889A Analog
    4.0 Surround output to Front and Rear speakers
    HDA NVidia, ALC889A Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
    HDA NVidia, ALC889A Analog
    5.0 Surround output to Front, Center and Rear speakers
    HDA NVidia, ALC889A Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    HDA NVidia, ALC889A Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    HDA NVidia, ALC889A Digital
    IEC958 (S/PDIF) Digital Audio Output
    HDMI Audio Output

It seems that the SPDIF/1 output in Ubuntu 10.04 is muted by default, as can be seen in the following screenshot coming from alsamixer.

Un-muting the SPDIF/1 connection (by navigating to the right, selected SPDIF/1, and pressing the M button) was the key to getting audio working over HDMI. I was now able to hear DTS 5.1 sound passed over HDMI, onto my speakers connected to the Onkyo receiver.

References :