From 2daf6f6787316f99d392a5002a2f3bcdd06b8369 Mon Sep 17 00:00:00 2001 From: "[CST] Bas" Date: Mon, 26 May 2014 15:04:42 +0200 Subject: [PATCH] fastscan: fix astra1 scan in case there is only one LNB connected to the system. We should check if the data arrived too before deciding if the TP was valid or not. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e9cba838fdc4d07674c91e2c5f239caad0d161d6 Author: [CST] Bas Date: 2014-05-26 (Mon, 26 May 2014) --- src/zapit/include/zapit/fastscan.h | 2 ++ src/zapit/include/zapit/scan.h | 1 + src/zapit/src/fastscan.cpp | 57 ++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/zapit/include/zapit/fastscan.h b/src/zapit/include/zapit/fastscan.h index 397f6c470..5fc8237a4 100644 --- a/src/zapit/include/zapit/fastscan.h +++ b/src/zapit/include/zapit/fastscan.h @@ -47,6 +47,8 @@ typedef enum fs_operator { #define FAST_SCAN_HD 2 #define FAST_SCAN_ALL 3 +#define FAST_TUNE_TPS 2 + typedef struct fast_scan_operator { int id; unsigned short pid; diff --git a/src/zapit/include/zapit/scan.h b/src/zapit/include/zapit/scan.h index 32fab7085..36565cfa9 100644 --- a/src/zapit/include/zapit/scan.h +++ b/src/zapit/include/zapit/scan.h @@ -107,6 +107,7 @@ class CServiceScan : public OpenThreads::Thread std::map fast_services_freq; std::map fast_services_number; std::list > fst_sections; + uint32_t tune_tp_index; unsigned char fst_version; bool quiet_fastscan; diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index a04e6916b..e680cbc96 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -161,15 +161,27 @@ bool CServiceScan::FastscanTune(int id) { uint8_t polarization; FrontendParameters feparams; - bool res = false; + bool res = true; - feparams.dvb_feparams.frequency = 12070000; - feparams.dvb_feparams.u.qpsk.symbol_rate = 27500000; - feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; - polarization = 0; + if (tune_tp_index >= FAST_TUNE_TPS) { + printf("[fast scan] no more TPs to try, exiting\n"); + return false; + } - ReportFastScan(feparams, polarization, 235); - if(!tuneFrequency(&feparams, polarization, 235)) { + if (tune_tp_index == 0) { + printf("[fast scan] try tuning to main TP\n"); + feparams.dvb_feparams.frequency = 12070000; + feparams.dvb_feparams.u.qpsk.symbol_rate = 27500000; + feparams.dvb_feparams.u.qpsk.fec_inner = FEC_3_4; + polarization = 0; + ReportFastScan(feparams, polarization, 235); + res = tuneFrequency(&feparams, polarization, 235); + } + + // if TP 0 lock failed or TP 0 lock succeeded but no fastscan data arrived + // ie on Astra 1 and 3 there are 12070 H 27000 3/4 identical TPs so we can + // not use 'lock-failed' as the only condition to check the next sat/TP. + if (tune_tp_index == 1 || !res) { printf("[fast scan] tune failed, try backup\n"); if (id == HELLO_OPERATOR_ID) { feparams.dvb_feparams.frequency = 12074000; @@ -185,8 +197,7 @@ bool CServiceScan::FastscanTune(int id) ReportFastScan(feparams, polarization, 192); res = tuneFrequency(&feparams, polarization, 192); } - } else - res = true; + } return res; } @@ -199,6 +210,9 @@ bool CServiceScan::ScanFast() INFO("[fast scan] invalid operator %d", num); return false; } + + tune_tp_index = 0; + return ScanFast(num); } @@ -219,16 +233,23 @@ bool CServiceScan::ScanFast(int num, bool reload) printf("[fast scan] scaning operator %d [%s], pid 0x%x\n", op->id, op->name, op->pid); - if (!FastscanTune(op->id)) - goto _err; + while (tune_tp_index < FAST_TUNE_TPS) { + if (!FastscanTune(op->id)) + goto _err; - if (!quiet_fastscan) - CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); + if (!quiet_fastscan) + CZapit::getInstance()->SendEvent(CZapitClient::EVT_SCAN_SATELLITE, op->name, strlen(op->name)+1); - scanBouquetManager = new CBouquetManager(); + if (!scanBouquetManager) + scanBouquetManager = new CBouquetManager(); - if(ParseFnt(op->pid, op->id)) - ParseFst(op->pid, op); + if (ParseFnt(op->pid, op->id)) + break; + + tune_tp_index++; + } + + ParseFst(op->pid, op); //FIXME move to Cleanup() ? if(found_channels) { @@ -303,7 +324,7 @@ bool CServiceScan::ReadFst(unsigned short pid, unsigned short operator_id, bool cDemux * dmx = new cDemux(); dmx->Open(DMX_PSI_CHANNEL); - if (dmx->sectionFilter(pid, filter, mask, 3) < 0) { + if (dmx->sectionFilter(pid, filter, mask, 3, 3000) < 0) { delete dmx; return false; } @@ -555,7 +576,7 @@ bool CServiceScan::ParseFnt(unsigned short pid, unsigned short operator_id) frontendType = FE_QPSK; printf("[FNT] scaning pid %d operator %d\n", pid, operator_id); - if (dmx->sectionFilter(pid, filter, mask, 3) < 0) { + if (dmx->sectionFilter(pid, filter, mask, 3, 3000) < 0) { delete dmx; return false; }