From: Jaroslav Kysela Date: Wed, 20 Jan 2016 14:57:46 +0000 (+0100) Subject: wizard: create 4 port diseqc switch for linuxdvb, save tuner settings X-Git-Tag: v4.2.1~1140 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe15797caa31490349fedee619a014bbf3e4fd87;p=thirdparty%2Ftvheadend.git wizard: create 4 port diseqc switch for linuxdvb, save tuner settings --- diff --git a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c index f95b4073e..0e9dfbafb 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c @@ -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); diff --git a/src/input/mpegts/linuxdvb/linuxdvb_private.h b/src/input/mpegts/linuxdvb/linuxdvb_private.h index cc7e98f4e..8d824215f 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_private.h +++ b/src/input/mpegts/linuxdvb/linuxdvb_private.h @@ -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 ); diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index e99dc8fa8..9fefe835a 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -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)); diff --git a/src/input/mpegts/mpegts_network.c b/src/input/mpegts/mpegts_network.c index 97ec1b6bc..318ab0fd2 100644 --- a/src/input/mpegts/mpegts_network.c +++ b/src/input/mpegts/mpegts_network.c @@ -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) { diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index f0612e154..803f66470 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -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); } } diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index 31515339f..c515fde5a 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -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); } }