sundtek: addon redesign addon renamed to just sundtek added addon settings sundtek's binaries are downloaded on first run automatically download new version of the binaries if available added preload library to .profile (to run mediaclient, w_scan, ... from console)

The addon is now generic for all architectures (doesn't contain any binary file).

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
vpeter4 2012-10-06 19:07:47 +02:00 committed by Stephan Raue
parent 0757e8858d
commit f0ed75b919
16 changed files with 257 additions and 132 deletions

View File

@ -1,85 +0,0 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek-mediatv"
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv"
SUNDTEK_READY="/var/run/sundtek.ready"
ADAPTER_WAIT_TIME=120
NETWORK_TUNER_IP=$(awk '/^network_tuner_ip=/ {split($0,a,"="); printf("%s", a[2])}' "$ADDON_HOME/sundtek.conf")
mkdir -p $ADDON_HOME
if [ ! -f "$ADDON_HOME/sundtek.conf" ]; then
cp $ADDON_DIR/config/* $ADDON_HOME/
fi
SUNDTEK_ARG="--pluginpath=$ADDON_DIR/bin --daemon"
if [ -z "$(pidof mediasrv)" ]; then
rm -f /var/log/mediasrv.log
rm -f /var/log/mediaclient.log
rm -f $SUNDTEK_READY
rm -f /tmp/sundtek.conf
ln -sf $ADDON_HOME/sundtek.conf /tmp/sundtek.conf
mediasrv $SUNDTEK_ARG
if [ -n "$NETWORK_TUNER_IP" ]; then
logger -t Sundtek "### Trying to connect Sundtek device $NETWORK_TUNER_IP ###"
mediaclient --mount=$NETWORK_TUNER_IP
else
logger -t Sundtek "### Trying to attach Sundtek device ###"
fi
# wait for device to get attached or connected
cnt=0
while [ 1 ]; do
if [ -n "$NETWORK_TUNER_IP" -a -e /dev/dvb/adapter*/frontend* ]; then
sh $ADDON_DIR/bin/device-attached.sh
fi
if [ -f $SUNDTEK_READY ]; then
rm -f $SUNDTEK_READY
break
elif [ "$cnt" = "$ADAPTER_WAIT_TIME" ]; then
logger -t Sundtek "### No Sundtek device attached or connected ###"
return
fi
let cnt=cnt+1
usleep 500000
done
(
# save adapter serial number in background
sleep 4
serial_number_old=$(cat $ADDON_HOME/adapters.txt 2>/dev/null)
serial_number_new=$(mediaclient -e | awk '/device / {print $0} /ID:/ {print $2}')
if [ "$serial_number_old" != "$serial_number_new" ]; then
echo "$serial_number_new" >$ADDON_HOME/adapters.txt
fi
)&
fi
export LD_PRELOAD=$ADDON_DIR/lib/libmediaclient.so:$LD_PRELOAD

View File

@ -24,9 +24,4 @@
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/
cp -P $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/
cp -Pa $ROOT/$BUILD/sundtek-*/opt/bin/* $ADDON_BUILD/$PKG_ADDON_ID/bin/
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/
cp -Pa $ROOT/$BUILD/sundtek-*/opt/lib/*.so $ADDON_BUILD/$PKG_ADDON_ID/lib/
cp -P $PKG_DIR/settings-default.xml $ADDON_BUILD/$PKG_ADDON_ID/

View File

@ -1,12 +1,16 @@
3.0.1
- bump addon version
addon renamed to just sundtek
added addon settings
sundtek's binaries are downloaded on first run
automatically download new version of the binaries if available
added preload library to .profile (to run mediaclient, w_scan, ... from console)
2.1.4
support for Raspberry Pi
2.1.3
support for network tuner
2.1.2
support for multiple Sundtek tuners
support for working with other tuners (kernel drivers)

View File

@ -2,11 +2,8 @@
# sundtek.conf
#
# Call attach/detach script when new device appears/disappears
# Do not change this line!
device_attach=/storage/.xbmc/addons/driver.dvb.sundtek-mediatv/bin/device-attached.sh
# network tuner IP address (OpenELEC specific)
#network_tuner_ip=xxx.xxx.xxx.xxx
# Do not change this line (OpenElec addon require this) !
device_attach=/storage/.xbmc/addons/driver.dvb.sundtek/bin/device-attached.sh
# Infrared Control Support is disabled/enabled
ir_disabled=1
@ -19,8 +16,11 @@ bulk_notification=on
# Get adapter serial number with mediaclient -e
# or look into file adapter_serial_number.txt
[SERIALNUMBER]
#[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
#[U123456789012]
#initial_dvb_mode=DVBT

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -18,15 +18,15 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
PKG_NAME="sundtek-mediatv"
PKG_NAME="sundtek"
PKG_VERSION="3.0"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"
PKG_URL=""
PKG_DEPENDS="sundtek"
PKG_BUILD_DEPENDS="sundtek"
PKG_DEPENDS=""
PKG_BUILD_DEPENDS=""
PKG_PRIORITY="optional"
PKG_SECTION="driver/dvb"
PKG_SHORTDESC="Sundtek USB Stick DVB userspace driver"

View File

@ -0,0 +1,7 @@
<settings>
<setting id="AUTO_UPDATE" value="false" />
<setting id="ANALOG_TV" value="false" />
<setting id="NETWORK_TUNER_IP" value="0.0.0.0" />
<setting id="SETTLE_TIME" value="0" />
<setting id="RUN_USER_SCRIPT" value="false" />
</settings>

View File

@ -20,18 +20,9 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. config/options $1
. /etc/profile
cd $PKG_BUILD
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek"
# 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|/etc|/tmp|g' opt/bin/mediasrv
perl -pi -e 's|/etc|/tmp|g' opt/bin/dvb/libdrv_em28xx.so
perl -pi -e 's|/etc|/tmp|g' opt/bin/mediaclient
logger -t Sundtek "### Sundtek manual start ###"
. $ADDON_DIR/bin/userspace-driver.sh

View File

@ -1,3 +1,5 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
@ -18,18 +20,11 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
PKG_NAME="sundtek"
PKG_VERSION="20120912"
PKG_REV="0"
PKG_ARCH="i386 x86_64 arm"
PKG_LICENSE="nonfree"
PKG_SITE="http://support.sundtek.com/"
PKG_URL="${DISTRO_SRC}/${PKG_NAME}-${PKG_VERSION}-${ARCH}.tar.gz"
PKG_DEPENDS=""
PKG_BUILD_DEPENDS=""
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"
. /etc/profile
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek"
export LD_PRELOAD=$ADDON_DIR/lib/libmediaclient.so
logger -t Sundtek "### Sundtek manual stop ###"
mediaclient --shutdown

View File

@ -0,0 +1,197 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
. /etc/profile
ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek"
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.sundtek"
ADDON_SETTINGS="$ADDON_HOME/settings.xml"
SUNDTEK_READY="/var/run/sundtek.ready"
mkdir -p $ADDON_HOME
if [ ! -f "$ADDON_HOME/sundtek.conf" ]; then
cp $ADDON_DIR/config/* $ADDON_HOME/
fi
if [ ! -f "$ADDON_SETTINGS" ]; then
cp $ADDON_DIR/settings-default.xml $ADDON_SETTINGS
fi
mkdir -p /var/config
cat "$ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/sundtek-addon.conf
. /var/config/sundtek-addon.conf
if [ "$AUTO_UPDATE" = "true" -a -f $ADDON_DIR/bin/mediasrv ]; then
logger -t Sundtek "### Checking for new Sundtek binary installer ###"
touch $ADDON_HOME/driver-version.txt
wget -O /tmp/sundtek-driver-version.txt http://sundtek.de/media/latest.phtml
md5_1=$(md5sum -b /tmp/sundtek-driver-version.txt | awk '{print $1}')
md5_2=$(md5sum -b $ADDON_HOME/driver-version.txt | awk '{print $1}')
if [ "$md5_1" != "$md5_2" ]; then
logger -t Sundtek "### Updating Sundtek binary installer ###"
rm -f $ADDON_DIR/bin/mediasrv
fi
rm -f /tmp/sundtek-driver-version.txt
fi
if [ ! -f $ADDON_DIR/bin/mediasrv ]; then
logger -t Sundtek "### Downloading installer ###"
cd $ADDON_DIR
mkdir -p bin lib tmp
cd tmp/
ARCH=$(sed -n 's|.*\.\([^-]*\)-.*|\1|p' /etc/release | tr -d '\n')
if [ "$ARCH" = "x86_64" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/64bit/installer.tar.gz"
elif [ "$ARCH" = "i386" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/32bit/installer.tar.gz"
elif [ "$ARCH" = "arm" ]; then
INSTALLER_URL="http://sundtek.de/media/netinst/armsysvhf/installer.tar.gz"
else
logger -t Sundtek "### Unsupported architecture ###"
cd ..
rm -fr tmp/
exit 1
fi
# test only !!!
#INSTALLER_URL="http://sundtek.de/support/installer.tar.gz"
wget -O installer.tar.gz $INSTALLER_URL
wget -O ../driver-version.txt http://sundtek.de/media/latest.phtml
logger -t Sundtek "### Extracting installer ###"
tar -xzf installer.tar.gz
if [ $? -ne 0 ]; then
logger -t Sundtek "### Installer damaged ###"
cd ..
rm -fr tmp/
exit 2
fi
cp -Pa opt/bin/* ../bin/
cp -Pa opt/lib/* ../lib/
cp ../driver-version.txt $ADDON_HOME/
cd ..
rm -fr tmp/
logger -t Sundtek "### Installer finished ###"
fi
if [ ! -f $ADDON_HOME/driver-version.txt ]; then
cp $ADDON_DIR/driver-version.txt $ADDON_HOME/
fi
# enable to install same version again
rm -f /storage/.xbmc/addons/packages/driver.dvb.sundtek-*
# add alias for /opt/bin/mediaclient
#alias_set="$(grep /opt/bin/mediaclient /storage/.profile 2>/dev/null)"
alias_set="$(grep libmediaclient.so /storage/.profile 2>/dev/null)"
if [ -z "$alias_set" ]; then
echo "" >>/storage/.profile
#echo "alias /opt/bin/mediaclient=/storage/.xbmc/addons/driver.dvb.sundtek/bin/mediaclient" >>/storage/.profile
echo "[ -f /storage/.xbmc/addons/driver.dvb.sundtek/lib/libmediaclient.so ] && export LD_PRELOAD=/storage/.xbmc/addons/driver.dvb.sundtek/lib/libmediaclient.so" >>/storage/.profile
echo "" >>/storage/.profile
fi
export LD_PRELOAD=$ADDON_DIR/lib/libmediaclient.so
if [ "$ANALOG_TV" = "true" -a ! -f "$ADDON_DIR/bin/plugins/lib/libavcodec.so.54.12.100" ]; then
logger -t Sundtek "### Downloading missing ffmpeg libraries ###"
cd $ADDON_DIR/bin
mkdir -p plugins/
cd plugins/
ARCH=$(sed -n 's|.*\.\([^-]*\)-.*|\1|p' /etc/release | tr -d '\n')
wget -O sundtek-ffmpeg-analog_tv-lib.tgz http://dl.dropbox.com/u/8224157/public/sundtek/sundtek-ffmpeg-analog_tv-lib-$ARCH.tgz
logger -t Sundtek "### Extracting ffmpeg libraries ###"
tar -xzf sundtek-ffmpeg-analog_tv-lib.tgz
if [ $? -ne 0 ]; then
logger -t Sundtek "### Ffmpeg library archive damaged ###"
rm -f sundtek-ffmpeg-analog_tv-lib.tgz
exit 2
fi
rm -f sundtek-ffmpeg-analog_tv-lib.tgz
fi
if [ -z "$(pidof mediasrv)" ]; then
rm -f /var/log/mediasrv.log
rm -f /var/log/mediaclient.log
rm -f $SUNDTEK_READY
mediasrv --wait-for-devices -p $ADDON_DIR/bin -c $ADDON_HOME/sundtek.conf -d
if [ -n "$NETWORK_TUNER_IP" -a "$NETWORK_TUNER_IP" != "0.0.0.0" ]; then
logger -t Sundtek "### Trying to connect to Sundtek network device IP $NETWORK_TUNER_IP ###"
mediaclient --mount=$NETWORK_TUNER_IP
else
logger -t Sundtek "### Trying to attach Sundtek device ###"
fi
# wait for device to get attached or connected
for i in $(seq 1 240); do
if [ -n "$NETWORK_TUNER_IP" -a -e /dev/dvb/adapter*/frontend* ]; then
sh $ADDON_DIR/bin/device-attached.sh
fi
if [ -f $SUNDTEK_READY ]; then
rm -f $SUNDTEK_READY
logger -t Sundtek "### Sundtek ready ###"
if [ -n $SETTLE_TIME -a $SETTLE_TIME -gt 0 ]; then
logger -t Sundtek "### Settle for $SETTLE_TIME sec ###"
sleep $SETTLE_TIME
fi
break
elif [ "$i" = "240" ]; then
logger -t Sundtek "### No Sundtek device attached or connected ###"
return
else
usleep 500000
fi
done
if [ "$ANALOG_TV" = "true" ]; then
logger -t Sundtek "### Switching to analog TV mode ###"
#rm -fr /dev/dvb/
mediaclient --disable-dvb=/dev/dvb/adapter0
fi
if [ "$RUN_USER_SCRIPT" = "true" -a -f "$ADDON_HOME/userscript.sh" ]; then
logger -t Sundtek "### Running user script $ADDON_HOME/userscript.sh ###"
cat $ADDON_HOME/userscript.sh | dos2unix >/var/run/sundtek-userscript.sh
sh /var/run/sundtek-userscript.sh
fi
(
# save adapter serial number in background
sleep 5
serial_number_old=$(cat $ADDON_HOME/adapters.txt 2>/dev/null)
serial_number_new=$(mediaclient -e | awk '/device / {print $0} /ID:/ {print $2}')
if [ "$serial_number_old" != "$serial_number_new" ]; then
echo "$serial_number_new" >$ADDON_HOME/adapters.txt
fi
)&
fi

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="1000">General</string>
<string id="1011">Auto update binary driver</string>
<string id="1012">Analog TV</string>
<string id="1013">Network tuner IP</string>
<string id="1014">Extra settle time</string>
<string id="1015">Run user script</string>
</strings>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="1000">
<setting label="1010" type="lsep" />
<setting type="sep" />
<setting id="AUTO_UPDATE" type="bool" label="1011" default="false" />
<setting id="ANALOG_TV" type="bool" label="1012" default="false" enable="false" />
<setting id="NETWORK_TUNER_IP" type="ipaddress" label="1013" default="0.0.0.0" />
<setting id="SETTLE_TIME" type="number" label="1014" default="0" />
<setting id="RUN_USER_SCRIPT" type="bool" label="1015" default="false" />
</category>
</settings>

View File

@ -23,12 +23,12 @@
. /etc/profile
LOCKDIR="/var/lock/"
LOCKFILE="sundtek-mediatv"
LOCKFILE="sundtek"
case "$1" in
hibernate|suspend)
if [ -n "$(pidof mediasrv)" ]; then
progress "Shutting down Sundtek MediaTV DVB driver for suspending..."
progress "Shutting down Sundtek DVB driver for suspending..."
mkdir -p "$LOCKDIR"
touch "$LOCKDIR/$LOCKFILE"
mediaclient --shutdown