Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] WinTV Nova-CI, DiSEqC and dvbtune




I have a WinTV Nova-CI and a DiSEqC switch; the actual (CVS) driver
seems not able to send DiSEqC messages (there is a "// FIXME: support DiSEqC"
in the file dvb.c); I have tried to fix this and now my driver copy
work; I have found the specification of the tuner (BSRU6-502A) on a
Russian site http://www.gs.ru/?sect=sat_inet&s=SS1-15 (at the end there are
some links). 

I have also tried to fix the code for the STV0299 chips so
the ioctl() FE_READ_BER, FE_READ_SNR and FE_READ_SIGNAL_STRENGTH work
(I hope correctly); the value returned by the FE_READ_SIGNAL_STRENGTH 
would be scaled and I do not know how to do this.

I usually use dvbtune 0.3 to tune the card but my DiSEqC switch use
the tone burst so I have made a very little modification to use the
-D command line switch of dvbtune to generate only the tone burst 
(-D -1 generate the A tone burst and -D -2 generate the B tone burst).

A little question: what is FE_READ_AFC? There isn't into the documentation!

My English is very bad ;-)

-Massimiliano Giorgi

================ for the driver =========================

--- dvb.c.original	Wed Jun 19 19:48:35 2002
+++ dvb.c	Wed Jun 19 22:29:39 2002
@@ -2508,11 +2508,32 @@
                 Set22K(dvb, dvb->sec.ttk);
                 break;
 
         case DVB_CARD_TT_BUDGET_CI:
-                // FIXME: support DiSEqC
-                Set22K(dvb, dvb->sec.ttk);
-                break;
+          {
+            u8 diseqc=demod_readreg(dvb,0x08)&0xfc;
+            demod_writereg(dvb, 0x08, diseqc); 
+            mdelay(16);
+            if (len>0) {
+              demod_writereg(dvb,0x08,(diseqc|0x06));
+              for (i=0;i<len;i++) {
+                while ((demod_readreg(dvb,0x0a)&0x3)!=0x02);
+                demod_writereg(dvb,0x09,msg[i]);
+              }
+              mdelay(16);
+            }
+            if (burst!=-1) {
+              demod_writereg(dvb,0x08,(diseqc|0x02));
+              while ((demod_readreg(dvb,0x0a)&0x03)!=0x02);
+              if (burst) demod_writereg(dvb,0x09,0xff);
+              else demod_writereg(dvb,0x09,0x00);
+              mdelay(13);
+              demod_writereg(dvb,0x08,diseqc);
+              mdelay(16);
+            }
+            Set22K(dvb,dvb->sec.ttk);
+          }
+          break;
 
         default:
                 return -1;
         }
--- stv0299.c.original	Thu Jun 20 23:50:31 2002
+++ stv0299.c	Thu Jun 20 00:15:41 2002
@@ -366,21 +366,37 @@
 	}
         case FE_READ_BER:
 	{
 		u32 *ber=(u32 *) arg;
-		*ber=0;
+
+		writereg(client,0x24,0x13);
+		*ber = readreg(client,0x1d);
+                *ber|=(readreg(client,0x1e)<<8);
+		*ber*=38147;
+		*ber/=10;
 		break;
 	}
         case FE_READ_SIGNAL_STRENGTH:
 	{
 		s32 *signal=(s32 *) arg;
-		*signal=0;
+		
+		#warning FIXME! the value must be scaled properly
+		u32 s;
+		s = readreg(client,0x19);
+                s|=(readreg(client,0x18)<<8);		
+		*signal=-70000000+(0xffff-s)*1000;
 		break;
 	}
         case FE_READ_SNR:
 	{
 		s32 *snr=(s32 *) arg;
-		*snr=0;
+		u32 nir;
+		nir = readreg(client,0x25);
+                nir|=(readreg(client,0x24)<<8);
+		if (nir>11188)
+		  *snr=0;
+		else
+		  *snr=19020000-1700*nir;
 		break;
 	}
 	case FE_READ_UNCORRECTED_BLOCKS: 
 	{

====================== for dvbtune 0.3 ==================

--- dvbtune.c.original	Thu Jun 20 00:21:29 2002
+++ dvbtune.c	Thu Jun 20 00:22:31 2002
@@ -1048,10 +1048,10 @@
         srate=atoi(argv[i])*1000UL;
       } else if (strcmp(argv[i],"-D")==0) {
         i++;
         diseqc=atoi(argv[i]);
-        if (diseqc > 4) {
-	  fprintf(stderr,"DiSEqC must be between 0 and 4\n");
+        if (diseqc > 4 || diseqc < -2) {
+	  fprintf(stderr,"DiSEqC must be between -2 and 4\n");
           exit(-1);
         }
       } else if (strcmp(argv[i],"-t")==0) {
 	i++;
--- tune.c.original	Thu Jun 20 00:21:14 2002
+++ tune.c	Thu Jun 20 00:26:16 2002
@@ -178,21 +178,24 @@
     if (ioctl(fd_sec,SEC_SET_TONE,tone) < 0) {
        perror("ERROR setting tone\n");
     }
 
-    if (diseqc > 0) {
+    if (diseqc != 0) {
       struct secCommand scmd;
       struct secCmdSequence scmds;
 
       scmds.continuousTone = tone;
       scmds.voltage = voltage;
       /*
       scmds.miniCommand = toneBurst ? SEC_MINI_B : SEC_MINI_A;
       */
-      scmds.miniCommand = SEC_MINI_NONE;
+      if (diseqc>0)
+	scmds.miniCommand = SEC_MINI_NONE;
+      else
+	scmds.miniCommand = (diseqc==-1? SEC_MINI_A : SEC_MINI_B);
 
       scmd.type = 0;
-      scmds.numCommands = 1;
+      scmds.numCommands = diseq>0?1:0;
       scmds.commands = &scmd;
 
       scmd.u.diseqc.addr = 0x10;
       scmd.u.diseqc.cmd = 0x38;





-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index