linuxdvb diseqc: handle 22khz tone better for unicable

This commit is contained in:
Jaroslav Kysela 2014-12-14 15:57:13 +01:00
parent 811eeb4376
commit 4fadb70767
3 changed files with 29 additions and 13 deletions

View file

@ -161,6 +161,7 @@ struct linuxdvb_satconf
linuxdvb_satconf_ele_t *ls_last_switch;
int ls_last_pol;
int ls_last_toneburst;
int ls_last_tone_off;
};
/*

View file

@ -680,14 +680,21 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
(linuxdvb_diseqc_t*)lse->lse_en50494,
(linuxdvb_diseqc_t*)lse->lse_lnb
};
// TODO: really need to understand whether or not we need to pre configure
// and/or re-affirm the switch
/* Disable tone (en50494 don't use tone) */
if (!lse->lse_en50494) {
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, SEC_TONE_OFF)) {
tvherror("diseqc", "failed to disable tone");
return -1;
/*
* Disable tone (en50494 don't use tone)
* The 22khz tone is used for signalling band (universal LNB)
* and also for the DiseqC commands. It's necessary to turn
* tone off before communication with DiseqC devices.
*/
if (!lse->lse_en50494 || lse->lse_switch || lse->lse_rotor) {
if (ls->ls_diseqc_full || ls->ls_last_tone_off != 1) {
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, SEC_TONE_OFF)) {
tvherror("diseqc", "failed to disable tone");
return -1;
}
ls->ls_last_tone_off = 1;
}
}
@ -718,13 +725,17 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
/* Set the tone (en50494 don't use tone) */
if (!lse->lse_en50494) {
ls->ls_last_tone_off = 0;
b = lse->lse_lnb->lnb_band(lse->lse_lnb, lm);
tvhtrace("diseqc", "set diseqc tone %s", b ? "on" : "off");
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, b ? SEC_TONE_ON : SEC_TONE_OFF)) {
if (b && ioctl(lfe->lfe_fe_fd, FE_SET_TONE, b ? SEC_TONE_ON : SEC_TONE_OFF)) {
tvherror("diseqc", "failed to set diseqc tone (e=%s)", strerror(errno));
return -1;
}
usleep(20000); // Allow LNB to settle before tuning
if (b) {
ls->ls_last_tone_off = 2;
usleep(20000); // Allow LNB to settle before tuning
}
}
/* Frontend */
@ -786,6 +797,7 @@ linuxdvb_satconf_reset
ls->ls_last_switch = NULL;
ls->ls_last_pol = 0;
ls->ls_last_toneburst = 0;
ls->ls_last_tone_off = 0;
}
/* **************************************************************************

View file

@ -158,11 +158,14 @@ linuxdvb_switch_tune
lsp->ls_last_pol = 0;
/* Set the voltage */
if (linuxdvb_diseqc_set_volt(fd, pol))
return -1;
/* EN50494 devices have another mechanism to select polarization */
if (!sc->lse_en50494) {
/* Set the voltage */
if (linuxdvb_diseqc_set_volt(fd, pol))
return -1;
lsp->ls_last_pol = pol + 1;
lsp->ls_last_pol = pol + 1;
}
}
if (lsp->ls_diseqc_full || lsp->ls_last_switch != sc) {