Install dvb-t usb dongle (rtl2832u) in xbmc on Raspberry Pi using VDR

Recently, I tried to get my Genius 1000 working on my Raspberry Pi that runs xbmc. It turned out that this is not as simple as some tutorials would make you believe. The many different drivers, backends, frontends, xbmc distro’s, xbmc addons, etc. make it difficult to set up a coherent system. This is what worked for me:

First, install raspbmc on the Raspberry Pi. This is relatively easy and many good tutorials are available (eg here). Raspbmc is preferred over openELEC because for the former it is easier to add drivers that are not supported by the kernel. This is important for the Genius 1000 dvb-t usb dongle, since its chipset (rtl2832u) is not supported by the kernel that is currently used in these distributions (kernel version 3.6.11).

Once raspbmc is installed, it is time to install a kernel module that makes it possible to use the rtl2832u chipset. Find and download the rtl2832u.ko file (eg here) and copy it to your Raspberry Pi. Unzip the file and copy the dvb-usb-rtl2832u.ko file to /lib/modules/3.6.11/kernel/drivers/media/dvb/dvb-usb/ and load the module:

$ tar -zxvf dvb-usb-rtl2832u.tar.gz
$ sudo mv dvb-usb-rtl2832u.ko /lib/modules/3.6.11/kernel/drivers/media/dvb/dvb-usb/
$ sudo depmod -a

If everything fine, running dmesg should return a line like this: dvb-usb: DK DONGLE successfully initialized and connected.

Next, we will install a backand program which communicates with a TV tuner adaptor to create a video stream. The most popular backend seems to be TvHeadend. It is supported by most xbmc distros out of the box. However, I could not get it working on my system. The problem was that after adding the muxes, no services were found. Even when I added the muxes manually (as suggested in some posts).

Fortunately, I had better luck with an alternative backend: VDR. Installing VDR on raspbmc is quite a hassle. First we have to install the necessary programs:

$ sudo apt-get update
$ sudo apt-get install pkg-config unzip git build-essential vdr vdr-dev vdr-plugin-epgsearch vdr-plugin-live vdr-plugin-streamdev-server w-scan

During this process, you will be asked for the type of dvb receiver you are using. In my case this is “terretrial” (ie dvb-t). Next, we will create a configuration file containing the broadcast information about the channels available in our geographical location. Using w_scan (read the man page to find the options for your location):

$ sudo w_scan -c BE > channels.conf
$ sudo mv channels.conf /var/lib/vdr/channels.conf
$ sudo rm /etc/vdr/channels.conf
$ sudo ln -s /var/lib/vdr/channels.conf /etc/vdr/channels.conf

Make sure, the w_scan command is run somewhere in your home directory otherwise it wil not work. Also, make sure your Raspberry Pi is connected to a powered(!) usb hub or an adaptor. If not, the rpi will not get sufficient power to perform the scan and freeze/crash while scanning. Finally, once the channels.conf file is created, move and link it to the appropriate locations (see code above).

Next, two configuration files should be adapted. First, inf the file /etc/default/vdr, change the value of enabled=0 to enabled=1. Second, adjust the file /var/lib/vdr/plugins/streamdev-server/streamdevhosts.conf so that it conforms your local network settings. In my case:

192.168.1.0/24       # any host on the local net

At this point, it is time to reboot the Raspberry Pi.

Now we can check if everything works so far. With your favorite webbrowser, go to the ip-address of your Raspberry Pi followed by “:8008”, i.e.


http://192.168.1.1:8008

If everything works as expected, you should see a loginscreen of VDR. With username “admin” and password “live” you should be able to get access and open the streams you are able to receise at your location.

Finally, we will install a program (vnsiserver) that makes communication possible between VDR and XBMC. First a directory is created where we will compile this program from source. Second, the sourcecode is downloaded to this new folder. Third step is compiling the code.

mkdir vdr
cd vdr
git clone git://github.com/opdenkamp/xbmc-pvr-addons.git
cd xbmc-pvr-addons/addons/pvr.vdr.vnsi/vdr-plugin-vnsiserver
sudo make VDRDIR=/usr/include/vdr LIBDIR=/usr/lib/vdr/plugins

We’re almost there. We just have to create a configuration file that defines who can connect to vnsiserver:

sudo mkdir /var/lib/vdr/plugins/vnsiserver
sudo vi /var/lib/vdr/plugins/vnsiserver/allowed_hosts.conf

and add the following lines:

127.0.0.1             # always accept localhost
192.168.XXX.0/24      # any host on the local net

changing “XXX” to the settings of your local network (probably a value of “1”).

The only thing left to do is restart vdr

$ sudo service vdr restart

and go to XBMC to install the vnsiserver plugin and allow Live TV (System>Settings>LiveTV>enable).

Finally, make sure you buy the Raspberry Pi mpeg codec (it costs only a few dollar/euro). Without this codec, you will not be able to get video (while the sound might work without).

Update:
I noticed that when Raspbmc updates it is necessary to copy again the kernel module dvb-usb-rtl2832u.ko to the appropriate folder and reissue depmod -a (see above).

Sources:
http://forum.stmlabs.com/showthread.php?tid=6780
http://forum.stmlabs.com/showthread.php?tid=6580

Advertenties

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s