From 8792c5cb42f41398a881b2810bf0bbdc316e85a5 Mon Sep 17 00:00:00 2001 From: InuSasha Date: Mon, 6 Jan 2014 19:05:26 +0100 Subject: [PATCH] EN50494: add gui interface for configuration - EN50494 configuration - revert drop off compiler optimation --- Makefile | 2 +- src/input/mpegts/linuxdvb/linuxdvb_en50494.c | 2 +- src/input/mpegts/linuxdvb/linuxdvb_satconf.c | 135 +++++++++++++++++++ 3 files changed, 137 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a2e5c65c..f05a939b 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ PROG := $(BUILDDIR)/tvheadend CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations CFLAGS += -Wmissing-prototypes -fms-extensions -CFLAGS += -g -funsigned-char +CFLAGS += -g -funsigned-char -O2 CFLAGS += -D_FILE_OFFSET_BITS=64 CFLAGS += -I${BUILDDIR} -I${ROOTDIR}/src -I${ROOTDIR} LDFLAGS += -lrt -ldl -lpthread -lm diff --git a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c index cef56777..cc1f5b9b 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_en50494.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_en50494.c @@ -188,7 +188,7 @@ linuxdvb_en50494_tune data1 |= band << 2; /* 1bit band lower(0)/upper(1) */ data1 |= t >> 8; /* 2bit transponder value bit 1-2 */ data2 = t & 0xFF; /* 8bit transponder value bit 3-10 */ - tvhlog(LOG_INFO, LINUXDVB_EN50494_NAME, + tvhlog(LOG_DEBUG, LINUXDVB_EN50494_NAME, "lnb=%i, id=%i, freq=%i, pin=%i, v/h=%i, l/u=%i, f=%i, data=0x%02X%02X", le->le_position, le->le_id, le->le_frequency, le->le_pin, pol, band, freq, data1, data2); diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index 4b531bcb..d7aa8c5a 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -163,6 +163,115 @@ linuxdvb_satconf_class_orbitalpos_set return 1; } +static const void * +linuxdvb_satconf_class_en50494_id_get ( void *p ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse = TAILQ_FIRST(&ls->ls_elements); + linuxdvb_en50494_t *le; + static uint16_t default_value = 0; + + if (!lse && !lse->ls_en50494) + return &default_value; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + return &le->le_id; +} + +static int +linuxdvb_satconf_class_en50494_id_set + ( void *p, const void *v ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse; + linuxdvb_en50494_t *le; + uint16_t new_value = *(uint16_t*)v; + + if (new_value < 0 || new_value > 7) + return 1; + + TAILQ_FOREACH(lse, &ls->ls_elements, ls_link) { + if (!lse && !lse->ls_en50494) + continue; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + le->le_id = new_value; + } + return 0; + +} + +static const void * +linuxdvb_satconf_class_en50494_freq_get ( void *p ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse = TAILQ_FIRST(&ls->ls_elements); + linuxdvb_en50494_t *le; + static uint16_t default_value = 0; + + if (!lse && !lse->ls_en50494) + return &default_value; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + return &le->le_frequency; +} + +static int +linuxdvb_satconf_class_en50494_freq_set + ( void *p, const void *v ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse; + linuxdvb_en50494_t *le; + uint16_t new_value = *(uint16_t*)v; + + TAILQ_FOREACH(lse, &ls->ls_elements, ls_link) { + if (!lse && !lse->ls_en50494) + continue; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + le->le_frequency = new_value; + } + return 0; +} + +static const void * +linuxdvb_satconf_class_en50494_pin_get ( void *p ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse = TAILQ_FIRST(&ls->ls_elements); + linuxdvb_en50494_t *le; + static uint16_t default_value = 256; + + if (!lse && !lse->ls_en50494) + return &default_value; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + return &le->le_pin; +} + +static int +linuxdvb_satconf_class_en50494_pin_set + ( void *p, const void *v ) +{ + linuxdvb_satconf_t *ls = p; + linuxdvb_satconf_ele_t *lse; + linuxdvb_en50494_t *le; + uint16_t new_value = *(uint16_t*)v; + + if (new_value < 0 || new_value > 256) + return 1; + + TAILQ_FOREACH(lse, &ls->ls_elements, ls_link) { + if (!lse && !lse->ls_en50494) + continue; + + le = (linuxdvb_en50494_t*)lse->ls_en50494; + le->le_pin = new_value; + } + return 0; +} + static idnode_set_t * linuxdvb_satconf_class_get_childs ( idnode_t *o ) { @@ -325,6 +434,32 @@ const idclass_t linuxdvb_satconf_en50494_class = .list = linuxdvb_satconf_ele_class_network_enum, .opts = PO_NOSAVE, }, + { + .type = PT_U16, + .id = "id", + .name = "ID (0-7)", + .get = linuxdvb_satconf_class_en50494_id_get, + .set = linuxdvb_satconf_class_en50494_id_set, + .opts = PO_NOSAVE, + // TODO: add id list + }, + { + .type = PT_U16, + .id = "freqency", + .name = "Freqency (MHz)", + .get = linuxdvb_satconf_class_en50494_freq_get, + .set = linuxdvb_satconf_class_en50494_freq_set, + .opts = PO_NOSAVE, + }, + { + .type = PT_U16, + .id = "pin", + .name = "PIN (0-255, 256 for no pin)", + .get = linuxdvb_satconf_class_en50494_pin_get, + .set = linuxdvb_satconf_class_en50494_pin_set, + .opts = PO_NOSAVE, + // TODO: add pin list + }, {} } };