linuxdvb: fix diseqc committed switch setting
Added new LNB callback for getting the hi/lo band setting. Minor correction to repeat sending as well.
This commit is contained in:
parent
dccb50dfd7
commit
4db9fa050f
3 changed files with 43 additions and 19 deletions
|
@ -105,6 +105,15 @@ linuxdvb_lnb_standard_freq
|
|||
return f;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_lnb_standard_band
|
||||
( linuxdvb_lnb_t *l, linuxdvb_mux_t *lm )
|
||||
{
|
||||
linuxdvb_lnb_conf_t *lnb = (linuxdvb_lnb_conf_t*)l;
|
||||
uint32_t f = lm->lm_tuning.dmc_fe_params.frequency;
|
||||
return (lnb->lnb_switch && f > lnb->lnb_switch);
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_lnb_standard_tune
|
||||
( linuxdvb_diseqc_t *ld, linuxdvb_mux_t *lm, linuxdvb_satconf_t *ls, int fd )
|
||||
|
@ -139,6 +148,16 @@ linuxdvb_lnb_bandstack_freq
|
|||
return f;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_lnb_bandstack_band
|
||||
( linuxdvb_lnb_t *l, linuxdvb_mux_t *lm )
|
||||
{
|
||||
dvb_mux_conf_t *dmc = &lm->lm_tuning;
|
||||
int pol = dmc->dmc_fe_polarisation == POLARISATION_HORIZONTAL ||
|
||||
dmc->dmc_fe_polarisation == POLARISATION_CIRCULAR_LEFT;
|
||||
return pol;
|
||||
}
|
||||
|
||||
static int
|
||||
linuxdvb_lnb_bandstack_tune
|
||||
( linuxdvb_diseqc_t *ld, linuxdvb_mux_t *lm, linuxdvb_satconf_t *ls, int fd )
|
||||
|
@ -157,6 +176,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 10600000,
|
||||
.lnb_switch = 11700000,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -165,6 +185,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -173,6 +194,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -181,6 +203,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -189,6 +212,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -197,6 +221,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -205,6 +230,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 0,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_standard_freq,
|
||||
.lnb_band = linuxdvb_lnb_standard_band,
|
||||
.ld_tune = linuxdvb_lnb_standard_tune,
|
||||
},
|
||||
{
|
||||
|
@ -213,6 +239,7 @@ struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = {
|
|||
.lnb_high = 14350000,
|
||||
.lnb_switch = 0,
|
||||
.lnb_freq = linuxdvb_lnb_bandstack_freq,
|
||||
.lnb_band = linuxdvb_lnb_bandstack_band,
|
||||
.ld_tune = linuxdvb_lnb_bandstack_tune,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -235,6 +235,7 @@ struct linuxdvb_lnb
|
|||
{
|
||||
linuxdvb_diseqc_t;
|
||||
uint32_t (*lnb_freq)(linuxdvb_lnb_t*, linuxdvb_mux_t*);
|
||||
int (*lnb_band)(linuxdvb_lnb_t*, linuxdvb_mux_t*);
|
||||
};
|
||||
|
||||
linuxdvb_diseqc_t *linuxdvb_diseqc_create0
|
||||
|
|
|
@ -115,25 +115,22 @@ static int
|
|||
linuxdvb_switch_tune
|
||||
( linuxdvb_diseqc_t *ld, linuxdvb_mux_t *lm, linuxdvb_satconf_t *sc, int fd )
|
||||
{
|
||||
int i, s, r = 0;
|
||||
linuxdvb_switch_t *ls = (linuxdvb_switch_t*)ld;
|
||||
|
||||
//linuxdvb_lnb_conf_t *lnb = (linuxdvb_lnb_conf_t*)ld;
|
||||
dvb_mux_conf_t *dmc = &lm->lm_tuning;
|
||||
struct dvb_frontend_parameters *p = &dmc->dmc_fe_params;
|
||||
|
||||
|
||||
int i, com, r = 0;
|
||||
int pol_bit, band_bit;
|
||||
linuxdvb_switch_t *ls = (linuxdvb_switch_t*)ld;
|
||||
dvb_mux_conf_t *dmc = &lm->lm_tuning;
|
||||
|
||||
pol_bit = dmc->dmc_fe_polarisation == POLARISATION_HORIZONTAL ||
|
||||
dmc->dmc_fe_polarisation == POLARISATION_CIRCULAR_LEFT;
|
||||
band_bit = lnb->lnb_switch && (p->frequency > lnb->lnb_switch);
|
||||
|
||||
/* Bit of a mess, comitted switch config is actually dependant
|
||||
* on LNB configuration
|
||||
*/
|
||||
pol_bit = dmc->dmc_fe_polarisation == POLARISATION_HORIZONTAL ||
|
||||
dmc->dmc_fe_polarisation == POLARISATION_CIRCULAR_LEFT;
|
||||
band_bit = (sc->ls_lnb) ? sc->ls_lnb->lnb_band(sc->ls_lnb, lm) : 0;
|
||||
com = 0xF0 | (ls->ls_committed << 2) | (pol_bit << 1) | band_bit;
|
||||
|
||||
/* Single committed (before repeats) */
|
||||
if (sc->ls_diseqc_repeats == 0) {
|
||||
s = 0xF0 | (ls->ls_committed << 2) | (pol_bit << 1) | band_bit;
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x10, 0x38, 1, s))
|
||||
if (sc->ls_diseqc_repeats > 0) {
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x10, 0x38, 1, com))
|
||||
return -1;
|
||||
usleep(25000); // 25ms
|
||||
}
|
||||
|
@ -142,14 +139,13 @@ linuxdvb_switch_tune
|
|||
for (i = 0; i <= sc->ls_diseqc_repeats; i++) {
|
||||
|
||||
/* Uncommitted */
|
||||
s = 0xF0 | ls->ls_uncomitted;
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0 | r, 0x10, 0x39, 1, s))
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0 | r, 0x10, 0x39, 1,
|
||||
0xF0 | ls->ls_uncomitted))
|
||||
return -1;
|
||||
usleep(25000);
|
||||
|
||||
/* Committed */
|
||||
s = 0xF0 | (ls->ls_committed << 2) | (pol_bit << 1) | band_bit;
|
||||
if (linuxdvb_diseqc_send(fd, 0xE1, 0x10, 0x38, 1, s))
|
||||
if (linuxdvb_diseqc_send(fd, 0xE1, 0x10, 0x38, 1, com))
|
||||
return -1;
|
||||
usleep(25000);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue