femanager: do not open unused frontends

this frees the unused frontends for e.g. vtunerd
(reimplementation of 8e7f2ff232)


Origin commit data
------------------
Commit: 999dd041c1
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2013-05-25 (Sat, 25 May 2013)
This commit is contained in:
Stefan Seyfried
2013-05-25 22:58:15 +02:00
parent 2d584bc33d
commit 1adf98ac9a
2 changed files with 14 additions and 3 deletions

View File

@@ -388,6 +388,7 @@ void CFEManager::linkFrontends(bool init)
INFO("linking.."); INFO("linking..");
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
enabled_count = 0; enabled_count = 0;
have_sat = have_cable = have_terr = false;
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second; CFrontend * fe = it->second;
#if 0 #if 0
@@ -440,7 +441,17 @@ void CFEManager::linkFrontends(bool init)
if (init && femode != CFrontend::FE_MODE_UNUSED) if (init && femode != CFrontend::FE_MODE_UNUSED)
fe->Init(); fe->Init();
if (femode != CFrontend::FE_MODE_UNUSED) if (femode != CFrontend::FE_MODE_UNUSED)
{
enabled_count++; 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++) { for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second; CFrontend * fe = it->second;
if(!fe->Locked()) if (!fe->Locked() && fe->getMode() != CFrontend::FE_MODE_UNUSED)
fe->Open(true); fe->Open(true);
if (mode == FE_MODE_SINGLE)
break; /* don't open secondary frontends if only first one is used */
} }
} }

View File

@@ -240,6 +240,8 @@ bool CFrontend::Open(bool init)
void CFrontend::Init(void) void CFrontend::Init(void)
{ {
/* if frontend was not enabled before, it might not be opened */
Open();
mutex.lock(); mutex.lock();
// Set the voltage to On, and wait voltage to become stable // Set the voltage to On, and wait voltage to become stable
// and wait for diseqc equipment to be ready. // and wait for diseqc equipment to be ready.