Patchwork [3/6] package/tvheadend: wait for DVB devices

login
register
mail settings
Submitter Yann E. MORIN
Date Feb. 17, 2013, 11:22 p.m.
Message ID <265e8598251b35399c144699c4e0ffb250f87286.1361143078.git.yann.morin.1998@free.fr>
Download mbox | patch
Permalink /patch/221120/
State Rejected
Headers show

Comments

Yann E. MORIN - Feb. 17, 2013, 11:22 p.m.
Wait for DVB devices before starting up the tvheadend daemon.
Wait for maximum 15 seconds.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/tvheadend/S99tvheadend |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Peter Korsgaard - Feb. 22, 2013, 10:43 p.m.
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 Yann> Wait for DVB devices before starting up the tvheadend daemon.
 Yann> Wait for maximum 15 seconds.

 Yann> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 Yann> ---
 Yann>  package/tvheadend/S99tvheadend |    7 +++++++
 Yann>  1 files changed, 7 insertions(+), 0 deletions(-)

 Yann> diff --git a/package/tvheadend/S99tvheadend b/package/tvheadend/S99tvheadend
 Yann> index 407b873..3a1218a 100644
 Yann> --- a/package/tvheadend/S99tvheadend
 Yann> +++ b/package/tvheadend/S99tvheadend
 Yann> @@ -23,6 +23,13 @@ ARGS="-f"
 
 Yann>  case "$1" in
 Yann>      start)
 Yann> +        printf "Waiting for DVB device nodes..."
 Yann> +        cpt=15
 Yann> +        while [ ! -d /dev/dvb/adapter0 -a ${cpt} -gt 0 ]; do

I don't know much about tvheadend, but are people always going to use it
with dvb? E.G. I have a hdhomerun and a ivtv (v4l) device, but no dvb.
Yann E. MORIN - Feb. 22, 2013, 10:53 p.m.
Peter, All,

On Friday 22 February 2013 Peter Korsgaard wrote:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> 
>  Yann> Wait for DVB devices before starting up the tvheadend daemon.
>  Yann> Wait for maximum 15 seconds.
> 
>  Yann> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>  Yann> ---
>  Yann>  package/tvheadend/S99tvheadend |    7 +++++++
>  Yann>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
>  Yann> diff --git a/package/tvheadend/S99tvheadend b/package/tvheadend/S99tvheadend
>  Yann> index 407b873..3a1218a 100644
>  Yann> --- a/package/tvheadend/S99tvheadend
>  Yann> +++ b/package/tvheadend/S99tvheadend
>  Yann> @@ -23,6 +23,13 @@ ARGS="-f"
>  
>  Yann>  case "$1" in
>  Yann>      start)
>  Yann> +        printf "Waiting for DVB device nodes..."
>  Yann> +        cpt=15
>  Yann> +        while [ ! -d /dev/dvb/adapter0 -a ${cpt} -gt 0 ]; do
> 
> I don't know much about tvheadend, but are people always going to use it
> with dvb? E.G. I have a hdhomerun and a ivtv (v4l) device, but no dvb.

Right. This was intended to be a stop-gap as my rpi boots too fast, and
the USB devices are not completely enumerated by the time tvheadend starts
up. So I would end up with no DVB device at all in tvheadend.

So, please feel free to drop this patch, I'll try to think of another way.

Regards,
Yann E. MORIN.

Patch

diff --git a/package/tvheadend/S99tvheadend b/package/tvheadend/S99tvheadend
index 407b873..3a1218a 100644
--- a/package/tvheadend/S99tvheadend
+++ b/package/tvheadend/S99tvheadend
@@ -23,6 +23,13 @@  ARGS="-f"
 
 case "$1" in
     start)
+        printf "Waiting for DVB device nodes..."
+        cpt=15
+        while [ ! -d /dev/dvb/adapter0 -a ${cpt} -gt 0 ]; do
+            sleep 1
+            cpt=$((cpt-1))
+        done
+        printf "\n"
         printf "Starting TVHeadend daemon: "
         if start-stop-daemon -S -q -p ${PIDFILE} -m --exec "${DAEMON}" -- ${ARGS}; then
             printf "OK\n"