From: Jaroslav Kysela Date: Tue, 9 May 2017 12:20:07 +0000 (+0200) Subject: input tree: fix the active node presentation, fixes #4346 X-Git-Tag: v4.2.2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77fa6384bffb101d1d4dfa870a61787f33d77ce3;p=thirdparty%2Ftvheadend.git input tree: fix the active node presentation, fixes #4346 --- diff --git a/src/input/mpegts.h b/src/input/mpegts.h index bf34bd19b..6d0158510 100644 --- a/src/input/mpegts.h +++ b/src/input/mpegts.h @@ -821,6 +821,7 @@ const void *mpegts_input_class_network_get ( void *o ); int mpegts_input_class_network_set ( void *o, const void *p ); htsmsg_t *mpegts_input_class_network_enum ( void *o, const char *lang ); char *mpegts_input_class_network_rend ( void *o, const char *lang ); +const void *mpegts_input_class_active_get ( void *o ); int mpegts_mps_weight(elementary_stream_t *st); diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c index 14d3564b2..deb4ac73e 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c @@ -104,6 +104,27 @@ linuxdvb_adapter_class_get_title ( idnode_t *in, const char *lang ) return la->la_name ?: la->la_rootpath; } +static const void * +linuxdvb_adapter_class_active_get ( void *obj ) +{ + static int active; +#if ENABLE_LINUXDVB_CA + linuxdvb_ca_t *lca; +#endif + linuxdvb_adapter_t *la = (linuxdvb_adapter_t*)obj; + active = la->la_is_enabled(la); +#if ENABLE_LINUXDVB_CA + if (!active) { + LIST_FOREACH(lca, &la->la_ca_devices, lca_link) + if (lca->lca_enabled) { + active = 1; + break; + } + } +#endif + return &active; +} + const idclass_t linuxdvb_adapter_class = { .ic_class = "linuxdvb_adapter", @@ -113,6 +134,13 @@ const idclass_t linuxdvb_adapter_class = .ic_get_childs = linuxdvb_adapter_class_get_childs, .ic_get_title = linuxdvb_adapter_class_get_title, .ic_properties = (const property_t[]){ + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_adapter_class_active_get, + }, { .type = PT_STR, .id = "rootpath", diff --git a/src/input/mpegts/linuxdvb/linuxdvb_ca.c b/src/input/mpegts/linuxdvb/linuxdvb_ca.c index 519dfb306..c2b19ef30 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_ca.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_ca.c @@ -177,6 +177,15 @@ linuxdvb_ca_class_get_title ( idnode_t *in, const char *lang ) return buf; } +static const void * +linuxdvb_ca_class_active_get ( void *obj ) +{ + static int active; + linuxdvb_ca_t *lca = (linuxdvb_ca_t*)obj; + active = !!lca->lca_enabled; + return &active; +} + const idclass_t linuxdvb_ca_class = { .ic_class = "linuxdvb_ca", @@ -184,6 +193,13 @@ const idclass_t linuxdvb_ca_class = .ic_changed = linuxdvb_ca_class_changed, .ic_get_title = linuxdvb_ca_class_get_title, .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_ca_class_active_get, + }, { .type = PT_BOOL, .id = "enabled", diff --git a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c index c0bea0939..c1a02361f 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c @@ -51,6 +51,17 @@ linuxdvb_frontend_class_changed ( idnode_t *in ) linuxdvb_adapter_changed(la); } +const void * +linuxdvb_frontend_class_active_get ( void *obj ) +{ + int *active; + linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)obj; + active = (int *)mpegts_input_class_active_get(obj); + if (!(*active) && lfe->lfe_adapter->la_exclusive) + *active = lfe->lfe_adapter->la_is_enabled(lfe->lfe_adapter); + return active; +} + CLASS_DOC(linuxdvb_frontend) CLASS_DOC(linuxdvb_frontend_dvbs) CLASS_DOC(linuxdvb_frontend_dvbt) @@ -64,6 +75,13 @@ const idclass_t linuxdvb_frontend_class = .ic_doc = tvh_doc_linuxdvb_frontend_class, .ic_changed = linuxdvb_frontend_class_changed, .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_frontend_class_active_get, + }, { .type = PT_STR, .id = "fe_path", @@ -541,10 +559,13 @@ linuxdvb_frontend_is_enabled if (lfe->lfe_fe_path == NULL) return MI_IS_ENABLED_NEVER; - if (!mpegts_input_is_enabled(mi, mm, flags, weight)) - return MI_IS_ENABLED_NEVER; + w = mpegts_input_is_enabled(mi, mm, flags, weight); + if (w != MI_IS_ENABLED_OK) + return w; if (access(lfe->lfe_fe_path, R_OK | W_OK)) return MI_IS_ENABLED_NEVER; + if (mm == NULL) + return MI_IS_ENABLED_OK; if (lfe->lfe_in_setup) return MI_IS_ENABLED_RETRY; if (lfe->lfe_type != DVB_TYPE_S) diff --git a/src/input/mpegts/linuxdvb/linuxdvb_lnb.c b/src/input/mpegts/linuxdvb/linuxdvb_lnb.c index e376032bf..af7f50926 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_lnb.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_lnb.c @@ -60,6 +60,30 @@ const idclass_t linuxdvb_lnb_class = .ic_class = "linuxdvb_lnb_basic", .ic_caption = N_("LNB"), .ic_get_title = linuxdvb_lnb_class_get_title, + .ic_properties = (const property_t[]) { + { + .type = PT_INT, + .id = "lfo", + .name = N_("Low frequency offset"), + .opts = PO_RDONLY | PO_NOSAVE, + .off = offsetof(linuxdvb_lnb_conf_t, lnb_low), + }, + { + .type = PT_INT, + .id = "hfo", + .name = N_("High frequency offset"), + .opts = PO_RDONLY | PO_NOSAVE, + .off = offsetof(linuxdvb_lnb_conf_t, lnb_high), + }, + { + .type = PT_INT, + .id = "sfo", + .name = N_("Switch frequency offset"), + .opts = PO_RDONLY | PO_NOSAVE, + .off = offsetof(linuxdvb_lnb_conf_t, lnb_switch), + }, + {} + } }; /* ************************************************************************** @@ -185,7 +209,7 @@ linuxdvb_lnb_bandstack_pol * Static list * *************************************************************************/ -struct linuxdvb_lnb_conf linuxdvb_lnb_all[] = { +linuxdvb_lnb_conf_t linuxdvb_lnb_all[] = { { { { .ld_type = "Universal", @@ -401,26 +425,28 @@ linuxdvb_lnb_t * linuxdvb_lnb_create0 ( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls ) { + linuxdvb_lnb_conf_t *lsc = &linuxdvb_lnb_all[0], *lsc2; int i; - /* Setup static entries */ - for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++) - if (!linuxdvb_lnb_all[i].ld_id.in_class) - idnode_insert(&linuxdvb_lnb_all[i].ld_id, NULL, &linuxdvb_lnb_class, 0); - /* Find */ if (name) { - for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++) { - if (!strcmp(linuxdvb_lnb_all[i].ld_type, name)) - return (linuxdvb_lnb_t*)&linuxdvb_lnb_all[i]; - } + for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++) + if (!strcmp(linuxdvb_lnb_all[i].ld_type, name)) { + lsc = &linuxdvb_lnb_all[i]; + break; + } } - return (linuxdvb_lnb_t*)linuxdvb_lnb_all; // Universal + + lsc2 = malloc(sizeof(linuxdvb_lnb_conf_t)); + *lsc2 = *lsc; + return linuxdvb_diseqc_create0(lsc2, NULL, &linuxdvb_lnb_class, conf, lsc->ld_type, ls); } void -linuxdvb_lnb_destroy ( linuxdvb_lnb_t *lnb ) +linuxdvb_lnb_destroy ( linuxdvb_diseqc_t *ld ) { + linuxdvb_diseqc_destroy(ld); + free(ld); } /****************************************************************************** diff --git a/src/input/mpegts/linuxdvb/linuxdvb_private.h b/src/input/mpegts/linuxdvb/linuxdvb_private.h index 3616a8818..8b96b9951 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_private.h +++ b/src/input/mpegts/linuxdvb/linuxdvb_private.h @@ -397,6 +397,8 @@ static inline void linuxdvb_adapter_changed ( linuxdvb_adapter_t *la ) int linuxdvb_adapter_current_weight ( linuxdvb_adapter_t *la ); +const void *linuxdvb_frontend_class_active_get ( void *obj ); + linuxdvb_frontend_t * linuxdvb_frontend_create ( htsmsg_t *conf, linuxdvb_adapter_t *la, int number, @@ -459,7 +461,7 @@ linuxdvb_diseqc_t *linuxdvb_rotor_create0 linuxdvb_diseqc_t *linuxdvb_en50494_create0 ( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls, int port ); -void linuxdvb_lnb_destroy ( linuxdvb_lnb_t *lnb ); +void linuxdvb_lnb_destroy ( linuxdvb_diseqc_t *ld ); void linuxdvb_switch_destroy ( linuxdvb_diseqc_t *ld ); void linuxdvb_rotor_destroy ( linuxdvb_diseqc_t *ld ); void linuxdvb_en50494_destroy ( linuxdvb_diseqc_t *ld ); @@ -480,10 +482,10 @@ static inline int linuxdvb_unicable_is_en50494( const char *str ) void linuxdvb_en50494_init (void); -int linuxdvb_diseqc_raw_send (int fd, uint8_t len, ...); +int linuxdvb_diseqc_raw_send (int fd, int len, ...); int linuxdvb_diseqc_send - (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...); + (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, int len, ...); int linuxdvb_diseqc_set_volt ( linuxdvb_satconf_t *ls, int volt ); /* diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index bcfd4eadf..80e79617d 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -35,6 +35,7 @@ static struct linuxdvb_satconf_type * linuxdvb_satconf_type_find ( const char *type ); struct linuxdvb_satconf_type { + int enable; int ports; const char *type; const char *name; @@ -45,6 +46,24 @@ struct linuxdvb_satconf_type { * Types * *************************************************************************/ +static const void * +linuxdvb_satconf_class_active_get ( void *obj ) +{ + static int active; + linuxdvb_satconf_t *ls = obj; + linuxdvb_satconf_ele_t *lse; + active = 0; + if (linuxdvb_frontend_class_active_get(ls->ls_frontend)) { + TAILQ_FOREACH(lse, &ls->ls_elements, lse_link) { + if (lse->lse_enabled) { + active = 1; + break; + } + } + } + return &active; +} + static linuxdvb_satconf_ele_t * linuxdvb_satconf_class_find_ele( linuxdvb_satconf_t *ls, int idx ) { @@ -220,6 +239,13 @@ const idclass_t linuxdvb_satconf_class = .ic_doc = tvh_doc_linuxdvb_satconf_class, .ic_changed = linuxdvb_satconf_class_changed, .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_satconf_class_active_get, + }, { .type = PT_BOOL, .id = "early_tune", @@ -722,40 +748,46 @@ const idclass_t linuxdvb_satconf_advanced_class = /* Types/classes */ static struct linuxdvb_satconf_type linuxdvb_satconf_types[] = { { - .type = "simple", - .name = N_("Universal LNB only"), - .idc = &linuxdvb_satconf_lnbonly_class, - .ports = 1, + .type = "simple", + .name = N_("Universal LNB only"), + .idc = &linuxdvb_satconf_lnbonly_class, + .ports = 1, + .enable = 1, }, { - .type = "2port", - .name = N_("2-Port switch (universal LNB)"), - .idc = &linuxdvb_satconf_2port_class, - .ports = 2, + .type = "2port", + .name = N_("2-Port switch (universal LNB)"), + .idc = &linuxdvb_satconf_2port_class, + .ports = 2, + .enable = 1, }, { - .type = "4port", - .name = N_("4-Port switch (universal LNB)"), - .idc = &linuxdvb_satconf_4port_class, - .ports = 4, + .type = "4port", + .name = N_("4-Port switch (universal LNB)"), + .idc = &linuxdvb_satconf_4port_class, + .ports = 4, + .enable = 1, }, { - .type = "en50494", - .name = N_("Unicable I switch (universal LNB)"), - .idc = &linuxdvb_satconf_en50494_class, - .ports = 2, + .type = "en50494", + .name = N_("Unicable I switch (universal LNB)"), + .idc = &linuxdvb_satconf_en50494_class, + .ports = 2, + .enable = 1, }, { - .type = "en50607", - .name = N_("Unicable II switch (universal LNB)"), - .idc = &linuxdvb_satconf_en50607_class, - .ports = 4, + .type = "en50607", + .name = N_("Unicable II switch (universal LNB)"), + .idc = &linuxdvb_satconf_en50607_class, + .ports = 4, + .enable = 1, }, { - .type = "advanced", - .name = N_("Advanced (non-universal LNBs, rotors, etc.)"), - .idc = &linuxdvb_satconf_advanced_class, - .ports = 0, + .type = "advanced", + .name = N_("Advanced (non-universal LNBs, rotors, etc.)"), + .idc = &linuxdvb_satconf_advanced_class, + .ports = 0, + .enable = 0, }, }; @@ -1153,7 +1185,9 @@ linuxdvb_satconf_create htsmsg_add_str(l, NULL, str); htsmsg_add_msg(e, "networks", l); } - (void)linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls); + lse = linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls); + if (lst->enable) + lse->lse_enabled = 1; } } @@ -1162,11 +1196,12 @@ linuxdvb_satconf_create } /* Create elements */ - i = 0; lse = TAILQ_FIRST(&ls->ls_elements); - while (i < lst->ports) { + for (i = 0; i < lst->ports; i++) { if (!lse) lse = linuxdvb_satconf_ele_create0(NULL, NULL, ls); + if (lst->enable) + lse->lse_enabled = 1; if (!lse->lse_lnb) lse->lse_lnb = linuxdvb_lnb_create0(NULL, NULL, lse); if (lst->ports > 1) { @@ -1182,7 +1217,6 @@ linuxdvb_satconf_create } } lse = TAILQ_NEXT(lse, lse_link); - i++; } return ls; @@ -1274,9 +1308,11 @@ linuxdvb_satconf_ele_class_network_set( void *o, const void *p ) linuxdvb_satconf_t *sc = ls->lse_parent; linuxdvb_satconf_ele_t *lse; TAILQ_FOREACH(lse, &sc->ls_elements, lse_link) { - for (i = 0; i < lse->lse_networks->is_count; i++) + for (i = 0; i < lse->lse_networks->is_count; i++) { + if (!lse->lse_enabled) continue; htsmsg_add_str(l, NULL, idnode_uuid_as_str(lse->lse_networks->is_array[i], ubuf)); + } } mpegts_input_class_network_set(ls->lse_parent->ls_frontend, l); htsmsg_destroy(l); @@ -1416,6 +1452,17 @@ linuxdvb_satconf_ele_class_changed ( idnode_t *in ) linuxdvb_satconf_class_changed(&lse->lse_parent->ls_id); } +static const void * +linuxdvb_satconf_ele_class_active_get ( void *obj ) +{ + static int active; + linuxdvb_satconf_ele_t *lse = obj; + active = 0; + if (*(int *)linuxdvb_frontend_class_active_get(lse->lse_parent->ls_frontend)) + active = lse->lse_enabled; + return &active; +} + const idclass_t linuxdvb_satconf_ele_class = { .ic_class = "linuxdvb_satconf_ele", @@ -1426,6 +1473,13 @@ const idclass_t linuxdvb_satconf_ele_class = .ic_get_childs = linuxdvb_satconf_ele_class_get_childs, .ic_changed = linuxdvb_satconf_ele_class_changed, .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_satconf_ele_class_active_get, + }, { .type = PT_BOOL, .id = "enabled", @@ -1595,6 +1649,17 @@ linuxdvb_diseqc_class_changed ( idnode_t *o ) linuxdvb_satconf_ele_class_changed(&ld->ld_satconf->lse_id); } +static const void * +linuxdvb_diseqc_class_active_get ( void *obj ) +{ + static int active; + linuxdvb_diseqc_t *ld = obj; + if (ld->ld_satconf) + return linuxdvb_satconf_ele_class_active_get(ld->ld_satconf); + active = 1; + return &active; +} + const idclass_t linuxdvb_diseqc_class = { .ic_class = "linuxdvb_diseqc", @@ -1602,6 +1667,16 @@ const idclass_t linuxdvb_diseqc_class = .ic_event = "linuxdvb_diseqc", .ic_get_title = linuxdvb_diseqc_class_get_title, .ic_changed = linuxdvb_diseqc_class_changed, + .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = linuxdvb_diseqc_class_active_get, + }, + {} + } }; linuxdvb_diseqc_t * @@ -1636,7 +1711,7 @@ linuxdvb_diseqc_destroy ( linuxdvb_diseqc_t *ld ) int linuxdvb_diseqc_raw_send - (int fd, uint8_t len, ...) + (int fd, int len, ...) { int i; va_list ap; @@ -1667,7 +1742,7 @@ linuxdvb_diseqc_raw_send int linuxdvb_diseqc_send - (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...) + (int fd, uint8_t framing, uint8_t addr, uint8_t cmd, int len, ...) { int i; va_list ap; diff --git a/src/input/mpegts/mpegts_input.c b/src/input/mpegts/mpegts_input.c index 4c5e738aa..b8178808e 100644 --- a/src/input/mpegts/mpegts_input.c +++ b/src/input/mpegts/mpegts_input.c @@ -75,6 +75,15 @@ mpegts_input_class_get_title ( idnode_t *in, const char *lang ) return buf; } +const void * +mpegts_input_class_active_get ( void *obj ) +{ + static int active; + mpegts_input_t *mi = obj; + active = mi->mi_is_enabled((mpegts_input_t*)mi, NULL, 0, -1) != MI_IS_ENABLED_NEVER; + return &active; +} + const void * mpegts_input_class_network_get ( void *obj ) { @@ -225,6 +234,13 @@ const idclass_t mpegts_input_class = .ic_perm_def = ACCESS_ADMIN, .ic_get_title = mpegts_input_class_get_title, .ic_properties = (const property_t[]){ + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = mpegts_input_class_active_get, + }, { .type = PT_BOOL, .id = "enabled", diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index 3b56267b7..660ef5b4d 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -141,6 +141,21 @@ satip_device_class_save ( idnode_t *in, char *filename, size_t fsize ) return m; } +static const void * +satip_device_class_active_get ( void * obj ) +{ + static int active; + satip_device_t *sd = (satip_device_t *)obj; + satip_frontend_t *lfe; + active = 0; + TAILQ_FOREACH(lfe, &sd->sd_frontends, sf_link) + if (*(int *)mpegts_input_class_active_get(lfe)) { + active = 1; + break; + } + return &active; +} + static idnode_set_t * satip_device_class_get_childs ( idnode_t *in ) { @@ -218,6 +233,13 @@ const idclass_t satip_device_class = .ic_get_childs = satip_device_class_get_childs, .ic_get_title = satip_device_class_get_title, .ic_properties = (const property_t[]){ + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = satip_device_class_active_get, + }, { .type = PT_STR, .id = "tunercfgu", diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 5efb19dbf..54bfc3abf 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -521,13 +521,17 @@ satip_frontend_is_enabled satip_frontend_t *lfe = (satip_frontend_t*)mi; satip_frontend_t *lfe2; satip_satconf_t *sfc; + int r; lock_assert(&global_lock); - if (!mpegts_input_is_enabled(mi, mm, flags, weight)) - return MI_IS_ENABLED_NEVER; + r = mpegts_input_is_enabled(mi, mm, flags, weight); + if (r != MI_IS_ENABLED_OK) + return r; if (lfe->sf_device->sd_dbus_allow <= 0) return MI_IS_ENABLED_NEVER; + if (mm == NULL) + return MI_IS_ENABLED_OK; if (lfe->sf_type != DVB_TYPE_S) return MI_IS_ENABLED_OK; /* check if the position is enabled */ diff --git a/src/input/mpegts/satip/satip_satconf.c b/src/input/mpegts/satip/satip_satconf.c index 350bd65df..14465cd5b 100644 --- a/src/input/mpegts/satip/satip_satconf.c +++ b/src/input/mpegts/satip/satip_satconf.c @@ -25,6 +25,17 @@ * Frontend callbacks * *************************************************************************/ +static const void * +satip_satconf_class_active_get ( void *obj ) +{ + static int active; + satip_satconf_t *sfc = obj; + active = 0; + if (*(int *)mpegts_input_class_active_get(sfc->sfc_lfe)) + active = sfc->sfc_enabled; + return &active; +} + static satip_satconf_t * satip_satconf_find_ele( satip_frontend_t *lfe, mpegts_mux_t *mux ) { @@ -331,6 +342,13 @@ const idclass_t satip_satconf_class = .ic_get_title = satip_satconf_class_get_title, .ic_changed = satip_satconf_class_changed, .ic_properties = (const property_t[]) { + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = satip_satconf_class_active_get, + }, { .type = PT_BOOL, .id = "enabled", diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index 0c5aaee34..47740a4a0 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -92,6 +92,21 @@ tvhdhomerun_device_class_get_title( idnode_t *in, const char *lang ) return prop_sbuf; } +static const void * +tvhdhomerun_device_class_active_get ( void * obj ) +{ + static int active; + tvhdhomerun_device_t *hd = (tvhdhomerun_device_t *)obj; + tvhdhomerun_frontend_t *lfe; + active = 0; + TAILQ_FOREACH(lfe, &hd->hd_frontends, hf_link) + if (*(int *)mpegts_input_class_active_get(lfe)) { + active = 1; + break; + } + return &active; +} + static htsmsg_t * tvhdhomerun_device_class_override_enum( void * p, const char *lang ) { @@ -166,6 +181,13 @@ const idclass_t tvhdhomerun_device_class = .ic_get_childs = tvhdhomerun_device_class_get_childs, .ic_get_title = tvhdhomerun_device_class_get_title, .ic_properties = (const property_t[]){ + { + .type = PT_BOOL, + .id = "active", + .name = N_("Active"), + .opts = PO_RDONLY | PO_NOSAVE | PO_NOUI, + .get = tvhdhomerun_device_class_active_get, + }, { .type = PT_STR, .id = "networkType", diff --git a/src/webui/static/app/tvadapters.js b/src/webui/static/app/tvadapters.js index ecb103f35..2077f408c 100644 --- a/src/webui/static/app/tvadapters.js +++ b/src/webui/static/app/tvadapters.js @@ -11,7 +11,7 @@ tvheadend.tvadapters = function(panel, index) { var p = n.attributes.params; if (!p) return; for (var i = 0; i < p.length; i++) - if (p[i].id == "enabled" && p[i].value) { + if (p[i].id == "active" && p[i].value) { n.ui.addClass('x-tree-node-on'); break; }