On Wed, 2006-01-11 at 17:51 +0100, Romain DEGEZ wrote: > Hi list and happy new year :-) > > The signal & snr value reported by the cx24123 frontend of my Hauppauge > Nova-S plus seems very strange. > > By reading the specs of the connexant chips provided by Steve Toth few > weeks ago on this list I found that the value read in the 3B register > "represents the 8 MSBs of the specific accumulator and is in two's > complement format". Two's complement format is the common format used nearly everywhere for storing signed numbers. > > 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 stored in twos complement format, but I guess this isn't what wou want. 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. Warning: My memory of these things is a bit shaken, I could be very wrong here. Regards Sigmund > > But even if that value is more realistic ... it is maybe still not the good one > (see the comparison below). > > About the snr value, I do not understand the behaviour of the current code, and why > I am having so strange values compared to my old Hauppage NOVA-S ... > > Old card (values reported are good and very accurate with more or less 200 cards of this type > on different carriers all arround the world) : > > using '/dev/dvb/adapter0/frontend0' > FE: STV0299/TSA5059/SL1935 based (SAT) > signal%: 70| snr%: 83 > status 1f| signal b547| snr d47f| ber 00000500| unc 00000000| FE_HAS_LOCK > > New card with patch applied (without, signal is 12%) > > using '/dev/dvb/adapter0/frontend0' > FE: Hauppauge Nova-S-Plus CX24123/CX24109 (SAT) > signal%: 86| snr%: 00 > status 1f| signal de00| snr 0000| ber 003fffff| unc 003fffff| FE_HAS_LOCK > > Note that there is still a big diff between old and new cards.. > Please advise. > > Last things: I'm using a kernel 2.4.30 version of the drivers (Old 2.4 code provided by Steve > Toth and patched by me with changes made in the 2.6 versions). > > Thanks > > plain text document attachment (cx24123_signal_stength.diff) > --- v4l-dvb/linux/drivers/media/dvb/frontends/cx24123.c 2005-12-07 15:27:46.000000000 +0100 > +++ v4l-dvb-dev/linux/drivers/media/dvb/frontends/cx24123.c 2006-01-11 17:06:43.000000000 +0100 > @@ -689,7 +689,7 @@ static int cx24123_read_ber(struct dvb_f > static int cx24123_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) > { > struct cx24123_state *state = fe->demodulator_priv; > - *signal_strength = cx24123_readreg(state, 0x3b) << 8; /* larger = better */ > + *signal_strength = ~(cx24123_readreg(state, 0x3b) - 1) << 8; /* larger = better */ > > return 0; > } > _______________________________________________ > > linux-dvb@xxxxxxxxxxx > http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb