I spend a considerable amount of time getting a sundtek tuner to work with tvheadend on a beaglebone black. Sundtek support has been fantastic in helping with this so this post is to share my observations about how to solve some issues I have incountered.
There are also a few remaining issues I hope to get some help on.
Installing tvheadendWe need to install python
opkg install python-distutils
opkg install python-compile
opkg install python-doctest
Then install tvheadend form source since there are no packages available for this platform
git clone git://github.com/tvheadend/tvheadend.git
cd tvheadend
./configure
make install
You will get a number of warnings about missing packages. It seems to work anyway though...
The first time you launch Tvheadend you will want to use the command:
/usr/local/bin/tvheadend -C
To launch Tvheadend after that simply use the command without the -C argument:
/usr/local/bin/tvheadend
To make it work you need to make a user
groupadd tvheadend
useradd -g tvheadend -G video -m tvheadend
Then we need a startup script to make it start at boot
Create file named /etc/init.d/tvheadend
and copy the following
#!/bin/bash
# Required-Start: $local_fs $remote_fs mediasrv
TVHNAME="tvheadend"
TVHBIN="/usr/local/bin/tvheadend"
TVHUSER="tvheadend"
TVHGROUP="tvheadend"
case "$1" in
start)
echo "Starting tvheadend"
start-stop-daemon --start --user ${TVHUSER} --exec ${TVHBIN} -- \
-u ${TVHUSER} -g ${TVHGROUP} -f -C
;;
stop)
echo "Stopping tvheadend"
start-stop-daemon --stop --quiet --name ${TVHNAME} --signal 2
;;
restart)
echo "Restarting tvheadend"
start-stop-daemon --stop --quiet --name ${TVHNAME} --signal 2
start-stop-daemon --start --user ${TVHUSER} --exec ${TVHBIN} -- \
-u ${TVHUSER} -g ${TVHGROUP} -f -C
;;
*)
echo "Usage: tvheadend {start|stop|restart}"
exit 1
esac
exit 0
Set the permissions to make it runnable:
chmod 755 /etc/init.d/tvheadend
Enable start during boot process
update-rc.d tvheadend defaults
Finally start it manually so we can configure it:
/etc/init.d/tvheadend start
Setting up the driverBefore you can do anything you need to install the drivers for the tuner
http://support.sundtek.com/index.php/topic,4.0.htmlNow you can setup the channels in tvheadend
Avoid high CPU usage1.Under configuration --> DVB Inputs --> TV adapters find your adapter and set "Full Mux RX mode" to ON.
This should lower CPU usage.
2.One problem with the BBB is that it lowers the clock frequency to lower power usage. However that means that there is not enough power to run the tuner when the clock frequency is set low.
This can be fixed by making the BBB change the frequency less frequently by setting:
cpufreq-set -g conservative
Current settings can be seen by running:
cpufreq-info
Unfortunately this is reset 10 min after reboot by a script. So we need to change that.
In "/lib/systemd/system/cpu-ondemand.service" change ondemand to conservative
3.Turning the log off can help prevent CPU spikes.
Create or modify the file "/etc/sundtek.conf" and add.
loglevel=off
EDIT: Updated the way to set the CPU governor so that it doesn't reset.
EDIT2: Added info about turning off the log.