[dvblast-devel] frontend not gets timed out due to lock_watcher initialisation issue

Gokhan Poyraz gokhan at clxdev.net
Sun Apr 30 13:40:03 CEST 2017


Hello,

I had experience a kind of “freeze” or “sleeping” issue if the frontend not gets signal lock at the very first time when dev_Open called.

There is a lock_watcher to call back FrontendLockCb for tuning frontend again for this purpose. But, some functions (i.e. ForntendSet) are restarting lock_watcher event before the event initialized for this watcher.

I was able to reproduce the issue many times and saw that fixed by applying below quick-dirty patch.

Please have a check.

Thanks and Kind Regards,
Gokhan Poyraz



diff -Nuar dvblast-3.1/dvb.c dvblast-3.1.lock_fix/dvb.c
--- dvblast-3.1/dvb.c	2017-01-31 20:13:29.000000000 +0200
+++ dvblast-3.1.lock_fix/dvb.c	2017-04-30 13:59:37.000000000 +0300
@@ -95,6 +95,8 @@
 
     msg_Dbg( NULL, "compiled with DVB API version %d.%d", DVB_API_VERSION, DVB_API_VERSION_MINOR );
 
+    lock_watcher.data = (void *) 0;
+
     if ( i_frequency )
     {
         sprintf( psz_tmp, "/dev/dvb/adapter%d/frontend%d", i_adapter, i_fenum );
@@ -127,6 +129,13 @@
                  strerror(errno) );
     }
 
+    ev_timer_init(&lock_watcher, FrontendLockCb,
+                  i_frontend_timeout_duration / 1000000.,
+                  i_frontend_timeout_duration / 1000000.);
+    ev_timer_init(&mute_watcher, DVRMuteCb,
+                  DVR_READ_TIMEOUT / 1000000.,
+                  DVR_READ_TIMEOUT / 1000000.);
+
     ev_io_init(&dvr_watcher, DVRRead, i_dvr, EV_READ);
     ev_io_start(event_loop, &dvr_watcher);
 
@@ -136,12 +145,7 @@
         ev_io_start(event_loop, &frontend_watcher);
     }
 
-    ev_timer_init(&lock_watcher, FrontendLockCb,
-                  i_frontend_timeout_duration / 1000000.,
-                  i_frontend_timeout_duration / 1000000.);
-    ev_timer_init(&mute_watcher, DVRMuteCb,
-                  DVR_READ_TIMEOUT / 1000000.,
-                  DVR_READ_TIMEOUT / 1000000.);
+    ev_timer_again(event_loop, &lock_watcher);
 
     en50221_Init();
 }
@@ -1351,8 +1355,10 @@
 
     i_last_status = 0;
 
-    if (i_frontend_timeout_duration)
-        ev_timer_again(event_loop, &lock_watcher);
+    if (i_frontend_timeout_duration) {
+        if (lock_watcher.data != (void *) 0)
+            ev_timer_again(event_loop, &lock_watcher);
+    }
 }
 
 #else /* !S2API */
@@ -1450,8 +1456,10 @@
 
     i_last_status = 0;
 
-    if (i_frontend_timeout_duration)
-        ev_timer_again(event_loop, &lock_watcher);
+    if (i_frontend_timeout_duration) {
+        if (lock_watcher.data != (void *) 0)
+            ev_timer_again(event_loop, &lock_watcher);
+    }
 }
 
 #endif /* S2API */




More information about the dvblast-devel mailing list