From 5b1e6f67a9d81b4191606efe68e6958c0a915726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Wed, 21 Nov 2007 09:31:50 +0000 Subject: [PATCH] fix initial scanning bugs when having multiple adapters on the same network scrap much of the tda_name logging, it's uninteresting --- dvb.c | 36 +++++++++++++++++++++--------------- htmlui.c | 6 +++--- htsclient.c | 4 ++-- tvhead.h | 2 +- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/dvb.c b/dvb.c index c740d095..67a7d74b 100644 --- a/dvb.c +++ b/dvb.c @@ -158,7 +158,7 @@ dvb_add_adapter(const char *path) LIST_INSERT_HEAD(&dvb_adapters_probing, tda, tda_link); startupcounter++; - tda->tda_name = strdup(tda->tda_fe_info.name); + tda->tda_info = strdup(tda->tda_fe_info.name); dispatch_addfd(tda->tda_fe_fd, dvb_frontend_event, tda, DISPATCH_PRI); @@ -189,7 +189,7 @@ dvb_init(void) if(tdmi == NULL) { syslog(LOG_WARNING, "No muxes configured on \"%s\" DVB adapter unused", - tda->tda_name); + tda->tda_path); } else { dvb_start_initial_scan(tdmi); } @@ -299,15 +299,15 @@ dvb_tune_tdmi(th_dvb_mux_instance_t *tdmi, int maylog, tdmi_state_t state) tdmi->tdmi_state = state; if(maylog) - syslog(LOG_DEBUG, "%s (%s) tuning to mux \"%s\"", - tda->tda_name, tda->tda_path, tdmi->tdmi_mux->tdm_title); + syslog(LOG_DEBUG, "\"%s\" tuning to mux \"%s\"", + tda->tda_path, tdmi->tdmi_mux->tdm_title); i = ioctl(tda->tda_fe_fd, FE_SET_FRONTEND, &tdm->tdm_fe_params); if(i != 0) { if(maylog) - syslog(LOG_ERR, "%s (%s) tuning to transport \"%s\"" + syslog(LOG_ERR, "\"%s\" tuning to transport \"%s\"" " -- Front configuration failed -- %s", - tda->tda_name, tda->tda_path, tdm->tdm_title, + tda->tda_path, tdm->tdm_title, strerror(errno)); return -1; } @@ -794,10 +794,15 @@ dvb_sdt_callback(th_dvb_mux_instance_t *tdmi, uint8_t *ptr, int len, transport_stream_id, service_id, 1); - if(LIST_FIRST(&t->tht_streams) != NULL && t->tht_channel == NULL) { - transport_set_channel(t, channel_find(chname, 1)); - } else { - ret |= 1; + if(t->tht_channel == NULL) { + /* Not yet mapped to a channel */ + if(LIST_FIRST(&t->tht_streams) != NULL) { + /* We have seen a PMT (streams are created), map it */ + transport_set_channel(t, channel_find(chname, 1)); + } else { + /* Return error (so scanning wont continue yet) */ + ret |= 1; + } } } } @@ -853,7 +858,7 @@ tdmi_activate(th_dvb_mux_instance_t *tdmi) startupcounter--; syslog(LOG_INFO, "\"%s\" Initial scan completed, adapter available", - tda->tda_name); + tda->tda_path); /* no more muxes to probe, link adapter to the world */ LIST_REMOVE(tda, tda_link); LIST_INSERT_HEAD(&dvb_adapters_running, tda, tda_link); @@ -870,16 +875,17 @@ tdmi_initial_scan_timeout(void *aux, int64_t now) th_dvb_mux_instance_t *tdmi = aux; th_dvb_adapter_t *tda = tdmi->tdmi_adapter; const char *err; + th_dvb_table_t *tdt; dtimer_disarm(&tdmi->tdmi_initial_scan_timer); if(tdmi->tdmi_status != NULL) err = tdmi->tdmi_status; else - err = "No signal"; + err = "Missing PSI tables, scan will continue"; - syslog(LOG_DEBUG, "\"%s\" on \"%s\" Initial scan timed out -- %s", - tdmi->tdmi_mux->tdm_name, tda->tda_name, err); + syslog(LOG_DEBUG, "\"%s\" mux \"%s\" Initial scan timed out -- %s", + tda->tda_path, tdmi->tdmi_mux->tdm_name, err); tdmi_activate(tdmi); } @@ -903,7 +909,7 @@ tdmi_check_scan_status(th_dvb_mux_instance_t *tdmi) /* All tables seen at least once */ syslog(LOG_DEBUG, "\"%s\" on \"%s\" Initial scan completed", - tdmi->tdmi_mux->tdm_name, tda->tda_name); + tda->tda_path, tdmi->tdmi_mux->tdm_name); tdmi_activate(tdmi); } diff --git a/htmlui.c b/htmlui.c index 77e6bf74..9d50be5a 100644 --- a/htmlui.c +++ b/htmlui.c @@ -810,7 +810,7 @@ page_status(http_connection_t *hc, const char *remain, void *opaque) tcp_qprintf(&tq, "No DVB adapters configured
"); } else { LIST_FOREACH(tda, &dvb_adapters_running, tda_link) { - tcp_qprintf(&tq, "
%s
", tda->tda_path, tda->tda_name); + tcp_qprintf(&tq, "
%s
%s
", tda->tda_path, tda->tda_info); LIST_FOREACH(tdmi, &tda->tda_muxes_active, tdmi_adapter_link) { tcp_qprintf(&tq, @@ -826,7 +826,7 @@ page_status(http_connection_t *hc, const char *remain, void *opaque) tcp_qprintf(&tq, "" + "width: 120px; float: left\">" "%s" "", txt); @@ -845,7 +845,7 @@ page_status(http_connection_t *hc, const char *remain, void *opaque) tcp_qprintf(&tq, "" + "width: 60px; float: left\">" "%s" "", txt); diff --git a/htsclient.c b/htsclient.c index e13b15d0..ecfcda0f 100644 --- a/htsclient.c +++ b/htsclient.c @@ -911,7 +911,7 @@ client_status_update(void *aux, int64_t now) "uncorrected-blocks = %d\n" "rate = %d\n" "cc-errors = %d\n", - tda->tda_name, + tda->tda_path, t->tht_name, tdmi->tdmi_uncorrected_blocks, rate, ccerr); @@ -924,7 +924,7 @@ client_status_update(void *aux, int64_t now) "adapter = %s\n" "transport = %s\n", tdmi->tdmi_status, - tda->tda_name, + tda->tda_path, t->tht_name); } break; diff --git a/tvhead.h b/tvhead.h index e62c3ae5..ce02c88c 100644 --- a/tvhead.h +++ b/tvhead.h @@ -201,7 +201,7 @@ typedef struct th_dvb_adapter { th_dvb_mux_instance_t *tda_mux_current; const char *tda_path; - const char *tda_name; + const char *tda_info; LIST_ENTRY(th_dvb_adapter) tda_link;