]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: tone off optimization, fixes #2547
authorJaroslav Kysela <perex@perex.cz>
Mon, 15 Dec 2014 14:54:16 +0000 (15:54 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 15 Dec 2014 14:54:16 +0000 (15:54 +0100)
src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_rotor.c
src/input/mpegts/linuxdvb/linuxdvb_satconf.c
src/input/mpegts/linuxdvb/linuxdvb_switch.c

index 77624fac77ed7759879ada168575f50d99b433f8..dd6fe48a4e4db80ad0f9d46d19bcaba6bdb71f77 100644 (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 );
 
index 25a00a2fc0311b9a16b684edae06b076581ba523..92794b1f244771d64f358c2afdaf2213fc28456a 100644 (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");
index d2087f531656542cae923dbb24f8f41751ff8fde..11c36bc954e8916ad19bb094c4a2b76fc8687536 100644 (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;
     }
   }
 
index 0c73989d57b308ef5179549e4f24a0564c902d98..8b524e783d579b087d76be796710050bb29b2f5b 100644 (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,