The last days I was busy trying to transform my Banana Pi into a small DVR solution to watch and record live TV via a DVB-T USB device. Unfortunately I had to realize, that this goal is much harder to achieve, than I thought in the beginning…
I bought a simple DVB-T stick based on the RTL2832U chipset a few month ago, which finally should get a productive purpose. Optimistic as I am, I just thought, a simple plugin of the device into the USB interface should be enough to get recognized by the system. What a huge mistake! I had to find out the hard way, that this device is not supported by the kernel version 3.4.90 which is shipped with the Banana Pi Arch Linux package. It is supported from kernel versions 3.6 and above.I tried hard, to find a working driver for that device on the web, but it seemed to be hopeless.In the end I decided to build the driver module for myself by patching the kernel configuration from the sources and cross compile the whole stuff for myself. A nice guide on how to build the kernel for the Banana Pi is found in the official documentation. As kernel version 3.6 introduced support for the mentioned device, I grabbed the RTL2832 sources from the appropriate Git branch, modified the necessary Makefiles and Kconfigs and after countless attempts on getting the whole stuff up and running, I finally built everything successfully. Thank god, there is Open Source!
A nice side effect of the complete rebuilding of the kernel is the fact, that I could build in some tweaks, that were missing in the official package. For example CONFIG_FHANDLE is not set in the official kernel of ArchLinux_For_BananaPi_v2.0 which results in weird problems with the auto mounting of hard disk drives.
However, when I successfully get the kernel and modules set up, dmesg finally shows the necessary information after plugging in the DVB-T device.
sudo modprobe dvb_usb_rtl2832 dmesg [ 53.317970] usbcore: registered new interface driver dvb_usb_rtl28xxu [ 72.647442] usb 1-1.4: new high-speed USB device number 4 using sw-ehci [ 72.932602] usb 1-1.4: New USB device found, idVendor=1f4d, idProduct=b803 [ 73.090371] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 73.217953] usb 1-1.4: Product: RTL2838UHIDIR [ 73.308671] usb 1-1.4: Manufacturer: Realtek [ 73.399379] usb 1-1.4: SerialNumber: 00000041 [ 73.546770] dvb-usb: found a 'G-Tek Electronics Group Lifeview LV5TDLX DVB-T' in warm state. [ 73.763096] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer. [ 73.950612] DVB: registering new adapter (G-Tek Electronics Group Lifeview LV5TDLX DVB-T) [ 74.124405] rtl28xxu: rtl2832u_frontend_attach: FC0012 tuner found [ 74.286475] DVB: registering adapter 0 frontend 0 (Realtek RTL2832 (DVB-T))... [ 74.353244] fc0012: Fitipower FC0012 successfully attached. [ 74.455845] Registered IR keymap rc-empty [ 74.618852] input: IR-receiver inside an USB DVB receiver as /devices/platform/sw-ehci.1/usb1/1-1/1-1.4/rc/rc0/input3 [ 74.851585] rc0: IR-receiver inside an USB DVB receiver as /devices/platform/sw-ehci.1/usb1/1-1/1-1.4/rc/rc0 [ 75.029730] dvb-usb: schedule remote query interval to 400 msecs. [ 75.217541] dvb-usb: G-Tek Electronics Group Lifeview LV5TDLX DVB-T successfully initialized and connected.
Finally this looks good, let’s go on with the much easier software part.
By the way: If you also own a RTL2832U based device and want to build the module for yourself, I created a patch which you simply apply from root directory of the checked out Banana Pi kernel 3.4.90 sources:
patch -p1 < rtl2832u.patch
I'm going to use Tvheadend as the TV back end which serves the DVB-T stream to XBMC and the rest of my network (make sure to add "armv7h" to the arch array in the PKGBUILD):
yaourt -S tvheadend
We start configuring Tvheadend by enabling the Tvheadend daemon:
sudo systemctl enable tvheadend sudo systemctl start tvheadend
Now we use the web front end for configuration, the URL is http://BPI_IP:9981/extjs.html. We "add a DVB network by location" and enable the DVB-T device in "Configuration > DVB Input > General". The channel scan for tvheadend is starting then. After this process we have a list of recognized channels in the tab "Services".To get access from the network, we have to setup a user under "Configuration > Access control".Of course we want to get live TV running in XBMC. Therefore we need the PVR HTS add-on which acts as the client to tvheadend. I had to compile it for my own, as there are no official precompiled packages for the ARMv7 architecture.
git clone -b pvr.wmc_frodo https://github.com/krustyreturns/xbmc-pvr-addons cd xbmc-pvr-addons ./bootstrap ./configure --enable-addons-with-dependencies make zip
When the previous compilation is done, we retrieve the file pvr.hts-linux-arm.zip located under "addons" which we easily can install in XBMC under "System > Add-ons > Install from zip file". Afterwards we have to configure the previous created user in tvheadend as login data for the PVR client. "System > Live TV > General > Enabled". We are forwarded to "Add-ons > PVR Client", open "Tvheadend HTSP Client" enter the user data and hit "enable".
That's it, go back to the main menu and you have a new section "Live TV". If your live TV image seems to have a wrong aspect ratio, change it via the "Z" key ("Y" on German keyboards).
Enjoy TV on your XBMC setup!