]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: add 'Higher LNB voltage' option to the satconf, fixes #5199
authorJaroslav Kysela <perex@perex.cz>
Wed, 12 Sep 2018 06:59:29 +0000 (08:59 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 12 Sep 2018 06:59:29 +0000 (08:59 +0200)
src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_satconf.c

index 6341bf84858b6d44fc34045fec31166d0d1ac47a..5956c08fcd1a48f175bc6f7f3240ce437c135076 100644 (file)
@@ -260,6 +260,7 @@ struct linuxdvb_satconf
    * LNB settings
    */
   int                    ls_lnb_poweroff;
+  int                    ls_lnb_highvol;
   uint32_t               ls_max_rotor_move;
   uint32_t               ls_min_rotor_move;
   double                 ls_site_lat;
index a6f37b06e21b7c3c0f7ebf1633b6fd5c874c79fa..f50b7d207a6c4b8572836ccc39cf371a0978636a 100644 (file)
@@ -225,6 +225,17 @@ linuxdvb_satconf_class_get_childs ( idnode_t *o )
   return is;
 }
 
+static htsmsg_t *
+linuxdvb_satconf_class_highvol_list ( void *o, const char *lang )
+{
+  static const struct strtab tab[] = {
+    { N_("Do not set"),  0 },
+    { N_("Normal"), 1 },
+    { N_("Higher"), 2 }
+  };
+  return strtab2htsmsg(tab, 1, lang);
+}
+
 /*
  * Generic satconf
  */
@@ -296,6 +307,21 @@ const idclass_t linuxdvb_satconf_class =
       .opts     = PO_ADVANCED,
       .def.i    = 1
     },
+    {
+      .type     = PT_INT,
+      .id       = "lnb_highvol",
+      .name     = N_("Higher LNB voltage"),
+      .desc     = N_("Some DVB devices have an optional ioctl that allows "
+                     "changing between normal voltage for LNB (13V/18V) to "
+                     "a higher voltage mode (usually, 14V/19V), meant to "
+                     "compensate for voltage loss on long cabling. "
+                     "Without that, it is not possible to properly switch "
+                     "the polarization."),
+      .list     = linuxdvb_satconf_class_highvol_list,
+      .off      = offsetof(linuxdvb_satconf_t, ls_lnb_highvol),
+      .opts     = PO_ADVANCED,
+      .def.i    = 1
+    },
     {}
   }
 };
@@ -1780,6 +1806,13 @@ linuxdvb_diseqc_set_volt ( linuxdvb_satconf_t *ls, int vol )
   /* Already set ? */
   if (vol >= 0 && ls->ls_last_vol == vol + 1)
     return 0;
+  /* High voltage handling */
+  if (ls->ls_lnb_highvol > 0) {
+    int v = ls->ls_lnb_highvol > 1 ? 1 : 0;
+    tvhtrace(LS_DISEQC, "set hight voltage %d", v);
+    if (ioctl(linuxdvb_satconf_fe_fd(ls), FE_ENABLE_HIGH_LNB_VOLTAGE, v))
+      tvherror(LS_DISEQC, "failed to set high voltage %d (e=%s)", v, strerror(errno));
+  }
   /* Set voltage */
   tvhtrace(LS_DISEQC, "set voltage %dV", vol ? (vol < 0 ? 0 : 18) : 13);
   if (ioctl(linuxdvb_satconf_fe_fd(ls), FE_SET_VOLTAGE,