On Fri, Aug 26, 2005 at 07:51:58AM -0400, Daniel Kristjansson wrote:
> On Fri, 2005-08-26 at 11:54 +0100, Stuart Auchterlonie wrote:
> > 
> > a) No Event was delivered if the card had no change in tuning
> > b) You can't issue a FE_GET_STATUS until a FE_SET_STATUS(?) had be
> > done.
> 
> Heh, seems to be what I figured out experimentally. I commited a
> fix last night for this DVB API whackyness.
> 

Here's a patch that works for me.
Basically if it hasn't got an event in 500ms it does a
read status to see if it has lock.

With this patch I'm able to correctly pickup all the channels
on the first multiplex.

Now I'm going to go and work out why it is looping around
continually scanning the same multiplex....


Stuart

Index: libs/libmythtv/dvbchannel.cpp
===================================================================
--- libs/libmythtv/dvbchannel.cpp       (revision 108)
+++ libs/libmythtv/dvbchannel.cpp       (working copy)
@@ -856,7 +856,8 @@
 
 bool get_dvb_event(int fd, struct dvb_frontend_event &event, bool block)
 {
-    while (true)
+    int countWouldBlock = 0;
+    while (countWouldBlock < 10)
     {
         if (0 == ioctl(fd, FE_GET_EVENT, &event))
             return true;
@@ -867,6 +868,7 @@
             if (!block)
                 return false;
             usleep(50); // it would be nicer to use select...
+            countWouldBlock++;
         }
         else if (EOVERFLOW == ret)
             VERBOSE(VB_IMPORTANT, "DVBEvents: Oops, we lost some events...");
@@ -886,7 +888,14 @@
             VERBOSE(VB_IMPORTANT, "DVBEvents: unknown error... "<<ret);
             return false; // unknown error...
         }
-    }    
+    }
+    fe_status_t tmp_stat;
+    memset(&tmp_stat, 0, sizeof(fe_status_t));
+    if (ioctl(fd,FE_READ_STATUS, &tmp_stat)) {
+        if (tmp_stat == FE_HAS_LOCK)
+            return true;
+    }
+    return false;
 }
 
 QString dvb_event_to_string(const struct dvb_frontend_event &event)
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to