Forums » Tutorial and setups »
Startup delay waiting for DVB tuners
Added by Nico Feenstra over 11 years ago
A while ago I modified the Debian init script to suit my setup with 3 Sundtek DVB-C devices. Sometimes it takes a while before all devices become ready. This script checks if all devices are ready.
In /etc/default/tvheadend
# this value I added myself: WAIT_FOR_ADAPTERS="0 1 2" # this value is already there TVH_DELAY=15
In /etc/init.d/tvheadend
Replace
[ ! -z "$TVH_DELAY" ] && sleep $TVH_DELAY
With
for t in $WAIT_FOR_ADAPTERS do WAITED=0 while [ ! -c "/dev/dvb/adapter${t}/frontend0" ] && [ $WAITED -le $TVH_DELAY ]; do sleep 1s && log_daemon_msg "`date`: TVHeadend Init; tuner device ${t} is not ready. Waiting 1 second..." "$NAME" WAITED=$((WAITED + 1)) done [ ! -c "/dev/dvb/adapter${t}/frontend0" ] && log_daemon_msg "`date`: TVHeadend Init; tuner device ${t} not ready after delay. Continue anyway." "$NAME" done
Now every adapters gets its own delay but usually when one adapter is configured, the rest is available within a few seconds. Furthermore after the total delay TVHeadend will startup anyway.