Willkommen Gast. Bitte einloggen oder registrieren.

Einloggen mit Benutzername, Passwort und Sitzungslänge

 
Erweiterte Suche

17794 Beiträge in 2132 Themen- von 3031 Mitglieder - Neuestes Mitglied: Gutz-Pilz

Mai 26, 2018, 12:06:13 pm
Sundtek Support ForumEnglishSundtek MediaTV Pro (Europe)SoftwareNotes on using tvheadend on beaglebone black with MediaTV Digital Home DVB-C
Seiten: [1]
Drucken
Autor Thema: Notes on using tvheadend on beaglebone black with MediaTV Digital Home DVB-C  (Gelesen 8021 mal)
kamakamadaun
Newbie
*
Beiträge: 8


Profil anzeigen
« am: Februar 06, 2014, 12:26:29 pm »

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 tvheadend
We need to install python
Code:
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
Code:
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:
Code:
/usr/local/bin/tvheadend -C

To launch Tvheadend after that simply use the command without the -C argument:
Code:
/usr/local/bin/tvheadend


To make it work you need to make a user
Code:
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

Code:
#!/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:
Code:
chmod 755 /etc/init.d/tvheadend

Enable start during boot process
Code:
update-rc.d tvheadend defaults

Finally start it manually so we can configure it:
Code:
/etc/init.d/tvheadend start




Setting up the driver
Before you can do anything you need to install the drivers for the tuner
http://support.sundtek.com/index.php/topic,4.0.html
Now you can setup the channels in tvheadend



Avoid high CPU usage
1.
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:
Code:
cpufreq-set -g conservative

Current settings can be seen by running:
Code:
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.
Code:
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.
« Letzte Änderung: Februar 17, 2014, 03:05:25 pm von kamakamadaun » Gespeichert
kamakamadaun
Newbie
*
Beiträge: 8


Profil anzeigen
« Antworten #1 am: Februar 06, 2014, 12:28:30 pm »

Remaining issues

Starting driver correctly
SOLVED
even if "systemctl status sundtek.service" reports that the drivers are started correctly it appears they are not. Upon reboot I need to manually run the following to get the tuner working:
Code:
/opt/bin/mediaclient --start


CPU spikes
SEEMS TO HAVE BEEN SOLVED
I still get CPU usage spikes for mediasrv. mediasrv normally uses ~12% CPU but often suddenly jumps to 70%. This combined with tvheadend uses all the CPU. This causes dropped frames as reported by tvheadend as:

Code:
2014-02-05 23:45:47.621 TS: 514000/DR K: MPEG2VIDEO @ #2360: Continuity counter error
2014-02-05 23:45:47.621 TS: 514000/DR K: TELETEXT @ #2362: Continuity counter error
2014-02-05 23:45:47.621 TS: 514000/DR K: MPEG2AUDIO @ #2361: Continuity counter error
2014-02-05 23:45:51.627 TS: 514000/DR K: MPEG2AUDIO @ #2361: Continuity counter error, 1 duplicate log lines suppressed
2014-02-05 23:45:51.627 TS: 514000/DR K: MPEG2VIDEO @ #2360: Continuity counter error, 1 duplicate log lines suppressed
2014-02-05 23:45:51.627 TS: 514000/DR K: TELETEXT @ #2362: Continuity counter error, 1 duplicate log lines suppressed
2014-02-05 23:45:51.926 parser: transport stream MPEG2VIDEO, DTS discontinuity. DTS = 237913200, last = 237204000
2014-02-05 23:45:52.094 parser: transport stream MPEG2AUDIO, DTS discontinuity. DTS = 237891243, last = 237146043

and mediasrv report repeatedly in the log:
Code:
Resetting TS Port


This is severe enough that many files are very painful to watch.
« Letzte Änderung: Februar 17, 2014, 03:05:54 pm von kamakamadaun » Gespeichert
Sundtek
Administrator
Hero Member
*****
Beiträge: 7665


Profil anzeigen
« Antworten #2 am: Februar 06, 2014, 12:43:01 pm »

Thank you for your feedback!

Maybe you can try to turn off the logfile:

/etc/sundtek.conf
loglevel=off


There should not be any CPU spikes generated by the driver, if so there must be some reason behind that.

Do you have any /etc/sundtek.conf file? If so please post it here.

You can also start a script once a device is detected by the system

/etc/sundtek.conf
device_attach=/path/to/yourscript.sh


yourscript.sh might contain your additional commandline commands (eg. to set the cpu scheduler)
Gespeichert

Sundtek Ltd. Support Engineer
kamakamadaun
Newbie
*
Beiträge: 8


Profil anzeigen
« Antworten #3 am: Februar 06, 2014, 12:54:45 pm »

The only sundtek.conf seem to be /opt/doc/sundtek.conf.
Is that file used or just a reference?

Code:

# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.8.4a(devinput) on Sun Aug 16 23:03:30 2009
#
# contributed by
#
# brand:                       sundtek.conf
# model no. of remote control:
# devices being controlled by this remote:
#

begin remote

  name       sundtek.conf
  bits           16
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   16
  pre_data       0x8001
  gap          211362
  toggle_bit_mask 0x80010004

      begin codes
          Power                    0x0074
          Menu                     0x0161
          User1                    0x0174
          Shutdown                 0x00AE
          1                        0x0002
          2                        0x0003
          3                        0x0004
          4                        0x0005
          5                        0x0006
          6                        0x0007
          7                        0x0008
          8                        0x0009
          9                        0x000A
          0                        0x000B
          Channel+                 0x0192
          Channel-                 0x0193
          Volume+                  0x0073
          Volume-                  0x0072
          Ok                       0x001C
          Record                   0x00A7
          Stop                     0x0080
          Play                     0x00CF
          Mute                     0x0071
          Up                       0x0067
          Down                     0x006C
          Left                     0x0069
          Right                    0x006A
          Red                      0x018E
          Green                    0x018F
          Yellow                   0x0190
          Blue                     0x0191
          Back                     0x009e
      end codes

end remote

Gespeichert
Sundtek
Administrator
Hero Member
*****
Beiträge: 7665


Profil anzeigen
« Antworten #4 am: Februar 06, 2014, 01:03:08 pm »

Nope, sundtek.conf is fully optional.

You can create it and use the callback device_attach for starting the cpu commands and restarting tvheadend once a device is available to the system.
Gespeichert

Sundtek Ltd. Support Engineer
kamakamadaun
Newbie
*
Beiträge: 8


Profil anzeigen
« Antworten #5 am: Februar 06, 2014, 05:34:44 pm »

After turning off the log it has been running for some hours now while only very occasionally dropping a single frame. So it seems to have solved the CPU spikes.
I have updated the guide accordingly and also added the right way to handle the CPU governor.

Any hints about getting the driver to start correctly?
« Letzte Änderung: Februar 06, 2014, 05:38:22 pm von kamakamadaun » Gespeichert
Sundtek
Administrator
Hero Member
*****
Beiträge: 7665


Profil anzeigen
« Antworten #6 am: Februar 08, 2014, 11:42:59 am »

Ok, we found some time to review systemctl.

We updated the driver installer to deploy the systemd scripts, just reinstall the driver.
After a reboot the driver should be started automatically

Zitat
$ systemctl -a | grep sundtek
sundtek.service            loaded active   exited    Sundtek MediaTV
$ systemctl -a status sundtek.service
sundtek.service - Sundtek MediaTV
     Loaded: loaded (/lib/systemd/system/sundtek.service; enabled)
     Active: active (exited) since Sat 2000-01-01 00:28:59 UTC; 2min 12s ago
    Process: 129 ExecStart=/opt/bin/mediaclient --start=4 (code=exited, status=0/SUCCESS)
     CGroup: name=systemd:/system/sundtek.service
        |-246 /opt/bin/mediasrv -d --pluginpath=/opt/bin
        `-248 /opt/bin/mediasrv -d --pluginpath=/opt/bin

Gespeichert

Sundtek Ltd. Support Engineer
kamakamadaun
Newbie
*
Beiträge: 8


Profil anzeigen
« Antworten #7 am: Februar 16, 2014, 12:31:55 am »

Thanks! This solved the last problem. Now everything seems to be working perfectly.
Gespeichert
Seiten: [1]
Drucken
Gehe zu: