linuxdvb: tone off optimization, fixes #2547

This commit is contained in:
Jaroslav Kysela 2014-12-15 15:54:16 +01:00
parent 1827ef1347
commit a7754e8009
4 changed files with 30 additions and 4 deletions

View file

@ -339,6 +339,8 @@ void linuxdvb_satconf_post_stop_mux( linuxdvb_satconf_t *ls );
int linuxdvb_satconf_start_mux
( linuxdvb_satconf_t *ls, mpegts_mux_instance_t *mmi );
int linuxdvb_satconf_tone_off( linuxdvb_satconf_ele_t *ls, int fd, int delay );
void linuxdvb_satconf_reset
( linuxdvb_satconf_t *ls );

View file

@ -357,6 +357,9 @@ linuxdvb_rotor_tune
if (linuxdvb_rotor_check_orbital_pos(lr, lm, ls))
return 0;
if (linuxdvb_satconf_tone_off(ls, fd, 1))
return -1;
/* Force to 18v (quicker movement) */
if (ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18)) {
tvherror("diseqc", "failed to set 18v for rotor movement");

View file

@ -679,6 +679,23 @@ linuxdvb_satconf_get_grace
return r;
}
int
linuxdvb_satconf_tone_off ( linuxdvb_satconf_ele_t *lse, int fd, int delay )
{
linuxdvb_satconf_t *ls = lse->lse_parent;
if (ls->ls_last_tone_off != 1) {
if (ioctl(fd, FE_SET_TONE, SEC_TONE_OFF)) {
tvherror("diseqc", "failed to disable tone");
return -1;
}
ls->ls_last_tone_off = 1;
}
if (delay)
usleep(10000);
return 0;
}
static void linuxdvb_satconf_ele_tune_cb ( void *o );
static int
@ -711,11 +728,8 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
if (!lse->lse_en50494 || lse->lse_switch || lse->lse_rotor) {
if (ls->ls_diseqc_full || ls->ls_last_tone_off != 1) {
tvhtrace("diseqc", "initial tone off");
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, SEC_TONE_OFF)) {
tvherror("diseqc", "failed to disable tone");
if (linuxdvb_satconf_tone_off(lse, lfe->lfe_fe_fd, 0))
return -1;
}
ls->ls_last_tone_off = 1;
}
}

View file

@ -155,6 +155,9 @@ linuxdvb_switch_tune
lsp->ls_last_switch = NULL;
if (linuxdvb_satconf_tone_off(sc, fd, 1))
return -1;
pol = (sc->lse_lnb) ? sc->lse_lnb->lnb_pol (sc->lse_lnb, lm) & 0x1 : 0;
band = (sc->lse_lnb) ? sc->lse_lnb->lnb_band(sc->lse_lnb, lm) & 0x1 : 0;
com = 0xF0 | (ls->ls_committed << 2) | (pol << 1) | band;
@ -200,6 +203,10 @@ linuxdvb_switch_tune
/* Tone burst */
if (ls->ls_toneburst >= 0 &&
(lsp->ls_diseqc_full || lsp->ls_last_toneburst != ls->ls_toneburst + 1)) {
if (linuxdvb_satconf_tone_off(sc, fd, 1))
return -1;
lsp->ls_last_toneburst = 0;
tvhtrace("diseqc", "toneburst %s", ls->ls_toneburst ? "B" : "A");
if (ioctl(fd, FE_DISEQC_SEND_BURST,