]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Power off LNB when idle
authorJaroslav Kysela <perex@perex.cz>
Mon, 3 Feb 2014 10:33:43 +0000 (11:33 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 17 Feb 2014 10:55:39 +0000 (11:55 +0100)
Try to reduce power, when no streams are captured from DVB-S/S2 devices.

src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_satconf.c

index 12aebdedf9a9a24c51def05dc3b459d309fafece..f03c43db251a8b3b7b516ed107d0b701d7cc91ee 100644 (file)
@@ -126,6 +126,11 @@ struct linuxdvb_satconf
   gtimer_t               ls_diseqc_timer;
   int                    ls_diseqc_idx;
   int                    ls_diseqc_repeats;
+
+  /*
+   * LNB settings
+   */
+  int                    ls_lnb_poweroff;
   
   /*
    * Satconf elements
index 71d5f25953623b60afd7caeb8ef633987ab4e6e5..8d49dad3cdaa5e025f64c3e428a0cb0c9a9efe59 100644 (file)
@@ -193,6 +193,14 @@ const idclass_t linuxdvb_satconf_class =
       .opts     = PO_ADVANCED,
       .def.i    = 0
     },
+    {
+      .type     = PT_BOOL,
+      .id       = "lnb_poweroff",
+      .name     = "Turn off LNB when idle",
+      .off      = offsetof(linuxdvb_satconf_t, ls_lnb_poweroff),
+      .opts     = PO_ADVANCED,
+      .def.i    = 1
+    },
     {}
   }
 };
@@ -889,6 +897,9 @@ linuxdvb_satconf_ele_stop_mux
   if (ls->ls_frontend)
     ls->ls_frontend->mi_stop_mux(ls->ls_frontend, mmi);
   gtimer_disarm(&ls->ls_diseqc_timer);
+  if (ls->ls_frontend && ls->ls_lnb_poweroff)
+    linuxdvb_diseqc_set_volt(
+        ((linuxdvb_frontend_t *)ls->ls_frontend)->lfe_fe_fd, -1);
 }
 
 static void linuxdvb_satconf_ele_tune_cb ( void *o );
@@ -1260,12 +1271,14 @@ int
 linuxdvb_diseqc_set_volt ( int fd, int vol )
 {
   /* Set voltage */
-  tvhtrace("disqec", "set voltage %dV", vol ? 18 : 13);
-  if (ioctl(fd, FE_SET_VOLTAGE, vol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13)) {
+  tvhtrace("diseqc", "set voltage %dV", vol ? (vol < 0 ? 0 : 18) : 13);
+  if (ioctl(fd, FE_SET_VOLTAGE,
+        vol ? (vol < 0 ? SEC_VOLTAGE_OFF : SEC_VOLTAGE_18) : SEC_VOLTAGE_13)) {
     tvherror("diseqc", "failed to set voltage (e=%s)", strerror(errno));
     return -1;
   }
-  usleep(15000);
+  if (vol >= 0)
+    usleep(15000);
   return 0;
 }