]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
en50494: added "tune before diseqc", fixes #3081
authorHeiko-L <no.spam.to.me@ish.de>
Fri, 18 Sep 2015 15:27:02 +0000 (17:27 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 18 Sep 2015 18:32:12 +0000 (20:32 +0200)
src/input/mpegts/linuxdvb/linuxdvb_satconf.c

index 960eabeb8e604cf8f861d004bf7744bcc8b9b639..cd73f2a68f1f085a80e3a3ded6b1c372b070f01f 100644 (file)
@@ -25,6 +25,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <math.h>
 #include <fcntl.h>
 #include <assert.h>
 #include <linux/dvb/dmx.h>
@@ -843,11 +844,24 @@ linuxdvb_satconf_start_mux
   //       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;
 
-  if (ls->ls_early_tune && !lse->lse_en50494) {
+  if (ls->ls_early_tune) {
+
+    f = lse->lse_lnb->lnb_freq(lse->lse_lnb, lm);
+    if (f == (uint32_t)-1)
+      return SM_CODE_TUNING_FAILED;
+
+    /* calculate tuning frequency for en50494 */
+    if (lse->lse_en50494) {
+      /* transponder value - t*/
+      uint16_t t = round((( (f / 1000) + 2 + (((linuxdvb_en50494_t*)lse->lse_en50494)->le_frequency)) / 4) - 350);
+      if ( t > 1024) {
+        tvherror("en50494", "transponder value bigger then 1024");
+        return -1;
+      }
+      /* tune frequency for the frontend */
+      f = (t + 350) * 4000 - f;
+    }
     r = linuxdvb_frontend_tune0(lfe, mmi, f);
     if (r) return r;
   } else {