[mythtv] Tuning lock failures

Allan Stirling Dibblahmythml0015 at pendor.org
Tue Aug 30 12:20:32 UTC 2005


I'm also still having issues with the tuning code.

2005-08-30 11:45:25.634 DVBEvents: Flushing Event Status() 
frequency(9739288 Hz)
2005-08-30 11:45:25.634 DVB#0 DVBChannel::Tune: Frequency tuning successful.
2005-08-30 11:45:25.636 SIScan(0): ScanWizardScanner::HandleTuneComplete()
2005-08-30 11:45:25.637 SIScan(0): ScanTransports()
2005-08-30 11:45:25.637 SIScan(0): ScanTransports()

... It marks tuning as successful when it's not, and doesn't wait for an 
event in this case. I think there may have been a confusion as to my 
initial issue with tuning. It appears that the event in my case doesn't 
actually mean that the FE already has a lock - But that it lost lock on 
the original channel.

http://www.linuxtv.org/pipermail/linux-dvb/2005-August/004173.html

With the attached patch, things look a little better:
2005-08-30 12:51:29.060 SIScan(u): ScanWizardScanner::scan(): type(6) 
src(1) transport(0) card(2)
2005-08-30 12:51:29.066 DVB#1 Device Name: 'ST STV0299 DVB-S'
2005-08-30 12:51:29.066 DVB#1 Opening DVB channel
2005-08-30 12:51:29.066 DVB#1 Using DVB card 1, with frontend ST STV0299 
DVB-S.
2005-08-30 12:51:29.373 SM:    AddFlags: Seen() Match() 
Wait(Sig,SNR,BER,UB,)
2005-08-30 12:51:29.373 DVBSM(1)::constructor(): initial flags 0x7400000
2005-08-30 12:51:29.374 SIScan(1): Creating SIParser
2005-08-30 12:51:29.374 SIParser: About to do a reset
2005-08-30 12:51:29.374 SIParser: Closing all PIDs
2005-08-30 12:51:29.374 SIParser: Using DelAllPids from SIParser which 
does nothing
2005-08-30 12:51:29.374 SIParser: Resetting all Table Handlers
2005-08-30 12:51:29.374 SIParser: SIParser Reset due to channel change
2005-08-30 12:51:29.374 SIParser: Added preferred language aar with 
priority 1
2005-08-30 12:51:29.374 SIParser: Added preferred language aar with 
priority 2
2005-08-30 12:51:29.374 DVB#1 DVB SI Table Parser Started
2005-08-30 12:51:29.374 SIScan(1): Connecting up SIParser
2005-08-30 12:51:29.375 SIParser: Starting DVB Section Reader thread
2005-08-30 12:51:29.458 DVB#1 Setting LNB: Tone OFF 18V
2005-08-30 12:51:29.478 DVBEvents: Flushing Event Status() 
frequency(9739286 Hz)
2005-08-30 12:51:29.480 DVB#1 Waiting for event
2005-08-30 12:51:29.582 DVB#1 Event Status(Signal,Carrier,FEC 
Stable,Sync,Lock,) frequency(9740699 Hz)
2005-08-30 12:51:29.582 DVB#1 DVBChannel::Tune: Frequency tuning successful.
2005-08-30 12:51:29.583 SIScan(1): ScanWizardScanner::HandleTuneComplete()
2005-08-30 12:51:29.583 SIScan(1): ScanTransports()
2005-08-30 12:51:29.583 SIScan(1): ScanTransports()
2005-08-30 12:51:29.583 FillPMap(str dvb)
2005-08-30 12:51:29.583 FillPMap(SIS dvb)
2005-08-30 12:51:29.583 SIParser: Requesting PAT
2005-08-30 12:51:29.586 SIScan(1): Starting SIScanner
2005-08-30 12:51:30.459 SIParser: Table[0]->RequirePIDs() == true
2005-08-30 12:51:30.459 SIParser: Adding PID 0x   0 Filter 0x 0 Mask 
0xff Buffer 40960
2005-08-30 12:51:30.459 SIParser: Table[2]->RequirePIDs() == true
2005-08-30 12:51:30.459 SIParser: Adding PID 0x1ffb Filter 0xff Mask 0x 
0 Buffer 40960
2005-08-30 12:51:30.460 SIParser: Table[3]->RequirePIDs() == true
2005-08-30 12:51:30.460 SIParser: Adding PID 0x1ffb Filter 0xff Mask 0x 
0 Buffer 40960
2005-08-30 12:51:30.460 SIParser: Table[6]->RequirePIDs() == true
2005-08-30 12:51:30.460 SIParser: Adding PID 0x  10 Filter 0x40 Mask 
0xff Buffer 40960
2005-08-30 12:51:30.884 SIParser: PAT Version = 16
2005-08-30 12:51:30.885 SIParser: Tuned to TransportID: 2041
2005-08-30 12:51:30.885 SIParser: NIT Present on this transport on PID 0x10
2005-08-30 12:51:30.885 SIParser: PMT #10170 on PID 0x259
2005-08-30 12:51:30.885 SIParser: PMT #10180 on PID 0x260
2005-08-30 12:51:30.885 SIParser: PMT #10181 on PID 0x262
2005-08-30 12:51:30.885 SIParser: PMT #10189 on PID 0x257
2005-08-30 12:51:30.885 SIParser: PMT #10190 on PID 0x263
2005-08-30 12:51:30.885 SIParser: PMT #10191 on PID 0x258
2005-08-30 12:51:30.885 SIParser: PMT #10199 on PID 0x256
2005-08-30 12:51:30.885 SIParser: Services on this Transport: 10170 
10180 10181 10189 10190 10191 10199
2005-08-30 12:51:30.885 SIParser: Table[0]->Complete() == true
2005-08-30 12:51:38.277 SIParser: No Private Types defined for NetworkID 2
2005-08-30 12:51:46.039 SIParser: Table[6]->Complete() == true
2005-08-30 12:51:46.039 SIParser: Table[5]->RequirePIDs() == true
2005-08-30 12:51:46.039 SIParser: Adding PID 0x  11 Filter 0x46 Mask 
0xfb Buffer 40960
2005-08-30 12:51:46.039 SIParser: Table[6]->EmitRequired() == true
2005-08-30 12:51:46.039 SIScan(1): TransportTableComplete()
2005-08-30 12:51:46.117 SIParser: SDT: NetworkID=2 TransportID=2010
2005-08-30 12:51:46.121 SIParser: Table[4]->RequirePIDs() == true
2005-08-30 12:51:46.121 SIParser: Adding PID 0x  12 Filter 0x 0 Mask 0x 
0 Buffer 4096000
2005-08-30 12:51:46.175 SIParser: SDT: NetworkID=2 TransportID=2051
.... (Many transports discovered)
2005-08-30 12:51:57.289 SIParser: SDT: NetworkID=2 TransportID=2009


... However, the scan stalls at this point.

Also, the code doesn't cope with the initial tune not happening - ie the 
user specifying a bad frequency.

All of this has been on my "plain" DVB card, I'm still having the issues 
from my other message with the switched input.

The patch is against current CVS with dvbchannel-v5.patch applied.

Cheers,

Allan.
-------------- next part --------------
--- ./libs/libmythtv/dvbchannel.cpp	2005-08-30 13:10:24.899479000 +0100
+++ /root/m3/mythtv/libs/libmythtv/dvbchannel.cpp	2005-08-30 12:59:43.855075000 +0100
@@ -579,16 +579,20 @@
             return false;
         }
 
-        bool frequency_unchanged =
-            ((old_params.frequency + 500000) > tuning.params.frequency) &&
-            (old_params.frequency < (tuning.params.frequency + 500000));
-        if (!have_params || !frequency_unchanged)
-        {
-            CHANNEL("Waiting for event");
-            struct dvb_frontend_event event;
-            if (get_dvb_event(fd_frontend, event, DVB_GET_EVENT_TIMEOUT))
-                CHANNEL(dvb_event_to_string(event));
+        if (have_params)
+        {
+            bool frequency_unchanged =
+                ((old_params.frequency + 500000) > tuning.params.frequency) &&
+                (old_params.frequency < (tuning.params.frequency + 500000));
+
+            if (frequency_unchanged)
+                tuning.params.frequency=old_params.frequency;
         }
+
+        CHANNEL("Waiting for event");
+        struct dvb_frontend_event event;
+        if (get_dvb_event(fd_frontend, event, true, DVB_GET_EVENT_TIMEOUT))
+            CHANNEL(dvb_event_to_string(event));
   
         prev_tuning.params = tuning.params;
         first_tune = false;
@@ -694,15 +698,25 @@
 static bool get_dvb_event(int fd, struct dvb_frontend_event &event,
                           bool block, int timeout)
 {
     QTime timer;
     timer.start();
     
     while ((timeout <= 0) || (timer.elapsed() < timeout))
     {
+        int ret;
         if (0 == ioctl(fd, FE_GET_EVENT, &event))
-            return true;
-        int ret = errno;
-        
+        {
+            fe_status_t tmp_stat;
+            ret = errno;
+            ioctl(fd, FE_READ_STATUS, &tmp_stat);
+            if (tmp_stat & FE_HAS_LOCK) {
+               return true;
+            } else {
+               usleep (50);
+            }
+        }
+        
         if (EWOULDBLOCK == ret)
         {
             if (!block)


More information about the mythtv-dev mailing list