]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: fix bugs in recent satconf/switch changes
authorAdam Sutton <dev@adamsutton.me.uk>
Mon, 9 Jun 2014 21:07:21 +0000 (22:07 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 9 Jun 2014 21:08:39 +0000 (22:08 +0100)
src/input/mpegts/linuxdvb/linuxdvb_satconf.c
src/input/mpegts/linuxdvb/linuxdvb_switch.c

index f2aebf7773ebe16610ecf22f3b8567c634cd43a0..e67bb34082232443ba4c7fe1daf5221d99af70bb 100644 (file)
@@ -683,6 +683,9 @@ linuxdvb_satconf_start_mux
   linuxdvb_frontend_t    *lfe = (linuxdvb_frontend_t*)ls->ls_frontend;
   dvb_mux_t              *lm  = (dvb_mux_t*)mmi->mmi_mux;
 
+  /* Not fully configured */
+  if (!lse) return SM_CODE_TUNING_FAILED;
+
   /* Test run */
   // Note: basically this ensures the tuning params are acceptable
   //       for the FE, so that if they're not we don't have to wait
@@ -940,7 +943,7 @@ linuxdvb_satconf_ele_class_switchtype_set ( void *o, const void *p )
   if (ls->lse_switch && !strcmp(str ?: "", ls->lse_switch->ld_type))
     return 0;
   if (ls->lse_switch) linuxdvb_switch_destroy(ls->lse_switch);
-  ls->lse_switch = linuxdvb_switch_create0(str, NULL, ls, 0, 0);
+  ls->lse_switch = linuxdvb_switch_create0(str, NULL, ls, -1, -1);
   return 1;
 }
 
@@ -1133,7 +1136,7 @@ linuxdvb_satconf_ele_create0
     /* EN50494 */
     if (lse->lse_en50494 && (e = htsmsg_get_map(conf, "en50494_conf")))
       idnode_load(&lse->lse_en50494->ld_id, e);
-}
+  }
 
   /* Create default LNB */
   if (!lse->lse_lnb)
index 972b250ec1e06cb8e59a74a0288b99a7f12edcff..1e39b350dab9f83c3bde113fc1af4bcc8a47a4a7 100644 (file)
@@ -20,6 +20,7 @@
 #include "tvheadend.h"
 #include "linuxdvb_private.h"
 #include "settings.h"
+#include "hts_strtab.h"
 
 #include <sys/ioctl.h>
 #include <sys/types.h>
@@ -48,23 +49,50 @@ typedef struct linuxdvb_switch
 static htsmsg_t *
 linuxdvb_switch_class_committed_list ( void *o )
 {
-  htsmsg_t *m = htsmsg_create_list();
-  htsmsg_add_str(m, NULL, "NONE");
-  htsmsg_add_str(m, NULL, "AA");
-  htsmsg_add_str(m, NULL, "AB");
-  htsmsg_add_str(m, NULL, "BA");
-  htsmsg_add_str(m, NULL, "BB");
-  return m;
+  static const struct strtab tab[] = {
+    { "NONE", -1 },
+    { "AA",    0 },
+    { "AB",    1 },
+    { "BA",    2 },
+    { "BB",    3 },
+  };
+  return strtab2htsmsg(tab);
+}
+
+static htsmsg_t *
+linuxdvb_switch_class_uncommitted_list ( void *o )
+{
+  static const struct strtab tab[] = {
+    { "NONE", -1 },
+    {  "0",    0 },
+    {  "1",    1 },
+    {  "2",    2 },
+    {  "3",    3 },
+    {  "4",    4 },
+    {  "5",    5 },
+    {  "6",    6 },
+    {  "7",    7 },
+    {  "8",    8 },
+    {  "9",    9 },
+    { "10",   10 },
+    { "11",   11 },
+    { "12",   12 },
+    { "13",   13 },
+    { "14",   14 },
+    { "15",   15 },
+  };
+  return strtab2htsmsg(tab);
 }
 
 static htsmsg_t *
 linuxdvb_switch_class_toneburst_list ( void *o )
 {
-  htsmsg_t *m = htsmsg_create_list();
-  htsmsg_add_str(m, NULL, "NONE");
-  htsmsg_add_str(m, NULL, "A");
-  htsmsg_add_str(m, NULL, "B");
-  return m;
+  static const struct strtab tab[] = {
+    { "NONE", -1 },
+    { "A",     0 },
+    { "B",     1 },
+  };
+  return strtab2htsmsg(tab);
 }
 
 static const char *
@@ -97,6 +125,7 @@ const idclass_t linuxdvb_switch_class =
       .id     = "uncommitted",
       .name   = "Uncommitted",
       .off    = offsetof(linuxdvb_switch_t, ls_uncomitted),
+      .list   = linuxdvb_switch_class_uncommitted_list
     },
     {
       .type   = PT_INT,
@@ -131,7 +160,7 @@ linuxdvb_switch_tune
     return -1;
 
   /* Single committed (before repeats) */
-  if (ls->ls_committed > 0) {
+  if (ls->ls_committed >= 0) {
     if (sc->lse_parent->ls_diseqc_repeats > 0) {
       r2 = 1;
       if (linuxdvb_diseqc_send(fd, 0xE0, 0x10, 0x38, 1, com))
@@ -144,7 +173,7 @@ linuxdvb_switch_tune
   for (i = 0; i <= sc->lse_parent->ls_diseqc_repeats; i++) {
 
     /* Uncommitted */
-    if (ls->ls_uncomitted > 0) {
+    if (ls->ls_uncomitted >= 0) {
       if (linuxdvb_diseqc_send(fd, 0xE0 | r1, 0x10, 0x39, 1,
                                0xF0 | ls->ls_uncomitted))
         return -1;
@@ -152,7 +181,7 @@ linuxdvb_switch_tune
     }
 
     /* Committed */
-    if (ls->ls_committed > 0) {
+    if (ls->ls_committed >= 0) {
       if (linuxdvb_diseqc_send(fd, 0xE0 | r2, 0x10, 0x38, 1, com))
         return -1;
       usleep(25000);
@@ -163,7 +192,7 @@ linuxdvb_switch_tune
   }
 
   /* Tone burst */
-  if (ls->ls_toneburst > 0) {
+  if (ls->ls_toneburst >= 0) {
     tvhtrace("diseqc", "toneburst %s", ls->ls_toneburst ? "B" : "A");
     if (ioctl(fd, FE_DISEQC_SEND_BURST,
               ls->ls_toneburst ? SEC_MINI_B : SEC_MINI_A)) {