]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
wizard: create 4 port diseqc switch for linuxdvb, save tuner settings
authorJaroslav Kysela <perex@perex.cz>
Wed, 20 Jan 2016 14:57:46 +0000 (15:57 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 20 Jan 2016 14:57:46 +0000 (15:57 +0100)
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_private.h
src/input/mpegts/linuxdvb/linuxdvb_satconf.c
src/input/mpegts/mpegts_network.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c

index f95b4073e650c0c351cfd8f02df34dd1aaee7f1e..0e9dfbafb5963b161b7ad57a95aa4ce1991e6dec 100644 (file)
@@ -168,12 +168,16 @@ static int
 linuxdvb_frontend_dvbs_class_satconf_set ( void *self, const void *str )
 {
   linuxdvb_frontend_t *lfe = self;
+  htsmsg_t *conf;
   if (lfe->lfe_satconf) {
     if (!strcmp(str ?: "", lfe->lfe_satconf->ls_type))
       return 0;
     linuxdvb_satconf_delete(lfe->lfe_satconf, 1);
   }
-  lfe->lfe_satconf = linuxdvb_satconf_create(lfe, str, NULL, NULL);
+  conf = htsmsg_create_map();
+  htsmsg_add_str(conf, "type", str);
+  lfe->lfe_satconf = linuxdvb_satconf_create(lfe, conf);
+  htsmsg_destroy(conf);
   return 1;
 }
 
@@ -1763,7 +1767,7 @@ linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang
       htsmsg_t *conf = htsmsg_create_map();
       htsmsg_t *elems = htsmsg_create_list();
       htsmsg_t *elem = htsmsg_create_map();
-      htsmsg_add_str(conf, "type", "simple");
+      htsmsg_add_str(conf, "type", "4port");
       htsmsg_add_bool(elem, "enable", 1);
       htsmsg_add_msg(elem, "networks", nlist);
       htsmsg_add_msg(elems, NULL, elem);
@@ -1772,7 +1776,7 @@ linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang
         linuxdvb_satconf_delete(lfe->lfe_satconf, 0);
         lfe->lfe_satconf = NULL;
       }
-      lfe->lfe_satconf = linuxdvb_satconf_create(lfe, NULL, NULL, conf);
+      lfe->lfe_satconf = linuxdvb_satconf_create(lfe, conf);
       htsmsg_destroy(conf);
     } else {
       mpegts_input_set_networks((mpegts_input_t *)lfe, nlist);
@@ -1780,6 +1784,7 @@ linuxdvb_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang
     }
     if (linuxdvb_frontend_wizard_network(lfe))
       mpegts_input_set_enabled((mpegts_input_t *)lfe, 1);
+    linuxdvb_adapter_save(lfe->lfe_adapter);
   }
 }
 
@@ -1790,10 +1795,10 @@ linuxdvb_frontend_create
     dvb_fe_type_t type, const char *name )
 {
   const idclass_t *idc;
-  const char *str, *uuid = NULL, *muuid = NULL, *scuuid = NULL, *sctype = NULL;
+  const char *str, *uuid = NULL, *muuid = NULL;
   char id[16], lname[256];
   linuxdvb_frontend_t *lfe;
-  htsmsg_t *scconf = NULL;
+  htsmsg_t *scconf;
 
   /* Tuner slave */
   snprintf(id, sizeof(id), "master for #%d", number);
@@ -1897,17 +1902,11 @@ linuxdvb_frontend_create
   pthread_cond_init(&lfe->lfe_dvr_cond, NULL);
   mpegts_pid_init(&lfe->lfe_pids);
  
-  /* Satconf */
-  if (conf && !muuid) {
-    if ((scconf = htsmsg_get_map(conf, "satconf"))) {
-      sctype = htsmsg_get_str(scconf, "type");
-      scuuid = htsmsg_get_str(scconf, "uuid");
-    }
-  }
-
   /* Create satconf */
-  if (lfe->lfe_type == DVB_TYPE_S && !lfe->lfe_satconf && !muuid)
-    lfe->lfe_satconf = linuxdvb_satconf_create(lfe, sctype, scuuid, scconf);
+  if (lfe->lfe_type == DVB_TYPE_S && !lfe->lfe_satconf && !muuid) {
+    scconf = conf ? htsmsg_get_map(conf, "satconf") : NULL;
+    lfe->lfe_satconf = linuxdvb_satconf_create(lfe, scconf);
+  }
 
   /* Double check enabled */
   linuxdvb_frontend_enabled_updated((mpegts_input_t*)lfe);
index cc7e98f4e0637e207412b30b82620f1e9f7d2af9..8d824215f4384558cba08db99fd2558ff692ec00 100644 (file)
@@ -451,8 +451,7 @@ void linuxdvb_satconf_ele_destroy ( linuxdvb_satconf_ele_t *ls );
 htsmsg_t *linuxdvb_satconf_type_list ( void *o, const char *lang );
 
 linuxdvb_satconf_t *linuxdvb_satconf_create
-  ( linuxdvb_frontend_t *lfe,
-    const char *type, const char *uuid, htsmsg_t *conf );
+  ( linuxdvb_frontend_t *lfe, htsmsg_t *conf );
 
 void linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls, int delconf );
 
index e99dc8fa88505b3f7769478f11bdb6fb91a30bfa..9fefe835a18224a85e70c6656a5ddf167a70dd4e 100644 (file)
@@ -957,15 +957,21 @@ linuxdvb_satconf_match_mux
 
 linuxdvb_satconf_t *
 linuxdvb_satconf_create
-  ( linuxdvb_frontend_t *lfe, const char *type, const char *uuid,
-    htsmsg_t *conf )
+  ( linuxdvb_frontend_t *lfe, htsmsg_t *conf )
 {
   int i;
   htsmsg_t *l, *e;
   htsmsg_field_t *f;
   linuxdvb_satconf_ele_t *lse;
-  const char *str;
-  struct linuxdvb_satconf_type *lst = linuxdvb_satconf_type_find(type);
+  const char *str, *type = NULL, *uuid = NULL;
+  struct linuxdvb_satconf_type *lst;
+
+  if (conf) {
+    type = htsmsg_get_str(conf, "type");
+    uuid = htsmsg_get_str(conf, "uuid");
+  }
+
+  lst = linuxdvb_satconf_type_find(type);
   assert(lst);
   
   linuxdvb_satconf_t *ls = calloc(1, sizeof(linuxdvb_satconf_t));
index 97ec1b6bcef78e83138d933b321fb26cdde47793..318ab0fd29cd48d02d1b9a8bc8c704aa7b2bcf50 100644 (file)
@@ -522,6 +522,8 @@ mpegts_network_wizard_create
   htsmsg_add_bool(conf, "wizard", 1);
   mn = mnb->build(mnb->idc, conf);
   htsmsg_destroy(conf);
+  if (mn)
+    mn->mn_config_save(mn);
 
 found:
   if (mn && nlist) {
index f0612e154ee41ffea841d8f70232fbaada4ade88..803f664708285ee89eadf270cf8e3ac6e9357d5b 100644 (file)
@@ -1809,6 +1809,7 @@ satip_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *lang )
     htsmsg_destroy(conf);
     if (satip_frontend_wizard_network(lfe))
       mpegts_input_set_enabled((mpegts_input_t *)lfe, 1);
+    satip_device_save(lfe->sf_device);
   }
 }
 
index 31515339f1a7174381d7824ddbc45d484b0d372b..c515fde5a31c45106a9d5ad51b9df561510c49dc 100644 (file)
@@ -628,6 +628,7 @@ tvhdhomerun_frontend_wizard_set( tvh_input_t *ti, htsmsg_t *conf, const char *la
     htsmsg_destroy(nlist);
     if (tvhdhomerun_frontend_wizard_network(hfe))
       mpegts_input_set_enabled((mpegts_input_t *)hfe, 1);
+    tvhdhomerun_device_save(hfe->hf_device);
   }
 }