Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
wizard: create 4 port diseqc switch for linuxdvb, save tuner settings
  • Loading branch information
perexg committed Jan 20, 2016
1 parent 6156d79 commit fe15797
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 21 deletions.
29 changes: 14 additions & 15 deletions src/input/mpegts/linuxdvb/linuxdvb_frontend.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -1772,14 +1776,15 @@ 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);
htsmsg_destroy(nlist);
}
if (linuxdvb_frontend_wizard_network(lfe))
mpegts_input_set_enabled((mpegts_input_t *)lfe, 1);
linuxdvb_adapter_save(lfe->lfe_adapter);
}
}

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/input/mpegts/linuxdvb/linuxdvb_private.h
Expand Up @@ -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 );

Expand Down
14 changes: 10 additions & 4 deletions src/input/mpegts/linuxdvb/linuxdvb_satconf.c
Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions src/input/mpegts/mpegts_network.c
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/satip/satip_frontend.c
Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit fe15797

Please sign in to comment.