From 21fc2f91c19a3bf3f3c61d606a2408f2b4efc117 Mon Sep 17 00:00:00 2001 From: "Sascha Kuehndel (InuSasha)" Date: Sat, 30 Aug 2014 11:47:27 +0200 Subject: [PATCH] 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 --- src/input/mpegts/linuxdvb/linuxdvb_en50494.c | 16 +++++----- src/input/mpegts/linuxdvb/linuxdvb_lnb.c | 3 ++ src/input/mpegts/linuxdvb/linuxdvb_satconf.c | 33 ++++++++++++-------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c index 4b1219d7..74a1d7d8 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c @@ -18,9 +18,11 @@ * along with this program. If not, see . * * 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" @@ -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 @@ -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); @@ -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 */ diff --git a/src/input/mpegts/linuxdvb/linuxdvb_lnb.c b/src/input/mpegts/linuxdvb/linuxdvb_lnb.c index 27a4c78f..e3c33d27 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_lnb.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_lnb.c @@ -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); } diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index b89ae72d..635288ed 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -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 */ @@ -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) */ @@ -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;