Mailing List archive

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

[vdr] Re: signal strength indicator



Alessio Sangalli <alesan@manoweb.com> schrieb:
> I've made exactly this, with a bandwith counter also. However it doesn't 
> work with all the drivers; when NEWSTRUCT will be used by vdr, 
> everything should hopefully work.

I ported the signal strength code for my rev 2.1 card from MultiDec to the
0.9.4 driver.
I works until now without problems.

diff -u stv0299.c.old stv0299.c
--- stv0299.c.old       Thu Feb  7 17:24:10 2002
+++ stv0299.c   Fri May 31 22:40:18 2002
@@ -337,7 +337,7 @@
 
 static int dvb_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
-        //struct stv0299 *stv=(struct stv0299 *) client->data;
+        struct stv0299 *stv=(struct stv0299 *) client->data;
                 
         switch (cmd) {
         case FE_READ_STATUS:
@@ -367,19 +367,33 @@
         case FE_READ_BER:
        {
                u32 *ber=(u32 *) arg;
-               *ber=0;
+               *ber=readreg(client, 0x15);
                break;
        }
         case FE_READ_SIGNAL_STRENGTH:
        {
                s32 *signal=(s32 *) arg;
-               *signal=0;
+               unsigned char s, vstatus;
+               vstatus=readreg(client, 0x1b);
+                if ( vstatus != 0x98 ) {
+                       writereg(client, 0x14, 0x80 | stv->bclk);
+                       writereg(client, 0x12, 0x39 );
+                       vstatus=readreg(client, 0x1b);
+               }; 
+
+               if ((vstatus&0x98)==0x98) s=0x1f;
+               else if ((vstatus&0x80)==0x80) s=0x03;
+               else s=0x00;
+
+               *signal=s;
                break;
        }
         case FE_READ_SNR:
        {
                s32 *snr=(s32 *) arg;
-               *snr=0;
+               int q;
+               q = (readreg(client,0x24)<<8)|readreg(client,0x25);
+               *snr=(255-(q/46))*256*256*8;
                break;
        }
        case FE_READ_UNCORRECTED_BLOCKS: 





Home | Main Index | Thread Index