Re:cinergyT2 problems - DVB API changes?

Nico Sabbi <[email protected]>
Newsgroups gmane.comp.video.mplayer.user.dvb
Message-ID <[email protected]>
>And thus spake Nico Sabbi <nsabbi at tiscali.it <http://mplayerhq.hu/mailman/listinfo/mplayer-dvb>>
>Thu, 23 Dec 2004 17:20:31 +0100:
>
>>/ zap is the right format. Now I remember that that driver seems to be 
/>>/ incomplete: it doesn't implement
/>>/ (correctly?) the FE_GET_EVENT ioctl(), so it's the driver that is 
/>>/ breaking the API.
/>>/ I should replace that call with FE_READ_STATUS, but I won't have time to 
/>>/ do it until I'm back
/>>/ (maybe around 27 december).
/>>/ Are you using the last cvs of dvb-kernel? If not there's a chance that 
/>>/ the bug is fixed.
/>>/ Otherwise you should report this problem to the ML.
/>
>No, I use the version in 2.6.10-rc3 (since I use that kernel for other
>reasons anyway). I will try a more recent cvs version, maybe that helps.
>
>Thanks,
>Robert

Please, try the attached patch and report if it works; in this case I'll commit to cvs.

I got rid of FE_GET_EVENT for DVB_HEAD drivers, so now it works like ?zap.

	Nico

_______________________________________________
MPlayer-dvb mailing list
[email protected]
http://mplayerhq.hu/mailman/listinfo/mplayer-dvb
dvb.diff (text/x-patch, 3.7 KB)
Index: dvb_tune.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/dvb_tune.c,v
retrieving revision 1.9
diff -c -u -c -u -r1.9 dvb_tune.c
--- dvb_tune.c	26 Aug 2004 19:38:16 -0000	1.9
+++ dvb_tune.c	29 Dec 2004 21:22:42 -0000
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <error.h>
+#include <time.h>
 #include <errno.h>
 #include "config.h"
 
@@ -332,14 +333,9 @@
 {
 	int32_t strength;
 	fe_status_t festatus;
-	struct dvb_frontend_event event;
 	struct pollfd pfd[1];
-
-	while(1) 
-	{
-	    if (ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)	//EMPTY THE EVENT QUEUE
-	    	break;
-	}
+	int ok=0, locks=0;
+	time_t tm1, tm2;
 
 	if (ioctl(fd_frontend,FE_SET_FRONTEND,feparams) < 0)
 	{
@@ -350,46 +346,50 @@
 	pfd[0].fd = fd_frontend;
 	pfd[0].events = POLLPRI;
 
-	event.status=0;
-	while (((event.status & FE_TIMEDOUT)==0) && ((event.status & FE_HAS_LOCK)==0))
+	mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend status\n");
+	tm1 = tm2 = time((time_t*) NULL);
+	while(!ok)
 	{
-		mp_msg(MSGT_DEMUX, MSGL_V, "polling....\n");
-		if(poll(pfd,1,10000) > 0)
+		festatus = 0;
+		if(poll(pfd,1,3000) > 0)
 		{
 			if (pfd[0].revents & POLLPRI)
 			{
-				mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend event\n");
-				if ( ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
-				{
-					mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_EVENT");
-					return -1;
-				}
+				if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0)
+					if(festatus & FE_HAS_LOCK)
+						locks++;
 			}
-			print_status(event.status);
 		}
+		usleep(10000);
+		tm2 = time((time_t*) NULL);
+		if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= 3))
+			ok = 1;
 	}
 
-	if(event.status & FE_HAS_LOCK)
+	if(festatus & FE_HAS_LOCK)
 	{
+		if(ioctl(fd_frontend,FE_GET_FRONTEND,feparams) >= 0)
+		{
 		switch(tuner_type)
 		{
 			case FE_OFDM:
-			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",event.parameters.frequency);
+			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",feparams->frequency);
 			break;
 			case FE_QPSK:
-			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",(unsigned int)((event.parameters.frequency)+base));
-			mp_msg(MSGT_DEMUX, MSGL_V, "        SymbolRate: %d\n",event.parameters.u.qpsk.symbol_rate);
-			mp_msg(MSGT_DEMUX, MSGL_V, "        FEC_inner:  %d\n",event.parameters.u.qpsk.fec_inner);
+			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",(unsigned int)((feparams->frequency)+base));
+			mp_msg(MSGT_DEMUX, MSGL_V, "        SymbolRate: %d\n",feparams->u.qpsk.symbol_rate);
+			mp_msg(MSGT_DEMUX, MSGL_V, "        FEC_inner:  %d\n",feparams->u.qpsk.fec_inner);
 			mp_msg(MSGT_DEMUX, MSGL_V, "\n");
 			break;
 			case FE_QAM:
-			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",event.parameters.frequency);
-			mp_msg(MSGT_DEMUX, MSGL_V, "        SymbolRate: %d\n",event.parameters.u.qpsk.symbol_rate);
-			mp_msg(MSGT_DEMUX, MSGL_V, "        FEC_inner:  %d\n",event.parameters.u.qpsk.fec_inner);
+			mp_msg(MSGT_DEMUX, MSGL_V, "Event:  Frequency: %d\n",feparams->frequency);
+			mp_msg(MSGT_DEMUX, MSGL_V, "        SymbolRate: %d\n",feparams->u.qpsk.symbol_rate);
+			mp_msg(MSGT_DEMUX, MSGL_V, "        FEC_inner:  %d\n",feparams->u.qpsk.fec_inner);
 			break;
 			default:
 			break;
 		}
+		}
 
 		strength=0;
 		if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0)
@@ -403,8 +403,10 @@
 		if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
 		mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);
 
-		festatus=0;
-		if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0)
+		strength=0;
+		if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0)
+		mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength);
+		
 		print_status(festatus);
 	}
 	else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.