Mailing List archive

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

[vdr] Re: tech.diff



On Sun, Jun 23, 2002 at 07:04:30PM +0200, Alessio Sangalli wrote:
> Martin Neuditschko wrote:
> 
> 
> >Something is strange here:
> >The first 3-4 digits of SNR are equal to the first 3-4 digits of SS!
> >Is it possible that something in DvbApi->getSNR() - DvbApi->getSS()
> >is wrong?
> 
> it would be possible, the fact is that I don't know which kind of values 
> dvb-c cards return.
> 
> Isn't there an error message on the terminal window? Could you 
> experiment this: in dvbapi.c:
> 
> 
> #ifdef TECH
> int cDvbApi::getSS()
> {
>   int SS = 0;
>   if(ioctl(fd_frontend, FE_READ_SIGNAL_STRENGTH, &SS) < 0)
>   {
>     perror("Error reding SS:");
>     return 0;
>   }
>   if(SS>256) SS/=256; // this is a very poor way to test if the value 
> returned by
>                       // the ioctl is a 16 bit one; if yes it's 
> converted into 8 bit
>   return SS;
> }
> 
> int cDvbApi::getSNR()
> {
>   int SNR = 0;
>   if(ioctl(fd_frontend, FE_READ_SNR, &SNR) < 0)
>   {
>     perror("Error reding SNR:");
>     return 0;
>   }
>   return SNR;
> }

I didn't get an output on the terminal.

Because of the line:

if(SS>256) SS/=256;

My SS is negative and a 4 byte value!
So it should be:

for(int i=0;i<4;i++)
  if(labs(SS)>256 SS/=256;

to get a value below 256.


Look at these values:
SS=  -970063248=0x    C62E0270, SNR=-970.000000
SS=  -970063248=0x    C62E0270, SNR=-970.000000
SS= -1070718352=0x    C02E2270, SNR=-1070.000000
SS= -1070718352=0x    C02E2270, SNR=-1070.000000

If you do SS=SS/(256*256) SS will be the same as SNR!

If the first two bytes will be truncated you get these values:
SS=0x0270 (624)
SS=0x0270 (624)
SS=0x2270 (8816)
SS=0x2270 (8816)

These jumps are very high. Could it be that the card deliveres
a value with the wrong endian or that the nibbles are mirrored?
After endian conversion:
SS=0x7002 (28674)
SS=0x7002 (28674)
SS=0x7022 (28706)
SS=0x7022 (28706)

Or after nibble mirroring:
SS=0x0720 (1826)
SS=0x0720 (1826)
SS=0x0722 (1828)
SS=0x0722 (1828)

I don't know which values are normal (for DVB-s cards)

best regards
Martin Neuditschko




Home | Main Index | Thread Index