addon: userspace driver for Sundtek MediaTV Pro (DVB-C, DVB-T, AnalogTV, Composite, S-Video, FM-Radio USB Stick)

This commit is contained in:
peter 2011-11-05 16:34:19 +01:00
parent 5484099afb
commit 04fd6f66f5
12 changed files with 458 additions and 0 deletions

36
packages/3rdparty/driver/sundtek/meta vendored Executable file
View File

@ -0,0 +1,36 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
PKG_NAME="sundtek"
PKG_VERSION="installer_111001.1658"
#PKG_VERSION="installer_development"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"
PKG_URL="http://www.sundtek.de/media/${PKG_NAME}_${PKG_VERSION}.sh"
PKG_DEPENDS=""
PKG_BUILD_DEPENDS="toolchain"
PKG_PRIORITY="optional"
PKG_SECTION="driver/dvb"
PKG_SHORTDESC="Sundtek USB Stick DVB userspace driver"
PKG_LONGDESC="Driver for Sundtek MediaTV Pro (DVB-C, DVB-T, AnalogTV, Composite, S-Video, FM-Radio USB Stick) and Sundtek SkyTV Ultimate (DVB-S/S2 USB)."
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"

68
packages/3rdparty/driver/sundtek/unpack vendored Executable file
View File

@ -0,0 +1,68 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. config/options $1
(
mkdir -p $BUILD/${PKG_NAME}_${PKG_VERSION}
cd $BUILD/${PKG_NAME}_${PKG_VERSION}
sh $SOURCES/$1/${PKG_NAME}_${PKG_VERSION}.sh -e >/dev/null 2>&1
rm chk* installer.tar.gz
rm -r 32bit23 arm* dreambox mips* openwrtmipsr2 ppc*
)
[ "$TARGET_ARCH" = "i386" ] && ARCH_DIR=32bit
[ "$TARGET_ARCH" = "x86_64" ] && ARCH_DIR=64bit
SUNDTEK_ROOT=$BUILD/${PKG_NAME}_${PKG_VERSION}/rootsys
mkdir -p $SUNDTEK_ROOT
tar xzf $BUILD/${PKG_NAME}_${PKG_VERSION}/$ARCH_DIR/installer.tar.gz -C $SUNDTEK_ROOT
# fix permissions (on mediasrv binary)
chmod 755 $SUNDTEK_ROOT/opt/bin/*
# binary search & replace (strings must be same length!)
# mediasrv
# /etc/sunI»dtek.conf
# /etc/sundtek.conf
# libdrv_em28xx.so
# /etc/sundtek.conf
# mediaclient
# /etc/sundtek_diseqc.conf
#perl -pi -e 's|\x2F\x65\x74\x63\x2F\x73\x75\x6E\x49\xBB\x64\x74\x65\x6B\x2E\x63\x6F\x6E\x66|\x2F\x74\x6D\x70\x2F\x73\x75\x6E\x49\xBB\x64\x74\x65\x6B\x2E\x63\x6F\x6E\x66|g' $SUNDTEK_ROOT/opt/bin/mediasrv
#perl -pi -e 's|/etc/sundtek.conf|/tmp/sundtek.conf|g' $SUNDTEK_ROOT/opt/bin/mediasrv
#perl -pi -e 's|/etc/sundtek.conf|/tmp/sundtek.conf|g' $SUNDTEK_ROOT/opt/bin/dvb/libdrv_em28xx.so
#perl -pi -e 's|/etc/sundtek_diseqc.conf|/tmp/sundtek_diseqc.conf|g' $SUNDTEK_ROOT/opt/bin/mediaclient
perl -pi -e 's|/etc/|/tmp/|g' $SUNDTEK_ROOT/opt/bin/mediasrv
perl -pi -e 's|/etc/|/tmp/|g' $SUNDTEK_ROOT/opt/bin/dvb/libdrv_em28xx.so
perl -pi -e 's|/etc/|/tmp/|g' $SUNDTEK_ROOT/opt/bin/mediaclient
if [ "$PKG_VERSION" = "installer_development" ]; then
wget -q -t 3 -T 3 -O $SUNDTEK_ROOT/sundtek_version.html http://support.sundtek.com/index.php/topic,708.0.html
else
cat >$SUNDTEK_ROOT/sundtek_version.html << MYDATA
<html><body>${PKG_NAME}_${PKG_VERSION}.sh</body></html>
MYDATA
fi

View File

@ -0,0 +1,34 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. config/options $1
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/
cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/
cp -P $ROOT/$BUILD/sundtek_*/rootsys/sundtek_version.html $ADDON_BUILD/$PKG_ADDON_ID/
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/
cp -Pa $ROOT/$BUILD/sundtek_*/rootsys/opt/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin/
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/
cp -Pa $ROOT/$BUILD/sundtek_*/rootsys/opt/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib/

View File

@ -0,0 +1,2 @@
1.90.0
- initial version of Sundtek MediaTV DVB driver

View File

@ -0,0 +1,71 @@
#!/bin/sh
#
# first argument: attach/detach
# second argument (DEVID - sequence number of device): 0/1/2/...
. /etc/profile
# which daemon to restart
TVHEADEND=1
MUMUDVB=0
ADDON_DIR="/storage/.xbmc/addons/driver.dvb.sundtek-mediatv"
ADDON_HOME="/storage/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv"
ATTACH_DETACH_LOG="$ADDON_HOME/attach_detach.log"
wait_process() {
while [ -n "$(pidof $1)" ]; do
usleep 200000
done
}
echo "============================================================================" >>$ATTACH_DETACH_LOG
echo "Date: `date`" >>$ATTACH_DETACH_LOG
echo "Params: action=$1 devid=$2" >>$ATTACH_DETACH_LOG
case "$1" in
attach)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ADDON_DIR/lib
export LD_PRELOAD=$LD_PRELOAD:$ADDON_DIR/lib/libmediaclient.so
(
# save adapter serial number (in background)
sleep 2
serial_number=`mediaclient -e | awk '/ID:/ {print $2}'`
if [ ! -f $ADDON_HOME/adapter_serial_number.txt ]; then
echo -n "$serial_number" >$ADDON_HOME/adapter_serial_number.txt
else
serial_number_read=`cat $ADDON_HOME/adapter_serial_number.txt`
if [ "$serial_number_read" != "$serial_number" ]; then
echo -n "$serial_number" >$ADDON_HOME/adapter_serial_number.txt
fi
fi
)&
;;
detach)
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH//:$ADDON_DIR\/lib/}
export LD_PRELOAD=${LD_PRELOAD//:$ADDON_DIR\/lib\/libmediaclient.so/}
;;
*)
exit $NA
;;
esac
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >>$ATTACH_DETACH_LOG
echo "LD_PRELOAD=$LD_PRELOAD" >>$ATTACH_DETACH_LOG
if [ "$TVHEADEND" = "1" -a -n "$(pidof tvheadend)" ]; then
echo "Restarting TVheadend..." >>$ATTACH_DETACH_LOG
sh /storage/.xbmc/addons/service.multimedia.hts-tvheadend/sleep.d/tvheadend.power suspend
wait_process tvheadend
sh /storage/.xbmc/addons/service.multimedia.hts-tvheadend/sleep.d/tvheadend.power resume
fi
if [ "$MUMUDVB" = "1" -a -n "$(pidof mumudvb)" ]; then
echo "Restarting MuMuDVB..." >>$ATTACH_DETACH_LOG
sh /storage/.xbmc/addons/service.multimedia.mumudvb/sleep.d/mumudvb.power suspend
wait_process mumudvb
sh /storage/.xbmc/addons/service.multimedia.mumudvb/sleep.d/mumudvb.power resume
fi

View File

@ -0,0 +1,17 @@
#
# sundtek.conf
#
# Call attach/detach script when new device appears/disappears
device_attach=/storage/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv/device_attach_detach.sh attach DEVID
device_detach=/storage/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv/device_attach_detach.sh detach DEVID
# Infrared Control Support is disabled/enabled
ir_disabled=1
# Get adapter serial number with mediaclient -e
# or look into file adapter_serial_number.txt
[SERIALNUMBER]
# Choose initial DVB mode for hybrid DVB-T/DVB-C devices only
#initial_dvb_mode=[DVBC|DVBT]
# default mode is DVB-C, we must set it to DVB-T if needed
#initial_dvb_mode=DVBT

View File

@ -0,0 +1,75 @@
#
# sundtek.conf
#
# ----- GLOBAL SECTION -----
#Set loglevel for logging to /var/log/mediasrv.log
#loglevel=[off|max]
#default: min
#max .. little bit more debug
#loglevel=off
loglevel=max
#Call attach script when new device appears
#device_attach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
device_attach=/opt/bin/restartAddons.sh
#Call detach script when device disappears
#device_detach=[PATH_TO_SCRIPT] [PARAMETER|DEVID] #"DEVID" will automatically be replaced with the device ID
#Infrared Control Support is disabled/disabled
ir_disabled=1
#Enable listening on network
#enablenetwork=[on|off]
#default: off
#Lowest adapter number to start with, e.g. /dev/dvb/adapter5/frontend0
#first_adapter=5
# ----- Section for adapter with [SERIALNUMBER] -----
#Get adapter serial number with /opt/bin/mediaclient -e
#[SERIALNUMBER]
#Description register as dreambox tuner
#dreambox_support_fe1=[on|off]
#default: off
#Infrared protocol to use
#ir_protocol=[RC5|NEC|RC6]
#default: NEC
#Keymap to use, e.g. "/lib/udev/rc_keymaps/vp702x"
#rcmap=[PATH_TO_KEYMAP]
#default: keymap which comes with the device
#Choose initial DVB mode for hybrid DVB-T/DVB-C devices only
#initial_dvb_mode=[DVBC|DVBT]
#Call attach script when new device appears
#device_attach=[PATH_TO_SCRIPT] [PARAMETER|DEVID]
#"DEVID" will automatically be replaced with the device ID
#Call detach script when device disappears
#device_detach=[PATH_TO_SCRIPT] [PARAMETER|DEVID]
#"DEVID" will automatically be replaced with the device ID
#Volume level
#volume=[0-127] #default: 118
# WSS callback (see http://en.wikipedia.org/wiki/Widescreen_signaling)
# trigger script when the videoformat changes between 16:9 or 4:3
#wss_callback=[scriptname]
# WSS_4_3_FULL
# WSS_14_9_LETTERBOX_CENTRE
# WSS_14_9_LETTERBOX_TOP
# WSS_16_9_LETTERBOX_CENTRE
# WSS_16_9_LETTERBOX_TOP
# WSS_16_9_LETTERBOX_DEEPER
# WSS_14_9_FULL_HEIGHT_4_3
# WSS_16_9_FULL_HEIGHT_16_9
# WSS_UNABLE_TO_DEMODULATE
#Timeout in ms after that WSS_UNABLE_TO_DEMODULATE will be called
#wss_demodulation_timeout=[MILLISECONDS]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,36 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
PKG_NAME="sundtek-mediatv"
PKG_VERSION="1.90"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"
PKG_URL=""
PKG_DEPENDS="sundtek"
PKG_BUILD_DEPENDS="toolchain sundtek"
PKG_PRIORITY="optional"
PKG_SECTION="driver/dvb"
PKG_SHORTDESC="Sundtek USB Stick DVB userspace driver"
PKG_LONGDESC="Driver for Sundtek MediaTV Pro (DVB-C, DVB-T, AnalogTV, Composite, S-Video, FM-Radio USB Stick) and Sundtek SkyTV Ultimate (DVB-S/S2 USB)."
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.service"
PKG_AUTORECONF="no"

View File

@ -0,0 +1,48 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek-mediatv"
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv"
SUNDTEK_CONFIG_FILE="$ADDON_HOME/sundtek.conf"
mkdir -p $ADDON_HOME
if [ ! -f "$SUNDTEK_CONFIG_FILE" ]; then
cp $ADDON_DIR/config/* $ADDON_HOME/
fi
if [ ! -f "$ADDON_HOME/device_attach_detach.sh" ]; then
cp $ADDON_DIR/scripts/* $ADDON_HOME/
chmod +x $ADDON_HOME/*.sh
fi
if [ ! -x "$ADDON_HOME/device_attach_detach.sh" ]; then
chmod +x $ADDON_HOME/device_attach_detach.sh
fi
SUNDTEK_ARG="--pluginpath=$ADDON_DIR/bin --daemon"
if [ -z "$(pidof mediasrv)" ]; then
rm $ADDON_HOME/attach_detach.log
ln -sf $SUNDTEK_CONFIG_FILE /tmp/sundtek.conf
mediasrv $SUNDTEK_ARG
fi

View File

@ -0,0 +1,23 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
import xbmc, time, os, subprocess
os.system("sundtek-mediatv.service")

View File

@ -0,0 +1,48 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
LOCKDIR="/var/lock/"
LOCKFILE="sundtek-mediatv"
case "$1" in
hibernate|suspend)
if [ -n "$(pidof mediasrv)" ]; then
progress "Shutting down Sundtek MediaTV DVB driver for suspending..."
mkdir -p "$LOCKDIR"
touch "$LOCKDIR/${LOCKFILE}"
mediaclient --shutdown
fi
;;
thaw|resume)
if [ -f "$LOCKDIR/${LOCKFILE}" ]; then
progress "Restarting Sundtek MediaTV DVB driver for wakeup..."
sundtek-mediatv.service
rm -rf "$LOCKDIR/${LOCKFILE}"
fi
;;
*) exit $NA
;;
esac