dvb: fix disabling of bad muxes caused by dodgy hardware/firmware

because some tuners, mostly USB, can result in ioctl() failures due
to inability to communicate with driver and this was not properly
trapped muxes were being disabled.

Better solution is to reject bad muxes being entered in the first
place based on the tuning capability of the device. Ofc if the
tuner fails to report that correctly (probably) we'll still be
buggered.
This commit is contained in:
Adam Sutton 2013-01-18 11:08:15 +00:00
parent 14fcdcf2fc
commit 9deeeebfc2
2 changed files with 9 additions and 2 deletions

View file

@ -510,7 +510,6 @@ dvb_fe_tune(th_dvb_mux_instance_t *tdmi, const char *reason)
}
/* Mark as bad */
dvb_mux_set_enable(tdmi, 0);
return SM_CODE_TUNING_FAILED;
}

View file

@ -162,6 +162,14 @@ 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))
@ -1171,7 +1179,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 exist";
return "Mux already exists or bad parameters";
return NULL;
}