Archiv für den Monat: Juli 2017

Using hybrid DVB-T/DVB-C-Stick with Linux, disabling the first frontend (frontend0)

I only wanted the DVB-C-Part of my stick (dvb_usb_rtl28xxu), but after VDR access the first frontend of this device (/dev/dvb/adapter0/frontend0), the device won’t be accessible on its other frontend (/dev/dvb/adapter0/frontend1), so I had to find a way to disable the first frontend.

If you have trouble scanning any channels, please take a look at you dmesg whether there was a problem loading the correct firmware. For me it looked like this:

user@host:~# dmesg | grep firmware
[23945257.415086] mn88473 7-0018: Direct firmware load for dvb-demod-mn88473-01.fw failed with error -2

Your firmware is most certainly somewhere in the github directory of OpenELEC: https://github.com/OpenELEC/dvb-firmware/tree/master/firmware

For example, I had to copy the dvb-demod-mn88473-01.fw to /lib/firmware/:

sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-mn88473-01.fw -O /lib/firmware/dvb-demod-mn88473-01.fw

Check whether w_scan works:

sudo w_scan -fc -c DE >>dvb-c-channels.conf

Search for the DEVPATH of the frontend which you want to disable (for me it was adapter0/frontend0):

user@host:~# udevadm info --query=all --name=/dev/dvb/adapter0/frontend0 | grep DEVPATH
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb3/3-4/dvb/dvb0.frontend0

Then add a new udev-rule as a new file /etc/udev/rules.d/11-disable-frontend0.rules:

ACTION=="add", SUBSYSTEM=="dvb", ENV{DVB_DEVICE_TYPE}=="frontend", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb3/3-4/dvb/dvb0.frontend0", ENV{dynamite_attach}="no"

I must admit that this didn’t work for me. I had to move the frontend0 manually to a higher number, disabling it by this for vdr:

user@host:~# mv /dev/dvb/adapter0/frontend0 /dev/dvb/adapter0/frontend9

VDR auf Server kompilieren, Einbindung von IPTV und Steuerung über KODI auf einem Client

Server mit Netzwerkanschluss hinter einem T-Entertain-Anschluss. An den Fernsehern im Haus liegt bereits Netzwerk und jeweils ein Raspberry PI oder ähnliches, um als Empfänger des VDR-Streams zu agieren. Auf den Clients läuft ein KODI (teilweise unter OpenELEC), welcher die Integration des VDR erleichtern soll. Es steckt allerdings keine DVB-T/DVB-C-Karte oder ähnliches im Server, sondern er soll die IPTV-Streams von der Telekom (T-Entertain/T-Home) nutzen. Dieses Vorgehen ist völlig legal. Einziger Nachteil bei dieser Vorgehensweise: Es gibt praktisch keine EPG-Daten aus dem Datenstrom, diese sind – bis auf „now“ und „next“ – verschlüsselt und können nur durch den von der Telekom bereitgestellten „Media Receiver“ entschlüsselt werden.

Der VDR wurde hierfür selbst kompiliert, um die notwendigen Plugins direkt nutzen zu können. Da es einige Zeit und Nerven gekostet hat, eine vernünftige Lösung hierfür zu finden, ist hier ein Skript zu finden, welches die vorausgesetzten Pakete installiert, alles herunterlädt und kompiliert.

#!/bin/bash
 
# Work directory
### Warning: This script installs the resulting vdr to /work/vdr, yes, this is on the root level!
MYCURRENTDIR="${PWD}"
cd /work/vdr
 
#####
## Install prerequisites
#####
sudo apt-get install build-essentials dialog libcap-dev libjpeg62-dev libfreetype6{,-dev} fontconfig{,-config} libfontconfig1{,-dev} libcurl4-gnutls-dev libcxxtools-dev libtntnet-dev
 
#####
## Changes these if newer versions are available (and these work)
#####
CURRVDRVER="2.2.0"
CURRIPTVVER="2.2.1"
CURRDIR="$(pwd)"
 
#####
## Download everything which we don't already have
#####
 
if [ ! -e vdr-${CURRVDRVER}.tar.bz2 ]; then
        wget -O vdr-${CURRVDRVER}.tar.bz2 ftp://ftp.tvdr.de/vdr/vdr-${CURRVDRVER}.tar.bz2
fi
 
if [ ! -d vdr-${CURRVDRVER} ]; then
        tar xvfj vdr-${CURRVDRVER}.tar.bz2
        ln -s /work/vdr/vdr-${CURRVDRVER} /work/vdr/vdr
fi
 
if [ ! -e vdr-iptv-${CURRIPTVVER}.tgz ]; then
        wget -O vdr-iptv-${CURRIPTVVER}.tgz http://www.saunalahti.fi/~rahrenbe/vdr/iptv/files/vdr-iptv-${CURRIPTVVER}.tgz
fi
 
if [ ! -d vdr-${CURRVDRVER}/PLUGINS/src/iptv ]; then
        mkdir -p vdr-${CURRVDRVER}/PLUGINS/src/iptv
        tar xvfz vdr-iptv-${CURRIPTVVER}.tgz -C vdr-${CURRVDRVER}/PLUGINS/src/iptv --strip-components=1
fi
 
#####
## Further Plugins
#####
 
### VNSI
# https://github.com/FernetMenta/vdr-plugin-vnsiserver
if [ ! -d vdr-${CURRVDRVER}/PLUGINS/src/vdr-plugin-vnsiserver ]; then
        cd vdr-${CURRVDRVER}/PLUGINS/src
        git clone https://github.com/FernetMenta/vdr-plugin-vnsiserver
        ln -s vdr-plugin-vnsiserver vnsiserver
        cd /work/vdr
fi
 
### epgsearch (needed for VDR Live)
# http://winni.vdr-developer.org/epgsearch/downloads/vdr-epgsearch-1.0.0.tgz
if [ ! -e vdr-plugin-epgsearch-2.2.0.tgz ]; then
        wget -O vdr-plugin-epgsearch-2.2.0.tgz https://projects.vdr-developer.org/git/vdr-plugin-epgsearch.git/snapshot/vdr-plugin-epgsearch-2.2.0.tar.gz
fi
 
if [ ! -d vdr-${CURRVDRVER}/PLUGINS/src/epgsearch ]; then
        mkdir -p vdr-${CURRVDRVER}/PLUGINS/src/epgsearch
        tar xvfz vdr-plugin-epgsearch-2.2.0.tgz -C vdr-${CURRVDRVER}/PLUGINS/src/epgsearch --strip-components=1
fi
 
### VDR Live
# http://live.vdr-developer.org/downloads/vdr-live-0.3.0.tar.gz
if [ ! -e vdr-plugin-live-release_0-3-0.tgz ]; then
        wget -O vdr-plugin-live-release_0-3-0.tgz https://projects.vdr-developer.org/git/vdr-plugin-live.git/snapshot/vdr-plugin-live-release_0-3-0.tar.gz
fi
 
if [ ! -d vdr-${CURRVDRVER}/PLUGINS/src/live ]; then
        # mkdir -p vdr-${CURRVDRVER}/PLUGINS/src/live
        # tar xvfz vdr-plugin-live-release_0-3-0.tgz -C vdr-${CURRVDRVER}/PLUGINS/src/live --strip-components=1
  cd /work/vdr/vdr-${CURRVDRVER}/PLUGINS/src
        git clone https://projects.vdr-developer.org/git/vdr-plugin-live.git/
  mv /work/vdr/vdr-${CURRVDRVER}/PLUGINS/src/vdr-plugin-live /work/vdr/vdr-${CURRVDRVER}/PLUGINS/src/live
fi
 
cd /work/vdr
 
#### Autotimer
# http://phivdr.dyndns.org/vdr/vdr-autotimer/vdr-autotimer-2.3.0.tgz
if [ ! -e vdr-autotimer-2.3.0.tgz ]; then
        wget -O vdr-autotimer-2.3.0.tgz http://phivdr.dyndns.org/vdr/vdr-autotimer/vdr-autotimer-2.3.0.tgz
fi
 
if [ ! -d vdr-${CURRVDRVER}/PLUGINS/src/vdr-autotimer ]; then
        mkdir -p vdr-${CURRVDRVER}/PLUGINS/src/autotimer
        tar xvfz vdr-autotimer-2.3.0.tgz -C vdr-${CURRVDRVER}/PLUGINS/src/autotimer --strip-components=1
fi
 
#####
## Compile
#####
 
cd /work/vdr/vdr-${CURRVDRVER}
# Das CXXFLAGS="-std=gnu++03" wird benoetigt, da das iptv-Plugin mit den neuen Makros nicht klar kommt (-std=gnu11)
CXXFLAGS="-std=gnu++03" make -j $(grep -c ^processor /proc/cpuinfo)
cd ..
 
# channels.conf (loading these from a forum where someone listed all channels...)
if [ ! -e channels.conf ]; then
  preString = "pre" # Workaround for wordpress-blogpost, it would end the code otherwise
  wget -O - -q  http://www.vdr-portal.de/board16-video-disk-recorder/board5-vdr-konfiguration/119211-iptv-t-home-entertain-channels-conf-aktuelle-eintr%C3%A4ge/ | grep "\(IPTV:\|</${prestring}>\)" | sed '1,1d; /<\/pre>/,$d' >channels.conf
fi
cd /work/vdr/vdr-${CURRVDRVER}
rm channels.conf
ln -s ../channels.conf channels.conf
 
mkdir -p video
mkdir -p resources
mkdir -p cache
 
# Webinterface
sudo ln -s /work/vdr/vdr/PLUGINS/src/live/live/css /work/vdr/vdr-2.2.0/resources/plugins/live/
sudo ln -s /work/vdr/vdr/PLUGINS/src/live/live/img /work/vdr/vdr-2.2.0/resources/plugins/live/
sudo ln -s /work/vdr/vdr/PLUGINS/src/live/live/js /work/vdr/vdr-2.2.0/resources/plugins/live/
sudo ln -s /work/vdr/vdr/PLUGINS/src/live/live/themes /work/vdr/vdr-2.2.0/resources/plugins/live/
 
# setup.conf initial
## sudo rm /work/vdr/vdr-${CURRVDRVER}/setup.conf
 
# iptv configuration
# 15.07.2014: Sollte der VDR die IPTV Kanäle mit der CAID "4AE2" versehen, im iptv-Plugin "Deaktiviere Filter: 1 (PAT 0x00)" definieren und Einträge bereinigen
sudo bash -c "cat <<EOF >>setup.conf
iptv.DisabledFilters = 1
EOF
"
 
# vnsiserver configuration
sudo mkdir -p /media/tv
 
sudo bash -c "cat <<EOF >>setup.conf
vnsiserver.Timeshift = 2
vnsiserver.TimeshiftBufferDir = /media/tv
vnsiserver.TimeshiftBufferFileSize = 20
vnsiserver.TimeshiftBufferSize = 30
EOF
"
 
 
# vnsiserver access rights
# sudo cat >/work/vdr/vdr-${CURRVDRVER}/plugins/vnsiserver/allowed_hosts.conf <<EOF
sudo bash -c "cat <<EOF >/work/vdr/vdr/plugins/vnsiserver/allowed_hosts.conf
#
# allowed_hosts.conf  This file describes a number of host addresses that
#                     are allowed to connect to the streamdev server running
#                     with the Video Disk Recorder (VDR) on this system.
# Syntax:
#
# IP-Address[/Netmask]
#
 
127.0.0.1             # always accept localhost
192.168.6.0/24        # any host on the local net
#204.152.189.113      # a specific host
#0.0.0.0/0            # any host on any net (USE THIS WITH CARE!)
EOF
"
 
# Plugins
cd PLUGINS/lib
rm *
 
find ../ -iname '*.so' -exec ln -s {} . \;
for file in *.so; do mv ${file} $(echo ${file} | sed "s/\.so/.so.${CURRVDRVER}/") ; done
 
cd ../..
 
echo "Starting VDR"
cd ..
echo "Going back to ${MYCURRENTDIR}"
cd "${MYCURRENTDIR}"
 
./run.sh

And for run.sh, I used this:

#!/bin/bash
cd /work/vdr/vdr && sudo /work/vdr/vdr/vdr --log=3 -v /data/Videos/TV -c . -L /work/vdr/vdr/PLUGINS/lib --plugin=iptv --localedir=/work/vdr/vdr/locale --resdir=/work/vdr/vdr/resources --cachedir=/work/vdr/vdr/cache -P'vnsiserver -t 5' -P'epgsearch' -P'live'