From 1adf98ac9af1c36c93186268e18f821d20451f71 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 25 May 2013 22:58:15 +0200 Subject: [PATCH] femanager: do not open unused frontends this frees the unused frontends for e.g. vtunerd (reimplementation of 8e7f2ff232a7dec1629226f949874d14b3d549e5) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/999dd041c1f5e7d0c832e1b01d7a628fea02a7ac Author: Stefan Seyfried Date: 2013-05-25 (Sat, 25 May 2013) --- src/zapit/src/femanager.cpp | 15 ++++++++++++--- src/zapit/src/frontend.cpp | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index 7cf4fa47a..1dc4fd0bb 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -388,6 +388,7 @@ void CFEManager::linkFrontends(bool init) INFO("linking.."); OpenThreads::ScopedLock m_lock(mutex); enabled_count = 0; + have_sat = have_cable = have_terr = false; for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * fe = it->second; #if 0 @@ -440,7 +441,17 @@ void CFEManager::linkFrontends(bool init) if (init && femode != CFrontend::FE_MODE_UNUSED) fe->Init(); if (femode != CFrontend::FE_MODE_UNUSED) + { enabled_count++; + if (fe->isSat()) + have_sat = true; + else if (fe->isCable()) + have_cable = true; + else if (fe->isTerr()) + have_terr = true; + } + else /* unused -> no need to keep open */ + fe->Close(); } } @@ -477,10 +488,8 @@ void CFEManager::Open() { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { CFrontend * fe = it->second; - if(!fe->Locked()) + if (!fe->Locked() && fe->getMode() != CFrontend::FE_MODE_UNUSED) fe->Open(true); - if (mode == FE_MODE_SINGLE) - break; /* don't open secondary frontends if only first one is used */ } } diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index e1ed7a5fe..750d05683 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -240,6 +240,8 @@ bool CFrontend::Open(bool init) void CFrontend::Init(void) { + /* if frontend was not enabled before, it might not be opened */ + Open(); mutex.lock(); // Set the voltage to On, and wait voltage to become stable // and wait for diseqc equipment to be ready.