mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
sundtek: improved start, suspend and resume
This commit is contained in:
parent
7cd870af35
commit
86e25c471d
@ -1,3 +1,5 @@
|
||||
3.1.2
|
||||
new addon settings option to enable suspend/resume driver actions
|
||||
3.1.1
|
||||
rebuild for OpenELEC-3.2
|
||||
3.0.6
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
PKG_NAME="sundtek-mediatv"
|
||||
PKG_VERSION="3.1"
|
||||
PKG_REV="1"
|
||||
PKG_REV="2"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="nonfree"
|
||||
PKG_SITE="http://support.sundtek.com/"
|
||||
|
@ -6,6 +6,7 @@
|
||||
<setting id="ENABLE_HW_PID_FILTER" value="false" />
|
||||
<setting id="ENABLE_IR_RECEIVER" value="false" />
|
||||
<setting id="LOWEST_ADAPTER_NUM" value="0" />
|
||||
<setting id="SUSPEND_DRIVER" value="true" />
|
||||
<setting id="ALLOW_NET_USE" value="false" />
|
||||
<setting id="USE_NET_TUNERS" value="false" />
|
||||
<setting id="DEVICE1_IP" value="" />
|
||||
|
@ -22,6 +22,18 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
# start locking mechanism - allows only one instance to be run at a time
|
||||
SUNDTEK_LOCKFILE="/var/lock/userspace-driver-sundtek.lck"
|
||||
SUNDTEK_LOCKFD=99
|
||||
# obtain an exclusive lock
|
||||
exlock() { eval "exec $SUNDTEK_LOCKFD>\"$SUNDTEK_LOCKFILE\""; flock -x $SUNDTEK_LOCKFD; }
|
||||
# drop a lock
|
||||
unlock() { flock -u $SUNDTEK_LOCKFD; flock -xn $SUNDTEK_LOCKFD && rm -f "$SUNDTEK_LOCKFILE"; }
|
||||
# end locking mechanism
|
||||
|
||||
# exclusive lock
|
||||
exlock
|
||||
|
||||
net_tuner_num_fix() {
|
||||
local num=$1
|
||||
|
||||
@ -337,3 +349,6 @@ if [ -z "$(pidof mediasrv)" ]; then
|
||||
fi
|
||||
|
||||
logger -t Sundtek "### Sundtek ready ###"
|
||||
|
||||
# unlock the lock
|
||||
unlock
|
||||
|
@ -8,6 +8,7 @@
|
||||
<string id="1030">Enable hardware PID filter</string>
|
||||
<string id="1035">Enable IR receiver</string>
|
||||
<string id="1040">Lowest adapter number (/dev/dvb/adapterX/)</string>
|
||||
<string id="1050">Enable suspend/resume the driver</string>
|
||||
|
||||
<string id="2000">Networking</string>
|
||||
<string id="2005">Share local tuner over network</string>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<setting id="ENABLE_HW_PID_FILTER" type="bool" label="1030" default="false" />
|
||||
<setting id="ENABLE_IR_RECEIVER" type="bool" label="1035" default="false" />
|
||||
<setting id="LOWEST_ADAPTER_NUM" type="number" label="1040" default="0" />
|
||||
<setting id="SUSPEND_DRIVER" type="bool" label="1050" default="true" />
|
||||
</category>
|
||||
<category label="2000" >
|
||||
<setting type="sep" />
|
||||
|
@ -22,26 +22,42 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
LOCKDIR="/var/lock/"
|
||||
LOCKFILE="$LOCKDIR/sundtek-mediatv"
|
||||
SUNDTEK_ADDON_DIR="$HOME/.xbmc/addons/driver.dvb.sundtek-mediatv"
|
||||
SUNDTEK_ADDON_HOME="$HOME/.xbmc/userdata/addon_data/driver.dvb.sundtek-mediatv"
|
||||
SUNDTEK_ADDON_SETTINGS="$SUNDTEK_ADDON_HOME/settings.xml"
|
||||
|
||||
case "$1" in
|
||||
hibernate|suspend)
|
||||
if [ -n "$(pidof mediasrv)" ]; then
|
||||
progress "Shutting down Sundtek DVB driver for suspending..."
|
||||
mkdir -p "$LOCKDIR"
|
||||
touch "$LOCKFILE"
|
||||
killall -9 mediasrv
|
||||
fi
|
||||
;;
|
||||
if [ ! -f "$SUNDTEK_ADDON_SETTINGS" ]; then
|
||||
cp $SUNDTEK_ADDON_DIR/settings-default.xml $SUNDTEK_ADDON_SETTINGS
|
||||
fi
|
||||
|
||||
thaw|resume)
|
||||
if [ -f "$LOCKFILE" ]; then
|
||||
# driver started within Tvheadend/VDR
|
||||
rm -f "$LOCKFILE"
|
||||
fi
|
||||
;;
|
||||
mkdir -p /var/config
|
||||
cat "$SUNDTEK_ADDON_SETTINGS" | awk -F\" '{print $2"=\""$4"\""}' | sed '/^=/d' > /var/config/sundtek-addon.conf
|
||||
. /var/config/sundtek-addon.conf
|
||||
|
||||
*) exit $NA
|
||||
;;
|
||||
esac
|
||||
if [ "$SUSPEND_DRIVER" = "true" ]; then
|
||||
LOCKDIR="/var/lock/"
|
||||
LOCKFILE="$LOCKDIR/sundtek-mediatv"
|
||||
|
||||
case "$1" in
|
||||
hibernate|suspend)
|
||||
if [ -n "$(pidof mediasrv)" ]; then
|
||||
progress "Shutting down Sundtek DVB driver for suspending..."
|
||||
mkdir -p "$LOCKDIR"
|
||||
touch "$LOCKFILE"
|
||||
killall -9 mediasrv
|
||||
fi
|
||||
;;
|
||||
|
||||
thaw|resume)
|
||||
if [ -f "$LOCKFILE" ]; then
|
||||
# driver started within Tvheadend/VDR
|
||||
rm -f "$LOCKFILE"
|
||||
fi
|
||||
;;
|
||||
|
||||
*) exit $NA
|
||||
;;
|
||||
esac
|
||||
else
|
||||
progress "Suspend/resume of Sundtek driver not enabled..."
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user