Fixing dvbv5-scan unicable support
PATCH 1/1 Fixing dvbv5-scan unicable support
Hi everyone!
When trying to use dvbv5-scan in scr/unicable mode with -U 1210000 I get an L-Band frequency of 161424.00 MHz which is wrong, therefore the resulting DiSEqC command that is being sent to the LNB is also wrong.
This patch tries to change dvbv5-scan to to send a correct DiSEqC command. I captured the DiSEqC command from a working tv and replicated it successfully.
Unfortunately even though I get a measurable result (the LNB seems to tune the right transponder to the right userband) dvbv5-scan does not manage to get a lock.
I think something about the userband offset calculation might be wrong but I have been unable to pinpoint the issue for several days now. Any help would be greatly appreciated.
lib/libdvbv5/dvb-sat.c +20 -8
@@ -502,9 +502,12 @@ static int dvbsat_scr_odu_channel_change(struct dvb_v5_fe_parms_priv *parms, cmd->data0 |= (sat_number &0x7 ) <<5 ; pos_b = (sat_number &0x8 ) ?1 :0 ; + + +dvb_log ("DiSEqC command highband= %d" , high_band);/* Fill the LNB number */ - cmd->data0 |= high_band ?0 :4 ; - cmd->data0 |= pol_v ?8 :0 ; + cmd->data0 |= high_band ?4 :0 ; + cmd->data0 |= pol_v ?0 :8 ; cmd->data0 |= pos_b ?16 :0 ;return dvb_fe_diseqc_cmd (&parms->p, cmd->len, cmd->msg);
@@ -662,11 +665,11 @@ static int dvb_sat_get_freq(struct dvb_v5_fe_parms *p, uint16_t *t) } }else {if (parms->p.verbose >1 ) -dvb_log ("Seeking for LO for %.2f MHz frequency" , freq /1000000. ); +dvb_log ("Seeking for LO for %.2f GHz frequency" , freq /1000000. );/* Multi-LO (dual-band) LNBf using DiSEqC */ for (j =0 ; j <ARRAY_SIZE (lnb->freqrange) && lnb->freqrange[j].low; j++) {if (parms->p.verbose >1 ) -dvb_log ("LO setting %i: %.2f MHz to %.2f MHz" , j, +dvb_log ("LO setting %i: %.2f GHz to %.2f GHz" , j, lnb->freqrange[j].low /1000. , lnb->freqrange[j].high /1000. );if (freq < lnb->freqrange[j].low *1000 || freq > lnb->freqrange[j].high *1000 )
@@ -682,10 +685,19 @@ static int dvb_sat_get_freq(struct dvb_v5_fe_parms *p, uint16_t *t)if (parms->p.freq_bpf) {/* For SCR/Unicable setups */ - *t = (((freq /1000 ) + parms->p.freq_bpf +2 ) /4 ) -350 ; - parms->freq_offset += ((*t +350 ) *4 ) *1000 ; -if (parms->p.verbose) -dvb_log ("BPF: %d KHz" , parms->p.freq_bpf); +int base_freq =abs (freq /1000 - lnb->freqrange[j].int_freq) + parms->p.freq_bpf /1000 ; + *t = base_freq /4 -350 ; +int rounded_freq =4 * (*t +350 ); +int rounding_offset = rounded_freq - base_freq; + + parms->freq_offset = freq - (parms->p.freq_bpf /1000 + rounding_offset )*1000 ; + +if (parms->p.verbose) { +dvb_log ("Tuning Word: %04X" ,*t); +dvb_log ("base_freq: %d" , base_freq); +dvb_log ("rounded_freq: %d" , rounded_freq); +dvb_log ("freq_offset: %d MHz, BPF: %d MHz, rounding_offset: %d MHz" , parms->freq_offset, parms->p.freq_bpf, rounding_offset); + } }else { parms->freq_offset = lnb->freqrange[j].int_freq *1000 ;if (parms->p.verbose >1 )