From 7f89b3d552748f242f150505d44c104926f27285 Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Fri, 18 Jan 2013 15:55:29 +0000 Subject: [PATCH] dvb: undo mod to frequency range testing and add additional tuning check The previous check was garbage because for -S adapters the frequency range reported by the adapter is in local units (i.e. hi/low band taken into account) and not simple kHz. This makes checking more difficult and while its possible I think this should be left for dvb rewrite. Instead I've re-instated the old code, but muxes are only disable if the return is EINVAL, which should only be returned if the DVB layer decides the params are out of range. --- src/dvb/dvb_fe.c | 2 ++ src/dvb/dvb_multiplex.c | 10 +--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/dvb/dvb_fe.c b/src/dvb/dvb_fe.c index b1f9a314..a4e58089 100644 --- a/src/dvb/dvb_fe.c +++ b/src/dvb/dvb_fe.c @@ -510,6 +510,8 @@ dvb_fe_tune(th_dvb_mux_instance_t *tdmi, const char *reason) } /* Mark as bad */ + if (errno == EINVAL) + dvb_mux_set_enable(tdmi, 0); return SM_CODE_TUNING_FAILED; } diff --git a/src/dvb/dvb_multiplex.c b/src/dvb/dvb_multiplex.c index 74c07341..37d3ca17 100644 --- a/src/dvb/dvb_multiplex.c +++ b/src/dvb/dvb_multiplex.c @@ -162,14 +162,6 @@ dvb_mux_create(th_dvb_adapter_t *tda, const struct dvb_mux_conf *dmc, lock_assert(&global_lock); - /* Reject out of range */ - if ((dmc->dmc_fe_params.frequency < tda->tda_fe_info->frequency_min) || - (dmc->dmc_fe_params.frequency > tda->tda_fe_info->frequency_max)) { - tvhlog(LOG_DEBUG, "dvb", "mux rejected with frequency %d", - dmc->dmc_fe_params.frequency); - return NULL; - } - /* HACK - we hash/compare based on 2KHz spacing and compare on +/-500Hz */ LIST_FOREACH(tdmi, &tda->tda_mux_list, tdmi_adapter_hash_link) { if(tdmi_compare_key(&tdmi->tdmi_conf, dmc)) @@ -1179,7 +1171,7 @@ dvb_mux_add_by_params(th_dvb_adapter_t *tda, tdmi = dvb_mux_create(tda, &dmc, 0, 0xffff, NULL, NULL, 1, 1, NULL, NULL); if(tdmi == NULL) - return "Mux already exists or bad parameters"; + return "Mux already exist"; return NULL; }