Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
linuxdvb: fix bug 2229
change behavior for en50494
- don't use tone
- don't change voltage for tune (this makes the switch)
- skip unneeded test
  • Loading branch information
InuSasha authored and perexg committed Sep 8, 2014
1 parent cba6ac0 commit 21fc2f9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
16 changes: 9 additions & 7 deletions src/input/mpegts/linuxdvb/linuxdvb_en50494.c
Expand Up @@ -18,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Open things:
* - TODO: collision dectection
* when a en50494-command wasn't executed succesful, retry.
* delay time is easly random, but in standard is special (complicated) way described (cap. 8).
* - TODO: collision detection
* * compare transport-stream-id from stream with id in config
* * check continuity of the pcr-counter
* * when one point is given -> retry
* * delay time is easily random, but in standard is special (complicated) way described (cap. 8).
*/

#include "tvheadend.h"
Expand All @@ -39,7 +41,7 @@
#define LINUXDVB_EN50494_NOPIN 256

#define LINUXDVB_EN50494_FRAME 0xE0
/* adresses 0x00, 0x10 and 0x11 are possible */
/* addresses 0x00, 0x10 and 0x11 are possible */
#define LINUXDVB_EN50494_ADDRESS 0x10

#define LINUXDVB_EN50494_CMD_NORMAL 0x5A
Expand Down Expand Up @@ -162,7 +164,7 @@ linuxdvb_en50494_tune
linuxdvb_en50494_t *le = (linuxdvb_en50494_t*) ld;
linuxdvb_lnb_t *lnb = sc->lse_lnb;

/* band & polarisation */
/* band & polarization */
uint8_t pol = lnb->lnb_pol(lnb, lm);
uint8_t band = lnb->lnb_band(lnb, lm);
uint32_t freq = lnb->lnb_freq(lnb, lm);
Expand All @@ -180,8 +182,8 @@ linuxdvb_en50494_tune
/* 2 data fields (16bit) */
uint8_t data1, data2;
data1 = (le->le_id & 7) << 5; /* 3bit user-band */
data1 |= (le->le_position & 1) << 4; /* 1bit position (satelitte A(0)/B(1)) */
data1 |= (pol & 1) << 3; /* 1bit polarisation v(0)/h(1) */
data1 |= (le->le_position & 1) << 4; /* 1bit position (satellite A(0)/B(1)) */
data1 |= (pol & 1) << 3; /* 1bit polarization v(0)/h(1) */
data1 |= (band & 1) << 2; /* 1bit band lower(0)/upper(1) */
data1 |= (t >> 8) & 3; /* 2bit transponder value bit 1-2 */
data2 = t & 0xFF; /* 8bit transponder value bit 3-10 */
Expand Down
3 changes: 3 additions & 0 deletions src/input/mpegts/linuxdvb/linuxdvb_lnb.c
Expand Up @@ -105,6 +105,9 @@ static int
linuxdvb_lnb_standard_tune
( linuxdvb_diseqc_t *ld, dvb_mux_t *lm, linuxdvb_satconf_ele_t *ls, int fd )
{
if (ls->lse_en50494)
return 0;

int pol = linuxdvb_lnb_standard_pol((linuxdvb_lnb_t*)ld, lm);
return linuxdvb_diseqc_set_volt(fd, pol);
}
Expand Down
33 changes: 20 additions & 13 deletions src/input/mpegts/linuxdvb/linuxdvb_satconf.c
Expand Up @@ -633,10 +633,12 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
// TODO: really need to understand whether or not we need to pre configure
// and/or re-affirm the switch

/* Disable tone */
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) */
if (!lse->lse_en50494) {
if (ioctl(lfe->lfe_fe_fd, FE_SET_TONE, SEC_TONE_OFF)) {
tvherror("diseqc", "failed to disable tone");
return -1;
}
}

/* Diseqc */
Expand All @@ -660,14 +662,16 @@ linuxdvb_satconf_ele_tune ( linuxdvb_satconf_ele_t *lse )
&lse->lse_parent->ls_orbital_pos,
&lse->lse_parent->ls_orbital_dir);

/* Set the tone */
b = lse->lse_lnb->lnb_band(lse->lse_lnb, lm);
tvhtrace("disqec", "set diseqc tone %s", b ? "on" : "off");
if (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;
/* Set the tone (en50494 don't use tone) */
if (!lse->lse_en50494) {
b = lse->lse_lnb->lnb_band(lse->lse_lnb, lm);
tvhtrace("disqec", "set diseqc tone %s", b ? "on" : "off");
if (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
}
usleep(20000); // Allow LNB to settle before tuning

/* Frontend */
/* use en50494 tuning frequency, if needed (not channel frequency) */
Expand Down Expand Up @@ -701,13 +705,16 @@ linuxdvb_satconf_start_mux
// Note: basically this ensures the tuning params are acceptable
// for the FE, so that if they're not we don't have to wait
// for things like rotors and switches
// the en50494 have to skip this test
if (!lse->lse_lnb)
return SM_CODE_TUNING_FAILED;
f = lse->lse_lnb->lnb_freq(lse->lse_lnb, lm);
if (f == (uint32_t)-1)
return SM_CODE_TUNING_FAILED;
r = linuxdvb_frontend_tune0(lfe, mmi, f);
if (r) return r;
if (!lse->lse_en50494) {
r = linuxdvb_frontend_tune0(lfe, mmi, f);
if (r) return r;
}

/* Diseqc */
ls->ls_mmi = mmi;
Expand Down

0 comments on commit 21fc2f9

Please sign in to comment.