[linux-dvb] [PATCH] cx24123 (NOVA S plus) signal strengh reporting

Romain DEGEZ romain.degez at smartjog.com
Thu Jan 12 11:42:25 CET 2006


Sigmund Augdal Helberg wrote:
> Two's complement format is the common format used nearly everywhere for
> storing signed numbers.

Hello,
First of all, thanks for your anwser.

Ok got it but ... does the statement "X is in two's complement format" imply that
X is used to represent a signed value ? :-)

Moreover I do not understand the need of a signed value in our case (AGC accumulator).
A negative value should be nonsense and the precision of the positive value is /2 compared
to an unsigned one.

>>So, I think the following line should be corrected (patch attached).
>>
>>- *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */
>>+ *signal_strength = ~(cx24123_readreg(state, 0x3b) - 1) << 8; /* larger = better */
> 
> This piece of code would be the proper way to change sign of a number
> Does the following line give meaningful values for you?
> *signal_strength = (cx24123_readreg(state, 0x3b)+0x80) << 8; /* larger =
> better */
> This would turn the number into an unsigned.

Wow. Are you sure of this ?
By doing this you add 1000000 to the return value (say 0x23 so 00100011).
So now we have 10100011. Look like a negative value in 2's complement format ?
I'm lost here :-)

Anyway by doing this, I have:
using '/dev/dvb/adapter0/frontend0'
FE: Hauppauge Nova-S-Plus CX24123/CX24109 (SAT)
signal%: 63| snr%: 00
status 1f| signal a300| snr 0000| ber 003fffff| unc 003fffff| FE_HAS_LOCK

The signal value (63%) is still very different from what I should have (~70%).

> Warning: My memory of these things is a bit shaken, I could be very
> wrong here.

I wasn't aware of such things (1's and 2's complement format) until yesterday
so anyway I learnt something here :-)

Regards,

-- 
Romain DEGEZ, System and Network Administrator

SMARTJOG S.A.
16 Place de la République, 75010 Paris, FRANCE
http://www.smartjog.com
Phone :  +33.1.49.96.63.19
Fax :    +33.1.49.96.64.05
Mobile : +33.6.84.24.65.21
romain.degez at smartjog.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://www.linuxtv.org/pipermail/linux-dvb/attachments/20060112/a52409ee/signature.pgp


More information about the linux-dvb mailing list