From 43251f7fc63aeb7f35591c17eeaf51a9502d8c4f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 3 Feb 2014 11:33:43 +0100 Subject: [PATCH] Power off LNB when idle Try to reduce power, when no streams are captured from DVB-S/S2 devices. --- src/input/mpegts/linuxdvb/linuxdvb_private.h | 5 +++++ src/input/mpegts/linuxdvb/linuxdvb_satconf.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/input/mpegts/linuxdvb/linuxdvb_private.h b/src/input/mpegts/linuxdvb/linuxdvb_private.h index 12aebded..f03c43db 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_private.h +++ b/src/input/mpegts/linuxdvb/linuxdvb_private.h @@ -126,6 +126,11 @@ struct linuxdvb_satconf gtimer_t ls_diseqc_timer; int ls_diseqc_idx; int ls_diseqc_repeats; + + /* + * LNB settings + */ + int ls_lnb_poweroff; /* * Satconf elements diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index 71d5f259..8d49dad3 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -193,6 +193,14 @@ const idclass_t linuxdvb_satconf_class = .opts = PO_ADVANCED, .def.i = 0 }, + { + .type = PT_BOOL, + .id = "lnb_poweroff", + .name = "Turn off LNB when idle", + .off = offsetof(linuxdvb_satconf_t, ls_lnb_poweroff), + .opts = PO_ADVANCED, + .def.i = 1 + }, {} } }; @@ -889,6 +897,9 @@ linuxdvb_satconf_ele_stop_mux if (ls->ls_frontend) ls->ls_frontend->mi_stop_mux(ls->ls_frontend, mmi); gtimer_disarm(&ls->ls_diseqc_timer); + if (ls->ls_frontend && ls->ls_lnb_poweroff) + linuxdvb_diseqc_set_volt( + ((linuxdvb_frontend_t *)ls->ls_frontend)->lfe_fe_fd, -1); } static void linuxdvb_satconf_ele_tune_cb ( void *o ); @@ -1260,12 +1271,14 @@ int linuxdvb_diseqc_set_volt ( int fd, int vol ) { /* Set voltage */ - tvhtrace("disqec", "set voltage %dV", vol ? 18 : 13); - if (ioctl(fd, FE_SET_VOLTAGE, vol ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13)) { + tvhtrace("diseqc", "set voltage %dV", vol ? (vol < 0 ? 0 : 18) : 13); + if (ioctl(fd, FE_SET_VOLTAGE, + vol ? (vol < 0 ? SEC_VOLTAGE_OFF : SEC_VOLTAGE_18) : SEC_VOLTAGE_13)) { tvherror("diseqc", "failed to set voltage (e=%s)", strerror(errno)); return -1; } - usleep(15000); + if (vol >= 0) + usleep(15000); return 0; }